-4007d4ef26eab44bdabc2b7574d032152264d3ad
+f5c81e0a986e4285d3d0fd781a1bd475753eb12c
pub seed: Option<u64>,
}
+/// Details of premature program termination.
+pub enum TerminationInfo {
+ Exit(i64),
+ Abort,
+}
+
/// Returns a freshly created `InterpCx`, along with an `MPlaceTy` representing
/// the location where the return value of the `start` lang item will be
/// written to.
Err(mut e) => {
// Special treatment for some error kinds
let msg = match e.kind {
- InterpError::Exit(code) => return Some(code.into()),
+ InterpError::MachineStop(ref info) => {
+ let info = info.downcast_ref::<TerminationInfo>()
+ .expect("invalid MachineStop payload");
+ match info {
+ TerminationInfo::Exit(code) => return Some(*code),
+ TerminationInfo::Abort =>
+ format!("The program aborted execution")
+ }
+ }
err_unsup!(NoMirFor(..)) =>
format!("{}. Did you set `MIRI_SYSROOT` to a Miri-enabled sysroot? You can prepare one with `cargo miri setup`.", e),
_ => e.to_string()
PAGE_SIZE, STACK_ADDR, STACK_SIZE, NUM_CPUS,
MemoryExtra, AllocExtra, MiriMemoryKind, Evaluator, MiriEvalContext, MiriEvalContextExt,
};
-pub use crate::eval::{eval_main, create_ecx, MiriConfig};
+pub use crate::eval::{eval_main, create_ecx, MiriConfig, TerminationInfo};
/// Insert rustc arguments at the beginning of the argument list that Miri wants to be
/// set per default, for maximal validation power.
}
"exit" | "ExitProcess" => {
- // it's really u32 for ExitProcess, but we have to put it into the `Exit` error variant anyway
+ // it's really u32 for ExitProcess, but we have to put it into the `Exit` variant anyway
let code = this.read_scalar(args[0])?.to_i32()?;
- return Err(InterpError::Exit(code).into());
+ let ti = Box::new(TerminationInfo::Exit(code.into()));
+ return Err(InterpError::MachineStop(ti).into());
}
_ => {
if let Some(p) = ret {