Skip to content
24 changes: 24 additions & 0 deletions lldb/include/lldb/Target/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,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 @@ -378,6 +379,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 @@ -1312,6 +1333,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