mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-12 22:05:33 +00:00
Bkpt* -> Breakpoint*
This commit is contained in:
parent
7f28a4dbef
commit
f32b22d571
@ -9,7 +9,7 @@ use crate::{
|
||||
|
||||
use crate::{
|
||||
cache::{Artifact, Error as CacheError},
|
||||
codegen::BkptMap,
|
||||
codegen::BreakpointMap,
|
||||
module::ModuleInfo,
|
||||
sys::Memory,
|
||||
};
|
||||
@ -90,7 +90,7 @@ pub trait RunnableModule: Send + Sync {
|
||||
None
|
||||
}
|
||||
|
||||
fn get_breakpoints(&self) -> Option<BkptMap> {
|
||||
fn get_breakpoints(&self) -> Option<BreakpointMap> {
|
||||
None
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,8 @@ use std::sync::{Arc, RwLock};
|
||||
use wasmparser::{self, WasmDecoder};
|
||||
use wasmparser::{Operator, Type as WpType};
|
||||
|
||||
pub type BkptHandler = Box<Fn(BkptInfo) -> Result<(), Box<dyn Any>> + Send + Sync + 'static>;
|
||||
pub type BkptMap = Arc<HashMap<usize, BkptHandler>>;
|
||||
pub type BreakpointHandler = Box<Fn(BreakpointInfo) -> Result<(), Box<dyn Any>> + Send + Sync + 'static>;
|
||||
pub type BreakpointMap = Arc<HashMap<usize, BreakpointHandler>>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Event<'a, 'b> {
|
||||
@ -30,7 +30,7 @@ pub enum Event<'a, 'b> {
|
||||
pub enum InternalEvent {
|
||||
FunctionBegin(u32),
|
||||
FunctionEnd,
|
||||
Breakpoint(BkptHandler),
|
||||
Breakpoint(BreakpointHandler),
|
||||
SetInternal(u32),
|
||||
GetInternal(u32),
|
||||
}
|
||||
@ -47,7 +47,7 @@ impl fmt::Debug for InternalEvent {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BkptInfo<'a> {
|
||||
pub struct BreakpointInfo<'a> {
|
||||
pub fault: Option<&'a dyn Any>,
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ mod raw {
|
||||
}
|
||||
}
|
||||
|
||||
use crate::codegen::{BkptInfo, BkptMap};
|
||||
use crate::codegen::{BreakpointInfo, BreakpointMap};
|
||||
use crate::state::x64::{build_instance_image, read_stack, X64Register, GPR, XMM};
|
||||
use crate::vm;
|
||||
use libc::{mmap, mprotect, siginfo_t, MAP_ANON, MAP_PRIVATE, PROT_NONE, PROT_READ, PROT_WRITE};
|
||||
@ -34,7 +34,7 @@ type SetJmpBuffer = [i32; SETJMP_BUFFER_LEN];
|
||||
|
||||
struct UnwindInfo {
|
||||
jmpbuf: SetJmpBuffer, // in
|
||||
breakpoints: Option<BkptMap>,
|
||||
breakpoints: Option<BreakpointMap>,
|
||||
payload: Option<Box<Any>>, // out
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ pub unsafe fn clear_wasm_interrupt() {
|
||||
|
||||
pub unsafe fn catch_unsafe_unwind<R, F: FnOnce() -> R>(
|
||||
f: F,
|
||||
breakpoints: Option<BkptMap>,
|
||||
breakpoints: Option<BreakpointMap>,
|
||||
) -> Result<R, Box<Any>> {
|
||||
let unwind = UNWIND.with(|x| x.get());
|
||||
let old = (*unwind).take();
|
||||
@ -120,7 +120,7 @@ pub unsafe fn begin_unsafe_unwind(e: Box<Any>) -> ! {
|
||||
raw::longjmp(&mut inner.jmpbuf as *mut SetJmpBuffer as *mut _, 0xffff);
|
||||
}
|
||||
|
||||
unsafe fn with_breakpoint_map<R, F: FnOnce(Option<&BkptMap>) -> R>(f: F) -> R {
|
||||
unsafe fn with_breakpoint_map<R, F: FnOnce(Option<&BreakpointMap>) -> R>(f: F) -> R {
|
||||
let unwind = UNWIND.with(|x| x.get());
|
||||
let inner = (*unwind)
|
||||
.as_mut()
|
||||
@ -183,7 +183,7 @@ extern "C" fn signal_trap_handler(
|
||||
// breakpoint
|
||||
let out: Option<Result<(), Box<dyn Any>>> = with_breakpoint_map(|bkpt_map| {
|
||||
bkpt_map.and_then(|x| x.get(&(fault.ip as usize))).map(|x| {
|
||||
x(BkptInfo {
|
||||
x(BreakpointInfo {
|
||||
fault: Some(&fault),
|
||||
})
|
||||
})
|
||||
|
@ -360,7 +360,7 @@ impl InstanceImage {
|
||||
pub mod x64 {
|
||||
use super::*;
|
||||
use crate::fault::{catch_unsafe_unwind, run_on_alternative_stack};
|
||||
use crate::codegen::BkptMap;
|
||||
use crate::codegen::BreakpointMap;
|
||||
use crate::structures::TypedIndex;
|
||||
use crate::types::LocalGlobalIndex;
|
||||
use crate::vm::Ctx;
|
||||
@ -382,7 +382,7 @@ pub mod x64 {
|
||||
code_base: usize,
|
||||
image: InstanceImage,
|
||||
vmctx: &mut Ctx,
|
||||
breakpoints: Option<BkptMap>,
|
||||
breakpoints: Option<BreakpointMap>,
|
||||
) -> Result<u64, Box<dyn Any>> {
|
||||
let mut stack: Vec<u64> = vec![0; 1048576 * 8 / 8]; // 8MB stack
|
||||
let mut stack_offset: usize = stack.len();
|
||||
|
@ -148,7 +148,7 @@ pub struct X64FunctionCode {
|
||||
breakpoints: Option<
|
||||
HashMap<
|
||||
AssemblyOffset,
|
||||
Box<Fn(BkptInfo) -> Result<(), Box<dyn Any>> + Send + Sync + 'static>,
|
||||
Box<Fn(BreakpointInfo) -> Result<(), Box<dyn Any>> + Send + Sync + 'static>,
|
||||
>,
|
||||
>,
|
||||
returns: SmallVec<[WpType; 1]>,
|
||||
@ -178,7 +178,7 @@ pub struct X64ExecutionContext {
|
||||
function_pointers: Vec<FuncPtr>,
|
||||
function_offsets: Vec<AssemblyOffset>,
|
||||
signatures: Arc<Map<SigIndex, FuncSig>>,
|
||||
breakpoints: BkptMap,
|
||||
breakpoints: BreakpointMap,
|
||||
func_import_count: usize,
|
||||
msm: ModuleStateMap,
|
||||
}
|
||||
@ -216,7 +216,7 @@ impl RunnableModule for X64ExecutionContext {
|
||||
Some(self.msm.clone())
|
||||
}
|
||||
|
||||
fn get_breakpoints(&self) -> Option<BkptMap> {
|
||||
fn get_breakpoints(&self) -> Option<BreakpointMap> {
|
||||
Some(self.breakpoints.clone())
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ use std::cell::Cell;
|
||||
use wasmer_runtime_core::fault::{
|
||||
begin_unsafe_unwind, catch_unsafe_unwind, ensure_sighandler,
|
||||
};
|
||||
use wasmer_runtime_core::codegen::BkptMap;
|
||||
use wasmer_runtime_core::codegen::BreakpointMap;
|
||||
use wasmer_runtime_core::typed_func::WasmTrapInfo;
|
||||
|
||||
thread_local! {
|
||||
@ -32,7 +32,7 @@ pub enum CallProtError {
|
||||
|
||||
pub fn call_protected<T>(
|
||||
f: impl FnOnce() -> T,
|
||||
breakpoints: Option<BkptMap>,
|
||||
breakpoints: Option<BreakpointMap>,
|
||||
) -> Result<T, CallProtError> {
|
||||
ensure_sighandler();
|
||||
unsafe {
|
||||
|
Loading…
Reference in New Issue
Block a user