Added breakpoint reset to cont_syscall as well
This commit is contained in:
parent
620939669d
commit
9822c95c37
|
|
@ -54,7 +54,10 @@ impl StoppedTarget {
|
||||||
Ok(self.to_running())
|
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)?;
|
nix::sys::ptrace::syscall(self.pid, None).map_err(PTraceError)?;
|
||||||
Ok(self.to_running())
|
Ok(self.to_running())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ fn main() -> color_eyre::Result<()> {
|
||||||
let mut target = StoppedTarget::new(child_pid)?;
|
let mut target = StoppedTarget::new(child_pid)?;
|
||||||
println!("✔️ Child ready!");
|
println!("✔️ Child ready!");
|
||||||
|
|
||||||
let breakpoint1 = 0x401019;
|
let breakpoint1 = 0x40101b;
|
||||||
println!("🛑 Adding breakpoint at {breakpoint1:#x}");
|
println!("🛑 Adding breakpoint at {breakpoint1:#x}");
|
||||||
target.add_breakpoint(breakpoint1)?;
|
target.add_breakpoint(breakpoint1)?;
|
||||||
let target = target.cont()?.wait_for_something()?;
|
let target = target.cont()?.wait_for_something()?;
|
||||||
|
|
@ -67,17 +67,14 @@ fn main() -> color_eyre::Result<()> {
|
||||||
println!("🚧 We are on a breakpoint!")
|
println!("🚧 We are on a breakpoint!")
|
||||||
}
|
}
|
||||||
println!("🔎 rip: {:#x}", t.get_registers()?.rip);
|
println!("🔎 rip: {:#x}", t.get_registers()?.rip);
|
||||||
single_step_all(t)?;
|
// single_step_all(t)?;
|
||||||
|
strace(t)?;
|
||||||
}
|
}
|
||||||
Either::Right(ExitedTarget { exit_code, .. }) => {
|
Either::Right(ExitedTarget { exit_code, .. }) => {
|
||||||
println!("👋 Child exited with code {exit_code}");
|
println!("👋 Child exited with code {exit_code}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
||||||
|
|
||||||
// single_step_all(target)
|
|
||||||
// strace(target)
|
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("❌ Fork failed: {e}");
|
println!("❌ Fork failed: {e}");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue