Fix abort signature in emscripten ABI

This commit is contained in:
Mark McCaskey
2019-12-02 15:09:42 -08:00
parent d639748a20
commit cd946f1d27
2 changed files with 7 additions and 3 deletions

View File

@ -32,7 +32,8 @@ pub fn ___cxa_rethrow_primary_exception(_ctx: &mut Ctx, _a: u32) {
/// TODO: We don't have support for exceptions yet /// TODO: We don't have support for exceptions yet
pub fn ___cxa_throw(ctx: &mut Ctx, _ptr: u32, _ty: u32, _destructor: u32) { pub fn ___cxa_throw(ctx: &mut Ctx, _ptr: u32, _ty: u32, _destructor: u32) {
debug!("emscripten::___cxa_throw"); debug!("emscripten::___cxa_throw");
_abort(ctx); eprintln!("Throwing exceptions not yet implemented: aborting!");
_abort(ctx, 0);
} }
pub fn ___cxa_begin_catch(_ctx: &mut Ctx, _exception_object_ptr: u32) -> i32 { pub fn ___cxa_begin_catch(_ctx: &mut Ctx, _exception_object_ptr: u32) -> i32 {

View File

@ -10,11 +10,14 @@ use wasmer_runtime_core::vm::Ctx;
pub fn abort_with_message(ctx: &mut Ctx, message: &str) { pub fn abort_with_message(ctx: &mut Ctx, message: &str) {
debug!("emscripten::abort_with_message"); debug!("emscripten::abort_with_message");
println!("{}", message); println!("{}", message);
_abort(ctx); _abort(ctx, 0);
} }
pub fn _abort(_ctx: &mut Ctx) { pub fn _abort(_ctx: &mut Ctx, arg: u32) {
debug!("emscripten::_abort"); debug!("emscripten::_abort");
if arg != 0 {
eprintln!("Program aborted with value {}", arg);
}
unsafe { unsafe {
abort(); abort();
} }