mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-29 16:41:33 +00:00
Improved debug statements
This commit is contained in:
@ -3,7 +3,6 @@ use libc::{printf, putchar};
|
||||
|
||||
extern "C" fn _printf(memory_offset: i32, extra: i32, instance: &Instance) -> i32 {
|
||||
let mem = &instance.memories[0];
|
||||
println!("instance = {:?}", instance);
|
||||
return unsafe {
|
||||
let base_memory_offset = mem.mmap.as_ptr().offset(memory_offset as isize) as *const i8;
|
||||
printf(base_memory_offset, extra)
|
||||
|
@ -23,17 +23,3 @@ macro_rules! include_wast2wasm_bytes {
|
||||
wat2wasm(WAST_BYTES.to_vec()).expect(&format!("Can't convert {} file to wasm", $x))
|
||||
}};
|
||||
}
|
||||
|
||||
// #[cfg(feature= "debug")]
|
||||
#[macro_export]
|
||||
macro_rules! debug {
|
||||
($fmt:expr) => (println!(concat!("Wasmer::", $fmt)));
|
||||
($fmt:expr, $($arg:tt)*) => (println!(concat!("Wasmer::", $fmt, "\n"), $($arg)*));
|
||||
}
|
||||
|
||||
// #[cfg(not(feature= "debug"))]
|
||||
// #[macro_export]
|
||||
// macro_rules! debug {
|
||||
// ($fmt:expr) => {};
|
||||
// ($fmt:expr, $($arg:tt)*) => {};
|
||||
// }
|
||||
|
@ -20,7 +20,8 @@ extern crate spin;
|
||||
// #[global_allocator]
|
||||
// static A: System = System;
|
||||
|
||||
// #[macro_use] extern crate log;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
// use libc;
|
||||
use std::error::Error;
|
||||
@ -89,9 +90,8 @@ fn execute_wasm(wasm_path: PathBuf) -> Result<(), String> {
|
||||
Some(&webassembly::Export::Function(index)) => index,
|
||||
_ => panic!("Main function not found"),
|
||||
});
|
||||
let main: fn(&webassembly::Instance) -> i32 = get_instance_function!(instance, func_index);
|
||||
let result = main(&instance);
|
||||
println!("RESULT {}", result);
|
||||
let main: fn(&webassembly::Instance) = get_instance_function!(instance, func_index);
|
||||
main(&instance);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ impl Instance {
|
||||
func_context
|
||||
.compile_and_emit(&*isa, &mut code_buf, &mut reloc_sink, &mut trap_sink)
|
||||
.map_err(|e| {
|
||||
println!("CompileError: {}", e.to_string());
|
||||
debug!("CompileError: {}", e.to_string());
|
||||
ErrorKind::CompileError(e.to_string())
|
||||
})?;
|
||||
// We set this code_buf to be readable & executable
|
||||
|
Reference in New Issue
Block a user