Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug argument info #67

Merged
merged 3 commits into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ jobs:

steps:
- checkout
- run:
name: Pull submodules
command: |
# git pull --recurse-submodules
git submodule sync --recursive
git submodule update --recursive --init
- restore_cache:
keys:
- v4-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}
Expand All @@ -34,12 +28,6 @@ jobs:

steps:
- checkout
- run:
name: Pull submodules
command: |
# git pull --recurse-submodules
git submodule sync --recursive
git submodule update --recursive --init
- restore_cache:
keys:
- v4-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}
Expand Down Expand Up @@ -82,12 +70,6 @@ jobs:

steps:
- checkout
- run:
name: Pull submodules
command: |
# git pull --recurse-submodules
git submodule sync --recursive
git submodule update --recursive --init
- restore_cache:
keys:
- v4-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }}
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ wasmer run examples/nginx/nginx.wasm -- -p examples/nginx -c nginx.conf
To build this project you will need Rust and Cargo.

```sh
# checkout code and associated submodules
git clone --recursive https://github.com/wasmerio/wasmer.git
# checkout code
git clone https://github.com/wasmerio/wasmer.git
cd wasmer

# install tools
Expand Down
1 change: 0 additions & 1 deletion cranelift
Submodule cranelift deleted from cb62a1
2 changes: 1 addition & 1 deletion src/apis/emscripten/errno.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// use std::collections::HashMap;

pub extern "C" fn ___seterrno(value: i32) -> i32 {
debug!("emscripten::___seterrno");
debug!("emscripten::___seterrno {}", value);
// TODO: Incomplete impl
eprintln!("failed to set errno!");
value
Expand Down
2 changes: 1 addition & 1 deletion src/apis/emscripten/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use libc::putchar;

/// printf
pub extern "C" fn printf(memory_offset: i32, extra: i32, instance: &Instance) -> i32 {
debug!("emscripten::printf");
debug!("emscripten::printf {}, {}", memory_offset, extra);
unsafe {
let addr = instance.memory_offset_addr(0, memory_offset as _) as _;
_printf(addr, extra)
Expand Down
8 changes: 4 additions & 4 deletions src/apis/emscripten/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use crate::webassembly::Instance;
use libc::c_int;

// NOTE: Not implemented by Emscripten
pub extern "C" fn ___lock(_which: c_int, _varargs: c_int, _instance: &mut Instance) {
debug!("emscripten::___lock");
pub extern "C" fn ___lock(which: c_int, varargs: c_int, _instance: &mut Instance) {
debug!("emscripten::___lock {}, {}", which, varargs);
}

// NOTE: Not implemented by Emscripten
pub extern "C" fn ___unlock(_which: c_int, _varargs: c_int, _instance: &mut Instance) {
debug!("emscripten::___unlock");
pub extern "C" fn ___unlock(which: c_int, varargs: c_int, _instance: &mut Instance) {
debug!("emscripten::___unlock {}, {}", which, varargs);
}
5 changes: 4 additions & 1 deletion src/apis/emscripten/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ pub extern "C" fn _emscripten_memcpy_big(
len: u32,
instance: &mut Instance,
) -> u32 {
debug!("emscripten::_emscripten_memcpy_big");
debug!(
"emscripten::_emscripten_memcpy_big {}, {}, {}",
dest, src, len
);
let dest_addr = instance.memory_offset_addr(0, dest as usize) as *mut c_void;
let src_addr = instance.memory_offset_addr(0, src as usize) as *mut c_void;
unsafe {
Expand Down
40 changes: 20 additions & 20 deletions src/apis/emscripten/nullfunc.rs
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
use super::process::abort_with_message;
use crate::webassembly::Instance;

pub extern "C" fn nullfunc_ii(_x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_ii");
pub extern "C" fn nullfunc_ii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_ii {}", x);
abort_with_message("Invalid function pointer called with signature 'ii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
}

pub extern "C" fn nullfunc_iii(_x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iii");
pub extern "C" fn nullfunc_iii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iii {}", x);
abort_with_message("Invalid function pointer called with signature 'iii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
}

pub extern "C" fn nullfunc_iiii(_x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iiii");
pub extern "C" fn nullfunc_iiii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iiii {}", x);
abort_with_message("Invalid function pointer called with signature 'iiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
}

pub extern "C" fn nullfunc_iiiii(_x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iiiii");
pub extern "C" fn nullfunc_iiiii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iiiii {}", x);
abort_with_message("Invalid function pointer called with signature 'iiiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
}

pub extern "C" fn nullfunc_iiiiii(_x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iiiiii");
pub extern "C" fn nullfunc_iiiiii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iiiiii {}", x);
abort_with_message("Invalid function pointer called with signature 'iiiiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
}

pub extern "C" fn nullfunc_v(_x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_v");
pub extern "C" fn nullfunc_v(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_v {}", x);
abort_with_message("Invalid function pointer called with signature 'v'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
}

pub extern "C" fn nullfunc_vi(_x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_vi");
pub extern "C" fn nullfunc_vi(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_vi {}", x);
abort_with_message("Invalid function pointer called with signature 'vi'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
}

pub extern "C" fn nullfunc_vii(_x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_vii");
pub extern "C" fn nullfunc_vii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_vii {}", x);
abort_with_message("Invalid function pointer called with signature 'vii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
}

pub extern "C" fn nullfunc_viii(_x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_viii");
pub extern "C" fn nullfunc_viii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_viii {}", x);
abort_with_message("Invalid function pointer called with signature 'viii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
}

pub extern "C" fn nullfunc_viiii(_x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_viiii");
pub extern "C" fn nullfunc_viiii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_viiii {}", x);
abort_with_message("Invalid function pointer called with signature 'viiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
}
4 changes: 2 additions & 2 deletions src/apis/emscripten/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ pub extern "C" fn _fork(_instance: &mut Instance) -> pid_t {
}

pub extern "C" fn _exit(status: c_int, _instance: &mut Instance) -> ! {
debug!("emscripten::_exit");
debug!("emscripten::_exit {}", status);
unsafe { exit(status) }
}

pub extern "C" fn em_abort(message: u32, instance: &mut Instance) {
debug!("emscripten::em_abort");
debug!("emscripten::em_abort {}", message);
let message_addr = instance.memory_offset_addr(0, message as usize) as *mut c_char;
unsafe {
let message = CStr::from_ptr(message_addr)
Expand Down
11 changes: 3 additions & 8 deletions src/apis/emscripten/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,13 @@ pub extern "C" fn _sigemptyset(set: u32, instance: &mut Instance) -> i32 {
0
}

pub extern "C" fn _sigaction(
_signum: u32,
_act: u32,
_oldact: u32,
_instance: &mut Instance,
) -> i32 {
debug!("emscripten::_sigaction");
pub extern "C" fn _sigaction(signum: u32, act: u32, oldact: u32, _instance: &mut Instance) -> i32 {
debug!("emscripten::_sigaction {}, {}, {}", signum, act, oldact);
0
}

pub extern "C" fn _sigaddset(set: u32, signum: u32, instance: &mut Instance) -> i32 {
debug!("emscripten::_sigaddset");
debug!("emscripten::_sigaddset {}, {}", set, signum);
let set_addr = instance.memory_offset_addr(0, set as _) as *mut u32;
unsafe {
*set_addr |= 1 << (signum - 1);
Expand Down
Loading