mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 01:29:17 +00:00
LibDebug: Fix DebugSession teardown
Previously, we were trying to remove the breakpoints we set on the debugee even if it has already exited, which caused PT_POKE to fail.
This commit is contained in:
parent
627f258c97
commit
dca6a77669
Notes:
sideshowbarker
2024-07-19 03:36:49 +09:00
Author: https://github.com/itamar8910
Commit: dca6a77669
Pull-request: https://github.com/SerenityOS/serenity/pull/3153
Issue: https://github.com/SerenityOS/serenity/issues/3152
Reviewed-by: https://github.com/awesomekling
1 changed files with 5 additions and 4 deletions
|
@ -45,17 +45,18 @@ NonnullOwnPtr<const MappedFile> DebugSession::initialize_executable_mapped_file(
|
||||||
|
|
||||||
DebugSession::~DebugSession()
|
DebugSession::~DebugSession()
|
||||||
{
|
{
|
||||||
|
if (m_is_debugee_dead)
|
||||||
|
return;
|
||||||
|
|
||||||
for (const auto& bp : m_breakpoints) {
|
for (const auto& bp : m_breakpoints) {
|
||||||
disable_breakpoint(bp.key);
|
disable_breakpoint(bp.key);
|
||||||
}
|
}
|
||||||
m_breakpoints.clear();
|
m_breakpoints.clear();
|
||||||
|
|
||||||
if (!m_is_debugee_dead) {
|
|
||||||
if (ptrace(PT_DETACH, m_debugee_pid, 0, 0) < 0) {
|
if (ptrace(PT_DETACH, m_debugee_pid, 0, 0) < 0) {
|
||||||
perror("PT_DETACH");
|
perror("PT_DETACH");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
OwnPtr<DebugSession> DebugSession::exec_and_attach(const String& command)
|
OwnPtr<DebugSession> DebugSession::exec_and_attach(const String& command)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue