mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-15 18:01:22 +00:00
Unwind if breakpoint handler returns error.
This commit is contained in:
@ -282,6 +282,9 @@ extern "C" fn signal_trap_handler(
|
|||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
static ARCH: Architecture = Architecture::Aarch64;
|
static ARCH: Architecture = Architecture::Aarch64;
|
||||||
|
|
||||||
|
let mut should_unwind = false;
|
||||||
|
let mut unwind_result: Box<dyn Any> = Box::new(());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let fault = get_fault_info(siginfo as _, ucontext);
|
let fault = get_fault_info(siginfo as _, ucontext);
|
||||||
let early_return = allocate_and_run(TRAP_STACK_SIZE, || {
|
let early_return = allocate_and_run(TRAP_STACK_SIZE, || {
|
||||||
@ -313,8 +316,9 @@ extern "C" fn signal_trap_handler(
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
if let Some(Ok(())) = out {
|
if let Some(Ok(())) = out {
|
||||||
} else {
|
} else if let Some(Err(e)) = out {
|
||||||
println!("Failed calling middleware: {:?}", out);
|
should_unwind = true;
|
||||||
|
unwind_result = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => println!("Unknown breakpoint type: {:?}", ib.ty),
|
_ => println!("Unknown breakpoint type: {:?}", ib.ty),
|
||||||
@ -329,13 +333,14 @@ extern "C" fn signal_trap_handler(
|
|||||||
false
|
false
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
if should_unwind {
|
||||||
|
begin_unsafe_unwind(unwind_result);
|
||||||
|
}
|
||||||
if early_return {
|
if early_return {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut unwind_result: Box<dyn Any> = Box::new(());
|
should_unwind = allocate_and_run(TRAP_STACK_SIZE, || {
|
||||||
|
|
||||||
let should_unwind = allocate_and_run(TRAP_STACK_SIZE, || {
|
|
||||||
let mut is_suspend_signal = false;
|
let mut is_suspend_signal = false;
|
||||||
|
|
||||||
WAS_SIGINT_TRIGGERED.with(|x| x.set(false));
|
WAS_SIGINT_TRIGGERED.with(|x| x.set(false));
|
||||||
|
Reference in New Issue
Block a user