mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibDebug: Disable and cleanup DebugSession breakpoints on destruction
Breakpoints need to be disabled before we detach from the debugee. I noticed this while looking into the fact that if you continue executing a program in sdb (/bin/ls) where you had previously set a breakpoint, it would crash on sdb exit once the debugee died with an assert on HashMap destruction where we were iterating while clearing is set. This change also happens to fix this assert.
This commit is contained in:
parent
81187c4ead
commit
1f7c61b15f
Notes:
sideshowbarker
2024-07-19 04:22:34 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/1f7c61b15fc Pull-request: https://github.com/SerenityOS/serenity/pull/2950 Reviewed-by: https://github.com/awesomekling
1 changed files with 5 additions and 0 deletions
|
@ -38,6 +38,11 @@ DebugSession::DebugSession(int pid)
|
|||
|
||||
DebugSession::~DebugSession()
|
||||
{
|
||||
for (const auto& bp : m_breakpoints) {
|
||||
disable_breakpoint(bp.key);
|
||||
}
|
||||
m_breakpoints.clear();
|
||||
|
||||
if (!m_is_debugee_dead) {
|
||||
if (ptrace(PT_DETACH, m_debugee_pid, 0, 0) < 0) {
|
||||
perror("PT_DETACH");
|
||||
|
|
Loading…
Reference in a new issue