Added breakpoint reset to cont_syscall as well

This commit is contained in:
Elnath 2025-05-18 23:37:09 +02:00
parent 620939669d
commit 9822c95c37
2 changed files with 7 additions and 7 deletions

View File

@ -54,7 +54,10 @@ impl StoppedTarget {
Ok(self.to_running())
}
pub fn cont_syscall(self) -> Result<RunningTarget, PTraceError> {
pub fn cont_syscall(mut self) -> Result<RunningTarget, DebugError> {
if self.on_breakpoint()? {
self.breakpoint_remove_and_rewind()?;
}
nix::sys::ptrace::syscall(self.pid, None).map_err(PTraceError)?;
Ok(self.to_running())
}

View File

@ -57,7 +57,7 @@ fn main() -> color_eyre::Result<()> {
let mut target = StoppedTarget::new(child_pid)?;
println!("✔️ Child ready!");
let breakpoint1 = 0x401019;
let breakpoint1 = 0x40101b;
println!("🛑 Adding breakpoint at {breakpoint1:#x}");
target.add_breakpoint(breakpoint1)?;
let target = target.cont()?.wait_for_something()?;
@ -67,17 +67,14 @@ fn main() -> color_eyre::Result<()> {
println!("🚧 We are on a breakpoint!")
}
println!("🔎 rip: {:#x}", t.get_registers()?.rip);
single_step_all(t)?;
// single_step_all(t)?;
strace(t)?;
}
Either::Right(ExitedTarget { exit_code, .. }) => {
println!("👋 Child exited with code {exit_code}");
}
}
Ok(())
// single_step_all(target)
// strace(target)
}
Err(e) => {
println!("❌ Fork failed: {e}");