Skip to content

[lldb] Override Should{Select,Show} in StopReasonBreakpoint #135637

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

Conversation

felipepiovezan
Copy link
Contributor

This is necessary so that LLDB does not select (or show the stop reason for) a thread which stopped at an internal breakpoint.

Other than manual testing/inspection, which I've done, this does not seem to lend itself to API testing, as we cannot set internal breakpoints through the SBAPI.

@llvmbot
Copy link
Member

llvmbot commented Apr 14, 2025

@llvm/pr-subscribers-lldb

Author: Felipe de Azevedo Piovezan (felipepiovezan)

Changes

This is necessary so that LLDB does not select (or show the stop reason for) a thread which stopped at an internal breakpoint.

Other than manual testing/inspection, which I've done, this does not seem to lend itself to API testing, as we cannot set internal breakpoints through the SBAPI.


Full diff: https://github.com/llvm/llvm-project/pull/135637.diff

1 Files Affected:

  • (modified) lldb/source/Target/StopInfo.cpp (+8)
diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp
index f1272a723a8cb..6bdc467af6746 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -263,6 +263,14 @@ class StopInfoBreakpoint : public StopInfo {
     return bp_site_sp->GetSuggestedStackFrameIndex();
   }
 
+  bool ShouldShow() const override {
+    return !m_was_all_internal;
+  }
+
+  bool ShouldSelect() const override {
+    return !m_was_all_internal;
+  }
+
 protected:
   bool ShouldStop(Event *event_ptr) override {
     // This just reports the work done by PerformAction or the synchronous

Copy link

github-actions bot commented Apr 14, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

This is necessary so that LLDB does not select (or show the stop reason
for) a thread which stopped at an internal breakpoint.

Other than manual testing/inspection, which I've done, this does not
seem to lend itself to API testing, as we cannot set internal
breakpoints through the SBAPI.
@felipepiovezan felipepiovezan force-pushed the felipe/override_should_show_should_select branch from 2252ae2 to 0383630 Compare April 14, 2025 16:20
@jimingham
Copy link
Collaborator

I'm also not sure how you would test this. Pretty much all the predictable internal breakpoints that we set get converted to different StopInfo's before the public stop.
At some point it would be nice to add a "testing only" library - like the SB API set but only available while testing. Then you could add a "SetInternalBreakpoint" API and test what happened when you hit it.
Short of that, I can't see anything that would be stable.
But this is clearly the right behavior. By the time we get to a public stop, if a thread's stop reason is an internal breakpoint, we don't want to either show that reason, or set that thread as the "currently selected thread".

Copy link
Collaborator

@jimingham jimingham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@felipepiovezan felipepiovezan merged commit 7491ff7 into llvm:main Apr 14, 2025
10 checks passed
@felipepiovezan felipepiovezan deleted the felipe/override_should_show_should_select branch April 14, 2025 23:22
felipepiovezan added a commit to felipepiovezan/llvm-project that referenced this pull request Apr 14, 2025
)

This is necessary so that LLDB does not select (or show the stop reason
for) a thread which stopped at an internal breakpoint.

Other than manual testing/inspection, which I've done, this does not
seem to lend itself to API testing, as we cannot set internal
breakpoints through the SBAPI.

(cherry picked from commit 7491ff7)
felipepiovezan added a commit to felipepiovezan/llvm-project that referenced this pull request Apr 15, 2025
)

This is necessary so that LLDB does not select (or show the stop reason
for) a thread which stopped at an internal breakpoint.

Other than manual testing/inspection, which I've done, this does not
seem to lend itself to API testing, as we cannot set internal
breakpoints through the SBAPI.

(cherry picked from commit 7491ff7)
adrian-prantl added a commit to swiftlang/llvm-project that referenced this pull request Apr 15, 2025
…show_should_select_62

[cherry-pick][lldb] Override Should{Select,Show} in StopReasonBreakpoint (llvm#135637)
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
)

This is necessary so that LLDB does not select (or show the stop reason
for) a thread which stopped at an internal breakpoint.

Other than manual testing/inspection, which I've done, this does not
seem to lend itself to API testing, as we cannot set internal
breakpoints through the SBAPI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants