1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

HackStudio+LibDebug: Support stopping a debugged process

In LibDebug this required implementing the Kill debug action, and
in HackStudio this required making the toolbar's stop action stop
the debugger if active.
This commit is contained in:
FalseHonesty 2021-04-13 17:01:30 -04:00 committed by Linus Groh
parent 5a31ca06db
commit 58d6781cbb
4 changed files with 24 additions and 9 deletions

View file

@ -110,6 +110,11 @@ int Debugger::start_static()
return 0;
}
void Debugger::stop()
{
set_requested_debugger_action(DebuggerAction::Exit);
}
void Debugger::start()
{
m_debug_session = Debug::DebugSession::exec_and_attach(m_executable_path, m_source_root);
@ -190,11 +195,9 @@ int Debugger::debugger_loop()
do_step_over(regs);
return Debug::DebugSession::DebugDecision::Continue;
case DebuggerAction::Exit:
// NOTE: Is detaching from the debuggee the best thing to do here?
// We could display a dialog in the UI, remind the user that there is
// a live debugged process, and ask whether they want to terminate/detach.
dbgln("Debugger exiting");
return Debug::DebugSession::DebugDecision::Detach;
m_on_exit_callback();
return Debug::DebugSession::DebugDecision::Kill;
}
VERIFY_NOT_REACHED();
});