mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-27 15:41:33 +00:00
get debug statements working; add some extra info
This commit is contained in:
@ -15,7 +15,7 @@ use std::ffi::c_void;
|
|||||||
|
|
||||||
pub use self::utils::is_wasi_module;
|
pub use self::utils::is_wasi_module;
|
||||||
|
|
||||||
use wasmer_runtime_core::{func, import::ImportObject, imports};
|
use wasmer_runtime_core::{debug, func, import::ImportObject, imports};
|
||||||
|
|
||||||
pub fn generate_import_object(args: Vec<Vec<u8>>, envs: Vec<Vec<u8>>) -> ImportObject {
|
pub fn generate_import_object(args: Vec<Vec<u8>>, envs: Vec<Vec<u8>>) -> ImportObject {
|
||||||
let state_gen = move || {
|
let state_gen = move || {
|
||||||
|
@ -11,7 +11,7 @@ use crate::{
|
|||||||
state::WasiState,
|
state::WasiState,
|
||||||
};
|
};
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use wasmer_runtime_core::{memory::Memory, vm::Ctx};
|
use wasmer_runtime_core::{debug, memory::Memory, vm::Ctx};
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||||
pub use unix::*;
|
pub use unix::*;
|
||||||
@ -269,7 +269,7 @@ pub fn fd_fdstat_get(
|
|||||||
fd: __wasi_fd_t,
|
fd: __wasi_fd_t,
|
||||||
buf: WasmPtr<__wasi_fdstat_t>,
|
buf: WasmPtr<__wasi_fdstat_t>,
|
||||||
) -> __wasi_errno_t {
|
) -> __wasi_errno_t {
|
||||||
debug!("wasi::fd_fdstat_get");
|
debug!("wasi::fd_fdstat_get: fd={}", fd);
|
||||||
let mut state = get_wasi_state(ctx);
|
let mut state = get_wasi_state(ctx);
|
||||||
let memory = ctx.memory(0);
|
let memory = ctx.memory(0);
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ pub fn fd_prestat_get(
|
|||||||
fd: __wasi_fd_t,
|
fd: __wasi_fd_t,
|
||||||
buf: WasmPtr<__wasi_prestat_t>,
|
buf: WasmPtr<__wasi_prestat_t>,
|
||||||
) -> __wasi_errno_t {
|
) -> __wasi_errno_t {
|
||||||
debug!("wasi::fd_prestat_get");
|
debug!("wasi::fd_prestat_get: fd={}", fd);
|
||||||
let memory = ctx.memory(0);
|
let memory = ctx.memory(0);
|
||||||
|
|
||||||
if let Ok(prestat_ptr) = buf.deref(memory) {
|
if let Ok(prestat_ptr) = buf.deref(memory) {
|
||||||
@ -403,10 +403,20 @@ pub fn fd_prestat_dir_name(
|
|||||||
path: WasmPtr<u8, Array>,
|
path: WasmPtr<u8, Array>,
|
||||||
path_len: u32,
|
path_len: u32,
|
||||||
) -> __wasi_errno_t {
|
) -> __wasi_errno_t {
|
||||||
debug!("wasi::fd_prestat_dir_name");
|
debug!(
|
||||||
|
"wasi::fd_prestat_dir_name: fd={}, path_len={}",
|
||||||
|
fd, path_len
|
||||||
|
);
|
||||||
let memory = ctx.memory(0);
|
let memory = ctx.memory(0);
|
||||||
|
|
||||||
if let Ok(path_chars) = path.deref(memory, 0, path_len) {
|
if let Ok(path_chars) = path.deref(memory, 0, path_len) {
|
||||||
|
debug!(
|
||||||
|
"=> path: {}",
|
||||||
|
path_chars
|
||||||
|
.iter()
|
||||||
|
.map(|c| c.get() as char)
|
||||||
|
.collect::<String>()
|
||||||
|
);
|
||||||
if true
|
if true
|
||||||
/* check if dir */
|
/* check if dir */
|
||||||
{
|
{
|
||||||
@ -854,7 +864,7 @@ pub fn poll_oneoff(
|
|||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
pub fn proc_exit(ctx: &mut Ctx, rval: __wasi_exitcode_t) -> Result<(), &'static str> {
|
pub fn proc_exit(ctx: &mut Ctx, rval: __wasi_exitcode_t) -> Result<(), &'static str> {
|
||||||
debug!("wasi::proc_exit");
|
debug!("wasi::proc_exit, {}", rval);
|
||||||
Err("Instance exited")
|
Err("Instance exited")
|
||||||
}
|
}
|
||||||
pub fn proc_raise(ctx: &mut Ctx, sig: __wasi_signal_t) -> __wasi_errno_t {
|
pub fn proc_raise(ctx: &mut Ctx, sig: __wasi_signal_t) -> __wasi_errno_t {
|
||||||
|
Reference in New Issue
Block a user