Skip to content

[lldb] Change lldb's breakpoint detection behavior #105594

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
56ca564
[lldb] Change lldb's breakpoint handling behavior (#96260)
jasonmolenda Jul 20, 2024
3408ce1
Recognize `swbreak:`/`hwbreak:` in stop packet
jasonmolenda Aug 28, 2024
48a0fc1
Add pc check for instruction stepping by breakpoints
jasonmolenda Aug 29, 2024
a82695c
Update debuginfo dexter stepping for new lldb behavior
jasonmolenda Sep 6, 2024
4468b35
Revert "Update debuginfo dexter stepping for new lldb behavior"
jasonmolenda Sep 11, 2024
087aef1
Merge branch 'main' into change-lldb-breakpoint-hit-behaviors
jasonmolenda Sep 11, 2024
5b5a5b6
Revert "Add pc check for instruction stepping by breakpoints"
jasonmolenda Sep 13, 2024
4e38a62
Revert "Recognize `swbreak:`/`hwbreak:` in stop packet"
jasonmolenda Sep 13, 2024
a91cb9c
Merge branch 'main' into change-lldb-breakpoint-hit-behaviors
jasonmolenda Sep 13, 2024
9c7916b
Merge branch 'main' into change-lldb-breakpoint-hit-behaviors
jasonmolenda Oct 30, 2024
9d2069a
Merge branch 'main' into change-lldb-breakpoint-hit-behaviors
jasonmolenda Jan 29, 2025
0d51d68
Fix typeo.
jasonmolenda Jan 30, 2025
a0ba821
Add test case that capture's the llvm-mingw hello-exeception.cpp
jasonmolenda Jan 30, 2025
55dc83e
ws fix
jasonmolenda Feb 4, 2025
485cc4c
Change ThreadPlanStepOut::ShouldStop to only stop when we've hit
jasonmolenda Feb 6, 2025
c9be220
Merge branch 'main' into change-lldb-breakpoint-hit-behaviors
jasonmolenda Feb 11, 2025
dca5c0e
Revert "Change ThreadPlanStepOut::ShouldStop to only stop when we've …
jasonmolenda Feb 12, 2025
e110611
Revert "ws fix"
jasonmolenda Feb 12, 2025
1128ca7
Revert "Add test case that capture's the llvm-mingw hello-exeception.…
jasonmolenda Feb 12, 2025
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
24 changes: 24 additions & 0 deletions lldb/include/lldb/Target/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class Thread : public std::enable_shared_from_this<Thread>,
register_backup_sp; // You need to restore the registers, of course...
uint32_t current_inlined_depth;
lldb::addr_t current_inlined_pc;
lldb::addr_t stopped_at_unexecuted_bp;
};

/// Constructor
Expand Down Expand Up @@ -383,6 +384,26 @@ class Thread : public std::enable_shared_from_this<Thread>,

virtual void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) {}

/// When a thread stops at an enabled BreakpointSite that has not executed,
/// the Process plugin should call SetThreadStoppedAtUnexecutedBP(pc).
/// If that BreakpointSite was actually triggered (the instruction was
/// executed, for a software breakpoint), regardless of whether the
/// breakpoint is valid for this thread, SetThreadHitBreakpointSite()
/// should be called to record that fact.
///
/// Depending on the structure of the Process plugin, it may be easiest
/// to call SetThreadStoppedAtUnexecutedBP(pc) unconditionally when at
/// a BreakpointSite, and later when it is known that it was triggered,
/// SetThreadHitBreakpointSite() can be called. These two methods
/// overwrite the same piece of state in the Thread, the last one
/// called on a Thread wins.
void SetThreadStoppedAtUnexecutedBP(lldb::addr_t pc) {
m_stopped_at_unexecuted_bp = pc;
}
void SetThreadHitBreakpointSite() {
m_stopped_at_unexecuted_bp = LLDB_INVALID_ADDRESS;
}

/// Whether this Thread already has all the Queue information cached or not
///
/// A Thread may be associated with a libdispatch work Queue at a given
Expand Down Expand Up @@ -1337,6 +1358,9 @@ class Thread : public std::enable_shared_from_this<Thread>,
bool m_should_run_before_public_stop; // If this thread has "stop others"
// private work to do, then it will
// set this.
lldb::addr_t m_stopped_at_unexecuted_bp; // Set to the address of a breakpoint
// instruction that we have not yet
// hit, but will hit when we resume.
const uint32_t m_index_id; ///< A unique 1 based index assigned to each thread
/// for easy UI/command line access.
lldb::RegisterContextSP m_reg_context_sp; ///< The register context for this
Expand Down
Loading