Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/debuggerstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,17 +683,17 @@ bool DebuggerBreakpoints::AddOffset(const ModuleNameAndOffset& address)

bool DebuggerBreakpoints::RemoveAbsolute(uint64_t remoteAddress)
{
if (!m_state->GetAdapter())
return false;

ModuleNameAndOffset info = m_state->GetModules()->AbsoluteAddressToRelative(remoteAddress);
auto it = FindBreakpoint(info);
if (it == m_breakpoints.end())
return false;

m_breakpoints.erase(it);
SerializeMetadata();
m_state->GetAdapter()->RemoveBreakpoint(remoteAddress);

if (m_state->GetAdapter() && m_state->IsConnected())
m_state->GetAdapter()->RemoveBreakpoint(remoteAddress);

return true;
}

Expand Down
17 changes: 17 additions & 0 deletions test/debugger_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,23 @@ def test_breakpoint(self):
self.assertEqual(dbg.ip, entry)
dbg.quit_and_wait()

def test_remove_breakpoint_after_exit(self):
"""Removing a logical breakpoint after DbgEng teardown must not call the backend."""
if self.adapter_type != 'DBGENG':
self.skipTest('Regression is specific to DbgEng teardown')

fpath = name_to_fpath('helloworld', self.arch)
bv = load(fpath)
dbg = self.create_debugger(bv)
self.assertNotIn(dbg.launch_and_wait(), [DebugStopReason.ProcessExited, DebugStopReason.InternalError])
self.assertEqual(sleep_and_go(dbg), DebugStopReason.ProcessExited)

entry = dbg.data.entry_point
dbg.add_breakpoint(entry)
self.assertTrue(any(bp.address == entry for bp in dbg.breakpoints))
dbg.delete_breakpoint(entry)
self.assertFalse(any(bp.address == entry for bp in dbg.breakpoints))

def test_breakpoint_condition(self):
fpath = name_to_fpath('helloworld', self.arch)
bv = load(fpath)
Expand Down