mirror of
https://github.com/fluencelabs/wasmer
synced 2025-07-05 11:31:36 +00:00
Move inline breakpoint outside of runtime backend
There was some code smell leaking inline breakpoint implementation into the runtime core backend instead of the compiler itself
This commit is contained in:
@ -272,9 +272,7 @@ extern "C" fn signal_trap_handler(
|
||||
siginfo: *mut siginfo_t,
|
||||
ucontext: *mut c_void,
|
||||
) {
|
||||
use crate::backend::{
|
||||
get_inline_breakpoint_size, read_inline_breakpoint, Architecture, InlineBreakpointType,
|
||||
};
|
||||
use crate::backend::{Architecture, InlineBreakpointType};
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
static ARCH: Architecture = Architecture::X64;
|
||||
@ -291,17 +289,18 @@ extern "C" fn signal_trap_handler(
|
||||
CURRENT_CODE_VERSIONS.with(|versions| {
|
||||
let versions = versions.borrow();
|
||||
for v in versions.iter() {
|
||||
let magic_size = if let Some(x) = get_inline_breakpoint_size(ARCH, v.backend) {
|
||||
x
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
let runnable_module = v.runnable_module.borrow();
|
||||
let magic_size =
|
||||
if let Some(x) = runnable_module.get_inline_breakpoint_size(ARCH) {
|
||||
x
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
let ip = fault.ip.get();
|
||||
let end = v.base + v.msm.total_size;
|
||||
if ip >= v.base && ip < end && ip + magic_size <= end {
|
||||
if let Some(ib) = read_inline_breakpoint(
|
||||
if let Some(ib) = runnable_module.read_inline_breakpoint(
|
||||
ARCH,
|
||||
v.backend,
|
||||
std::slice::from_raw_parts(ip as *const u8, magic_size),
|
||||
) {
|
||||
match ib.ty {
|
||||
|
Reference in New Issue
Block a user