mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-12 22:05:33 +00:00
Improved debug messages
This commit is contained in:
parent
53a8fbeb2a
commit
91e26d1a0e
@ -231,6 +231,9 @@ pub fn ___syscall42(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int
|
|||||||
let result: c_int = unsafe { libc::pipe(fd_ptr, 2048, 0) };
|
let result: c_int = unsafe { libc::pipe(fd_ptr, 2048, 0) };
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
let result: c_int = unsafe { libc::pipe(fd_ptr) };
|
let result: c_int = unsafe { libc::pipe(fd_ptr) };
|
||||||
|
if result == -1 {
|
||||||
|
debug!("=> os error: {}", Error::last_os_error())
|
||||||
|
};
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,7 +508,14 @@ pub fn ___syscall146(ctx: &mut Ctx, _which: i32, mut varargs: VarArgs) -> i32 {
|
|||||||
let iov_len = (*guest_iov_addr).iov_len as _;
|
let iov_len = (*guest_iov_addr).iov_len as _;
|
||||||
// debug!("=> iov_addr: {:?}, {:?}", iov_base, iov_len);
|
// debug!("=> iov_addr: {:?}, {:?}", iov_base, iov_len);
|
||||||
let curr = write(fd, iov_base, iov_len);
|
let curr = write(fd, iov_base, iov_len);
|
||||||
|
debug!(
|
||||||
|
"=> iov_base: {}, iov_len: {}, curr = {}",
|
||||||
|
(*guest_iov_addr).iov_base,
|
||||||
|
iov_len,
|
||||||
|
curr
|
||||||
|
);
|
||||||
if curr < 0 {
|
if curr < 0 {
|
||||||
|
debug!("=> os error: {}", Error::last_os_error());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ret += curr;
|
ret += curr;
|
||||||
@ -554,13 +564,13 @@ pub fn ___syscall195(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_in
|
|||||||
let mut _stat: stat = std::mem::zeroed();
|
let mut _stat: stat = std::mem::zeroed();
|
||||||
let ret = stat(real_path, &mut _stat);
|
let ret = stat(real_path, &mut _stat);
|
||||||
debug!(
|
debug!(
|
||||||
"=> pathname: {}, buf: {} = {}, last os error: {}",
|
"=> pathname: {}, buf: {} = {}",
|
||||||
std::ffi::CStr::from_ptr(real_path).to_str().unwrap(),
|
std::ffi::CStr::from_ptr(real_path).to_str().unwrap(),
|
||||||
buf,
|
buf,
|
||||||
ret,
|
ret
|
||||||
Error::last_os_error()
|
|
||||||
);
|
);
|
||||||
if ret != 0 {
|
if ret != 0 {
|
||||||
|
debug!("=> os error: {}", Error::last_os_error());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
copy_stat_into_wasm(ctx, buf, &_stat);
|
copy_stat_into_wasm(ctx, buf, &_stat);
|
||||||
@ -571,19 +581,20 @@ pub fn ___syscall195(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_in
|
|||||||
// fstat64
|
// fstat64
|
||||||
pub fn ___syscall197(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
|
pub fn ___syscall197(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
|
||||||
debug!("emscripten::___syscall197 (fstat64) {}", _which);
|
debug!("emscripten::___syscall197 (fstat64) {}", _which);
|
||||||
|
|
||||||
let fd: c_int = varargs.get(ctx);
|
let fd: c_int = varargs.get(ctx);
|
||||||
let buf: u32 = varargs.get(ctx);
|
let buf: u32 = varargs.get(ctx);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut stat = std::mem::zeroed();
|
let mut stat = std::mem::zeroed();
|
||||||
let ret = fstat(fd, &mut stat);
|
let ret = fstat(fd, &mut stat);
|
||||||
debug!("ret: {}", ret);
|
debug!("=> fd: {}, buf: {} = {}", fd, buf, ret);
|
||||||
if ret != 0 {
|
if ret != 0 {
|
||||||
|
debug!("=> os error: {}", Error::last_os_error());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
copy_stat_into_wasm(ctx, buf, &stat);
|
copy_stat_into_wasm(ctx, buf, &stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user