mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:47:35 +00:00
LibDebug: Add ContinueBreakAtSyscall decision
When the user of the DebugSession uses this decision, the debugged program will be continued until it is either stopped by a singal (e.g as a reuslt of a breakpoint), or enters a syscall.
This commit is contained in:
parent
f4418361c4
commit
af338a34c0
2 changed files with 58 additions and 23 deletions
|
@ -184,14 +184,26 @@ void DebugSession::set_registers(const PtraceRegisters& regs)
|
|||
}
|
||||
}
|
||||
|
||||
void DebugSession::continue_debugee()
|
||||
void DebugSession::continue_debugee(ContinueType type)
|
||||
{
|
||||
if (ptrace(PT_CONTINUE, m_debugee_pid, 0, 0) < 0) {
|
||||
int command = (type == ContinueType::FreeRun) ? PT_CONTINUE : PT_SYSCALL;
|
||||
if (ptrace(command, m_debugee_pid, 0, 0) < 0) {
|
||||
perror("continue");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
int DebugSession::continue_debugee_and_wait(ContinueType type)
|
||||
{
|
||||
continue_debugee(type);
|
||||
int wstatus = 0;
|
||||
if (waitpid(m_debugee_pid, &wstatus, WSTOPPED | WEXITED) != m_debugee_pid) {
|
||||
perror("waitpid");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
return wstatus;
|
||||
}
|
||||
|
||||
void* DebugSession::single_step()
|
||||
{
|
||||
auto regs = get_registers();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue