mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 14:25:32 +00:00
Prevent continueing execution on unreliable stack. (LLVM register save area information is missing)
This commit is contained in:
parent
2e89f02191
commit
d61a8bb6d2
@ -28,6 +28,7 @@ pub enum ShellExitOperation {
|
|||||||
|
|
||||||
pub struct InteractiveShellContext {
|
pub struct InteractiveShellContext {
|
||||||
pub image: Option<InstanceImage>,
|
pub image: Option<InstanceImage>,
|
||||||
|
pub patched: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OptimizationState {
|
struct OptimizationState {
|
||||||
@ -178,8 +179,6 @@ pub fn run_tiering<F: Fn(InteractiveShellContext) -> ShellExitOperation>(
|
|||||||
.as_ptr() as usize,
|
.as_ptr() as usize,
|
||||||
});
|
});
|
||||||
n_versions.set(n_versions.get() + 1);
|
n_versions.set(n_versions.get() + 1);
|
||||||
|
|
||||||
eprintln!("Patched");
|
|
||||||
}
|
}
|
||||||
// TODO: Fix this for optimized version.
|
// TODO: Fix this for optimized version.
|
||||||
let breakpoints = baseline.module.runnable_module.get_breakpoints();
|
let breakpoints = baseline.module.runnable_module.get_breakpoints();
|
||||||
@ -215,6 +214,7 @@ pub fn run_tiering<F: Fn(InteractiveShellContext) -> ShellExitOperation>(
|
|||||||
}
|
}
|
||||||
let op = interactive_shell(InteractiveShellContext {
|
let op = interactive_shell(InteractiveShellContext {
|
||||||
image: Some(new_image.clone()),
|
image: Some(new_image.clone()),
|
||||||
|
patched: n_versions.get() > 1,
|
||||||
});
|
});
|
||||||
match op {
|
match op {
|
||||||
ShellExitOperation::ContinueWith(new_image) => {
|
ShellExitOperation::ContinueWith(new_image) => {
|
||||||
|
@ -635,37 +635,21 @@ fn interactive_shell(mut ctx: InteractiveShellContext) -> ShellExitOperation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
"continue" | "c" => {
|
"continue" | "c" => {
|
||||||
if let Some(image) = ctx.image.take() {
|
if ctx.patched {
|
||||||
return ShellExitOperation::ContinueWith(image);
|
println!("Error: Continueing execution is not yet supported on patched code.");
|
||||||
} else {
|
} else {
|
||||||
println!("Program state not available, cannot continue execution");
|
if let Some(image) = ctx.image.take() {
|
||||||
}
|
return ShellExitOperation::ContinueWith(image);
|
||||||
}
|
} else {
|
||||||
// Disabled due to unsafety.
|
println!("Program state not available, cannot continue execution");
|
||||||
/*
|
|
||||||
"switch_backend" => {
|
|
||||||
let backend_name = parts.next();
|
|
||||||
if backend_name.is_none() {
|
|
||||||
println!("Usage: switch_backend [backend_name]");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let backend_name = backend_name.unwrap();
|
|
||||||
let backend = match backend_name {
|
|
||||||
"singlepass" => Backend::Singlepass,
|
|
||||||
"llvm" => Backend::LLVM,
|
|
||||||
_ => {
|
|
||||||
println!("unknown backend");
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
if let Some(image) = ctx.image.take() {
|
|
||||||
return ShellExitOperation::ContinueWith(image, Some(backend));
|
|
||||||
} else {
|
|
||||||
println!("Program state not available, cannot continue execution");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
"backtrace" | "bt" => {
|
"backtrace" | "bt" => {
|
||||||
|
if ctx.patched {
|
||||||
|
println!("Warning: Backtrace on patched code might be inaccurate.");
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(ref image) = ctx.image {
|
if let Some(ref image) = ctx.image {
|
||||||
println!("{}", image.execution_state.colored_output());
|
println!("{}", image.execution_state.colored_output());
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user