fixup! Fix acid test-bench issues

This commit is contained in:
jD91mZM2
2020-06-16 09:28:42 +02:00
parent 727217ad42
commit 4effb97c04
2 changed files with 11 additions and 11 deletions

View File

@@ -205,8 +205,8 @@ pub fn clear_breakpoint(pid: ContextId) {
data.breakpoint = None;
}
// TODO: All these small functions should be moved to be on the session instance
pub fn notify(pid: ContextId) {
/// Notify the tracee of the current session. Returns None if session does not exist
pub fn notify_tracee(pid: ContextId) {
let sessions = sessions();
let session = match sessions.get(&pid) {
Some(session) => session,
@@ -218,7 +218,7 @@ pub fn notify(pid: ContextId) {
/// Create a new breakpoint for the specified tracee, optionally with
/// a sysemu flag. Panics if the session is invalid.
pub fn set_breakpoint(pid: ContextId, flags: PtraceFlags, should_continue: bool) {
pub fn set_breakpoint(pid: ContextId, flags: PtraceFlags) {
let sessions = sessions_mut();
let session = sessions.get(&pid).expect("proc (set_breakpoint): invalid session");
let mut data = session.data.lock();

View File

@@ -468,6 +468,13 @@ impl Scheme for ProcScheme {
let should_continue = !op.contains(PTRACE_FLAG_WAIT) || op.intersects(PTRACE_STOP_MASK);
// Set next breakpoint, or clear it if no stop condition was set and we should continue
if op.intersects(PTRACE_STOP_MASK) {
ptrace::set_breakpoint(info.pid, op);
} else if should_continue {
ptrace::clear_breakpoint(info.pid);
}
if op.contains(PTRACE_STOP_SINGLESTEP) {
try_stop_context(info.pid, |context| {
match unsafe { ptrace::regs_for_mut(context) } {
@@ -483,13 +490,6 @@ impl Scheme for ProcScheme {
})?;
}
// Set next breakpoint, and potentially restart tracee
if op.intersects(PTRACE_STOP_MASK) {
ptrace::set_breakpoint(info.pid, op, should_continue);
} else if should_continue {
ptrace::clear_breakpoint(info.pid);
}
if should_continue {
// disable the ptrace_stop flag, which is used in some cases
with_context_mut(info.pid, |context| {
@@ -498,7 +498,7 @@ impl Scheme for ProcScheme {
})?;
// and notify the tracee's WaitCondition, which is used in other cases
ptrace::notify(info.pid);
ptrace::notify_tracee(info.pid);
}
// And await the tracee, if requested to