@@ -108,8 +108,7 @@ class StopInfoBreakpoint : public StopInfo {
108108 void StoreBPInfo () {
109109 ThreadSP thread_sp (m_thread_wp.lock ());
110110 if (thread_sp) {
111- BreakpointSiteSP bp_site_sp (
112- thread_sp->GetProcess ()->GetBreakpointSiteList ().FindByID (m_value));
111+ BreakpointSiteSP bp_site_sp = GetBreakpointSiteSP ();
113112 if (bp_site_sp) {
114113 uint32_t num_constituents = bp_site_sp->GetNumberOfConstituents ();
115114 if (num_constituents == 1 ) {
@@ -139,8 +138,7 @@ class StopInfoBreakpoint : public StopInfo {
139138 bool IsValidForOperatingSystemThread (Thread &thread) override {
140139 ProcessSP process_sp (thread.GetProcess ());
141140 if (process_sp) {
142- BreakpointSiteSP bp_site_sp (
143- process_sp->GetBreakpointSiteList ().FindByID (m_value));
141+ BreakpointSiteSP bp_site_sp = GetBreakpointSiteSP ();
144142 if (bp_site_sp)
145143 return bp_site_sp->ValidForThisThread (thread);
146144 }
@@ -154,8 +152,7 @@ class StopInfoBreakpoint : public StopInfo {
154152 if (thread_sp) {
155153 if (!m_should_stop_is_valid) {
156154 // Only check once if we should stop at a breakpoint
157- BreakpointSiteSP bp_site_sp (
158- thread_sp->GetProcess ()->GetBreakpointSiteList ().FindByID (m_value));
155+ BreakpointSiteSP bp_site_sp = GetBreakpointSiteSP ();
159156 if (bp_site_sp) {
160157 ExecutionContext exe_ctx (thread_sp->GetStackFrameAtIndex (0 ));
161158 StoppointCallbackContext context (event_ptr, exe_ctx, true );
@@ -186,8 +183,7 @@ class StopInfoBreakpoint : public StopInfo {
186183 if (m_description.empty ()) {
187184 ThreadSP thread_sp (m_thread_wp.lock ());
188185 if (thread_sp) {
189- BreakpointSiteSP bp_site_sp (
190- thread_sp->GetProcess ()->GetBreakpointSiteList ().FindByID (m_value));
186+ BreakpointSiteSP bp_site_sp = GetBreakpointSiteSP ();
191187 if (bp_site_sp) {
192188 StreamString strm;
193189 // If we have just hit an internal breakpoint, and it has a kind
@@ -247,6 +243,35 @@ class StopInfoBreakpoint : public StopInfo {
247243 return m_description.c_str ();
248244 }
249245
246+ uint32_t GetStopReasonDataCount () const override {
247+ lldb::BreakpointSiteSP bp_site_sp = GetBreakpointSiteSP ();
248+ if (bp_site_sp)
249+ return bp_site_sp->GetNumberOfConstituents () * 2 ;
250+ return 0 ; // Breakpoint must have cleared itself...
251+ }
252+
253+ uint64_t GetStopReasonDataAtIndex (uint32_t idx) override {
254+ lldb::BreakpointSiteSP bp_site_sp = GetBreakpointSiteSP ();
255+ if (bp_site_sp) {
256+ uint32_t bp_index = idx / 2 ;
257+ BreakpointLocationSP bp_loc_sp (
258+ bp_site_sp->GetConstituentAtIndex (bp_index));
259+ if (bp_loc_sp) {
260+ if (idx & 1 ) {
261+ // FIXME: This might be a Facade breakpoint, so we need to fetch
262+ // the one that the thread actually hit, not the native loc ID.
263+
264+ // Odd idx, return the breakpoint location ID
265+ return bp_loc_sp->GetID ();
266+ } else {
267+ // Even idx, return the breakpoint ID
268+ return bp_loc_sp->GetBreakpoint ().GetID ();
269+ }
270+ }
271+ }
272+ return LLDB_INVALID_BREAK_ID;
273+ }
274+
250275 std::optional<uint32_t >
251276 GetSuggestedStackFrameIndex (bool inlined_stack) override {
252277 if (!inlined_stack)
@@ -255,8 +280,7 @@ class StopInfoBreakpoint : public StopInfo {
255280 ThreadSP thread_sp (m_thread_wp.lock ());
256281 if (!thread_sp)
257282 return {};
258- BreakpointSiteSP bp_site_sp (
259- thread_sp->GetProcess ()->GetBreakpointSiteList ().FindByID (m_value));
283+ BreakpointSiteSP bp_site_sp = GetBreakpointSiteSP ();
260284 if (!bp_site_sp)
261285 return {};
262286
@@ -297,8 +321,7 @@ class StopInfoBreakpoint : public StopInfo {
297321 return ;
298322 }
299323
300- BreakpointSiteSP bp_site_sp (
301- thread_sp->GetProcess ()->GetBreakpointSiteList ().FindByID (m_value));
324+ BreakpointSiteSP bp_site_sp = GetBreakpointSiteSP ();
302325 std::unordered_set<break_id_t > precondition_breakpoints;
303326 // Breakpoints that fail their condition check are not considered to
304327 // have been hit. If the only locations at this site have failed their
@@ -629,6 +652,20 @@ class StopInfoBreakpoint : public StopInfo {
629652 }
630653
631654private:
655+ BreakpointSiteSP GetBreakpointSiteSP () const {
656+ if (m_value == LLDB_INVALID_BREAK_ID)
657+ return {};
658+
659+ ThreadSP thread_sp = GetThread ();
660+ if (!thread_sp)
661+ return {};
662+ ProcessSP process_sp = thread_sp->GetProcess ();
663+ if (!process_sp)
664+ return {};
665+
666+ return process_sp->GetBreakpointSiteList ().FindByID (m_value);
667+ }
668+
632669 bool m_should_stop;
633670 bool m_should_stop_is_valid;
634671 bool m_should_perform_action; // Since we are trying to preserve the "state"
@@ -699,6 +736,13 @@ class StopInfoWatchpoint : public StopInfo {
699736
700737 StopReason GetStopReason () const override { return eStopReasonWatchpoint; }
701738
739+ uint32_t GetStopReasonDataCount () const override { return 1 ; }
740+ uint64_t GetStopReasonDataAtIndex (uint32_t idx) override {
741+ if (idx == 0 )
742+ return GetValue ();
743+ return 0 ;
744+ }
745+
702746 const char *GetDescription () override {
703747 if (m_description.empty ()) {
704748 StreamString strm;
@@ -1139,6 +1183,13 @@ class StopInfoUnixSignal : public StopInfo {
11391183
11401184 bool ShouldSelect () const override { return IsShouldStopSignal (); }
11411185
1186+ uint32_t GetStopReasonDataCount () const override { return 1 ; }
1187+ uint64_t GetStopReasonDataAtIndex (uint32_t idx) override {
1188+ if (idx == 0 )
1189+ return GetValue ();
1190+ return 0 ;
1191+ }
1192+
11421193private:
11431194 // In siginfo_t terms, if m_value is si_signo, m_code is si_code.
11441195 std::optional<int > m_code;
@@ -1171,6 +1222,14 @@ class StopInfoInterrupt : public StopInfo {
11711222 }
11721223 return m_description.c_str ();
11731224 }
1225+
1226+ uint32_t GetStopReasonDataCount () const override { return 1 ; }
1227+ uint64_t GetStopReasonDataAtIndex (uint32_t idx) override {
1228+ if (idx == 0 )
1229+ return GetValue ();
1230+ else
1231+ return 0 ;
1232+ }
11741233};
11751234
11761235// StopInfoTrace
@@ -1249,6 +1308,13 @@ class StopInfoException : public StopInfo {
12491308 else
12501309 return m_description.c_str ();
12511310 }
1311+ uint32_t GetStopReasonDataCount () const override { return 1 ; }
1312+ uint64_t GetStopReasonDataAtIndex (uint32_t idx) override {
1313+ if (idx == 0 )
1314+ return GetValue ();
1315+ else
1316+ return 0 ;
1317+ }
12521318};
12531319
12541320// StopInfoProcessorTrace
@@ -1390,6 +1456,14 @@ class StopInfoFork : public StopInfo {
13901456
13911457 const char *GetDescription () override { return " fork" ; }
13921458
1459+ uint32_t GetStopReasonDataCount () const override { return 1 ; }
1460+ uint64_t GetStopReasonDataAtIndex (uint32_t idx) override {
1461+ if (idx == 0 )
1462+ return GetValue ();
1463+ else
1464+ return 0 ;
1465+ }
1466+
13931467protected:
13941468 void PerformAction (Event *event_ptr) override {
13951469 // Only perform the action once
@@ -1424,6 +1498,13 @@ class StopInfoVFork : public StopInfo {
14241498
14251499 const char *GetDescription () override { return " vfork" ; }
14261500
1501+ uint32_t GetStopReasonDataCount () const override { return 1 ; }
1502+ uint64_t GetStopReasonDataAtIndex (uint32_t idx) override {
1503+ if (idx == 0 )
1504+ return GetValue ();
1505+ return 0 ;
1506+ }
1507+
14271508protected:
14281509 void PerformAction (Event *event_ptr) override {
14291510 // Only perform the action once
0 commit comments