Skip to content

Commit 2590699

Browse files
Merge pull request #10430 from felipepiovezan/felipe/clear_thread_creation_bps_cherrypick
[cherry-pick][lldb] Clear thread-creation breakpoints in ProcessGDBRemote::Clear (…
2 parents e9d8fb4 + 8afffeb commit 2590699

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3315,6 +3315,9 @@ Status ProcessGDBRemote::DisableWatchpoint(WatchpointSP wp_sp, bool notify) {
33153315
void ProcessGDBRemote::Clear() {
33163316
m_thread_list_real.Clear();
33173317
m_thread_list.Clear();
3318+
if (m_thread_create_bp_sp)
3319+
if (TargetSP target_sp = m_target_wp.lock())
3320+
target_sp->RemoveBreakpointByID(m_thread_create_bp_sp->GetID());
33183321
}
33193322

33203323
Status ProcessGDBRemote::DoSignal(int signo) {

lldb/test/API/macosx/thread_start_bps/TestBreakpointsThreadInit.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,23 @@ def test_internal_bps_resolved(self):
3535
for bp in bps:
3636
num_resolved += bp.GetNumResolvedLocations()
3737
self.assertGreater(num_resolved, 0)
38+
39+
@skipUnlessDarwin
40+
def test_internal_bps_deleted_on_relaunch(self):
41+
self.build()
42+
43+
source_file = lldb.SBFileSpec("main.c")
44+
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
45+
self, "initial hello", source_file
46+
)
47+
48+
self.runCmd("break list --internal")
49+
output = self.res.GetOutput()
50+
self.assertEqual(output.count("thread-creation"), 1)
51+
52+
process.Kill()
53+
self.runCmd("run", RUN_SUCCEEDED)
54+
55+
self.runCmd("break list --internal")
56+
output = self.res.GetOutput()
57+
self.assertEqual(output.count("thread-creation"), 1)

0 commit comments

Comments
 (0)