LibDebug: Add ability to detach from debuggee
This commit is contained in:
parent
6c73fdf8d1
commit
8ce641cefc
Notes:
sideshowbarker
2024-07-19 02:12:55 +09:00
Author: https://github.com/itamar8910 Commit: https://github.com/SerenityOS/serenity/commit/8ce641cefca Pull-request: https://github.com/SerenityOS/serenity/pull/3606 Issue: https://github.com/SerenityOS/serenity/issues/3308 Reviewed-by: https://github.com/awesomekling
2 changed files with 17 additions and 2 deletions
|
@ -266,4 +266,12 @@ void* DebugSession::single_step()
|
|||
return (void*)regs.eip;
|
||||
}
|
||||
|
||||
void DebugSession::detach()
|
||||
{
|
||||
for (auto& breakpoint : m_breakpoints.keys()) {
|
||||
remove_breakpoint(breakpoint);
|
||||
}
|
||||
continue_debugee();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -90,11 +90,14 @@ public:
|
|||
};
|
||||
void continue_debugee(ContinueType type = ContinueType::FreeRun);
|
||||
|
||||
//returns the wstatus result of waitpid()
|
||||
// Returns the wstatus result of waitpid()
|
||||
int continue_debugee_and_wait(ContinueType type = ContinueType::FreeRun);
|
||||
|
||||
// Returns the new eip
|
||||
void* single_step();
|
||||
|
||||
void detach();
|
||||
|
||||
template<typename Callback>
|
||||
void run(Callback callback);
|
||||
|
||||
|
@ -236,7 +239,11 @@ void DebugSession::run(Callback callback)
|
|||
state = State::SingleStep;
|
||||
}
|
||||
|
||||
if (decision == DebugDecision::Kill || decision == DebugDecision::Detach) {
|
||||
if (decision == DebugDecision::Detach) {
|
||||
detach();
|
||||
break;
|
||||
}
|
||||
if (decision == DebugDecision::Kill) {
|
||||
ASSERT_NOT_REACHED(); // TODO: implement
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue