Skip to content

[lldb] Clear thread-creation breakpoints in ProcessGDBRemote::Clear #134397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
3 changes: 3 additions & 0 deletions lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3410,6 +3410,9 @@ Status ProcessGDBRemote::DisableWatchpoint(WatchpointSP wp_sp, bool notify) {
void ProcessGDBRemote::Clear() {
m_thread_list_real.Clear();
m_thread_list.Clear();
if (m_thread_create_bp_sp)
if (TargetSP target_sp = m_target_wp.lock())
target_sp->RemoveBreakpointByID(m_thread_create_bp_sp->GetID());
}

Status ProcessGDBRemote::DoSignal(int signo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,23 @@ def test_internal_bps_resolved(self):
for bp in bps:
num_resolved += bp.GetNumResolvedLocations()
self.assertGreater(num_resolved, 0)

@skipUnlessDarwin
def test_internal_bps_deleted_on_relaunch(self):
self.build()

source_file = lldb.SBFileSpec("main.c")
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
self, "initial hello", source_file
)

self.runCmd("break list --internal")
output = self.res.GetOutput()
self.assertEqual(output.count("thread-creation"), 1)

process.Kill()
self.runCmd("run", RUN_SUCCEEDED)

self.runCmd("break list --internal")
output = self.res.GetOutput()
self.assertEqual(output.count("thread-creation"), 1)