Skip to content

Commit a373f8a

Browse files
[lldb] Add missing calls to SetThreadHitBreakpointSite/DetectThreadStoppedAtUnexecutedBP
* One of the overloads of CreateStopReasonWithBreakpointSiteID was missing a call to SetThreadHitBreakpointSite. * ThreadMemory was missing a "DetectThreadStoppedAtUnexecutedBP" in its CalculateStopInfo. * When OS plugins are involved, they will sometimes calculate the stop info for the backing thread, and then "grab" it from them (see for example `ThreadMemory::CalculateStopInfo`. So the stop info is created on the backing thread (e.g. a GDBRemoteThread), and then we call SetStopInfo on the OS plugin thread. As a result, we never call `SetThreadHitBreakpointSite" for MemoryThreads, as this is done at the StopInfo creation. To address this, we add a check in SetStopInfo.
1 parent 1824bb4 commit a373f8a

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

lldb/source/Plugins/Process/Utility/ThreadMemory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ ThreadMemory::CreateRegisterContextForFrame(StackFrame *frame) {
6666
}
6767

6868
bool ThreadMemory::CalculateStopInfo() {
69+
DetectThreadStoppedAtUnexecutedBP();
6970
if (m_backing_thread_sp) {
7071
lldb::StopInfoSP backing_stop_info_sp(
7172
m_backing_thread_sp->GetPrivateStopInfo());

lldb/source/Target/StopInfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,8 @@ StopInfoSP StopInfo::CreateStopReasonWithBreakpointSiteID(Thread &thread,
14511451
StopInfoSP StopInfo::CreateStopReasonWithBreakpointSiteID(Thread &thread,
14521452
break_id_t break_id,
14531453
bool should_stop) {
1454+
thread.SetThreadHitBreakpointSite();
1455+
14541456
return StopInfoSP(new StopInfoBreakpoint(thread, break_id, should_stop));
14551457
}
14561458

lldb/source/Target/Thread.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,10 @@ void Thread::ResetStopInfo() {
462462
}
463463

464464
void Thread::SetStopInfo(const lldb::StopInfoSP &stop_info_sp) {
465+
if (stop_info_sp &&
466+
stop_info_sp->GetStopReason() == lldb::eStopReasonBreakpoint)
467+
SetThreadHitBreakpointSite();
468+
465469
m_stop_info_sp = stop_info_sp;
466470
if (m_stop_info_sp) {
467471
m_stop_info_sp->MakeStopInfoValid();

0 commit comments

Comments
 (0)