1 //===-- SBThread.h ----------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_SBThread_h_
11 #define LLDB_SBThread_h_
13 #include "lldb/API/SBDefines.h"
26 eBroadcastBitStackChanged = (1 << 0),
27 eBroadcastBitThreadSuspended = (1 << 1),
28 eBroadcastBitThreadResumed = (1 << 2),
29 eBroadcastBitSelectedFrameChanged = (1 << 3),
30 eBroadcastBitThreadSelected = (1 << 4)
34 GetBroadcasterClassName ();
38 SBThread (const lldb::SBThread &thread);
40 SBThread (const lldb::ThreadSP& lldb_object_sp);
53 /// Get the number of words associated with the stop reason.
54 /// See also GetStopReasonDataAtIndex().
56 GetStopReasonDataCount();
58 //--------------------------------------------------------------------------
59 /// Get information associated with a stop reason.
61 /// Breakpoint stop reasons will have data that consists of pairs of
62 /// breakpoint IDs followed by the breakpoint location IDs (they always come
65 /// Stop Reason Count Data Type
66 /// ======================== ===== =========================================
68 /// eStopReasonTrace 0
69 /// eStopReasonBreakpoint N duple: {breakpoint id, location id}
70 /// eStopReasonWatchpoint 1 watchpoint id
71 /// eStopReasonSignal 1 unix signal number
72 /// eStopReasonException N exception data
74 /// eStopReasonPlanComplete 0
75 //--------------------------------------------------------------------------
77 GetStopReasonDataAtIndex(uint32_t idx);
80 GetStopDescription (char *dst, size_t dst_len);
83 GetStopReturnValue ();
98 StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
101 StepInto (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
104 StepInto (const char *target_name, lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
110 StepOutOfFrame (lldb::SBFrame &frame);
113 StepInstruction(bool step_over);
116 StepOverUntil (lldb::SBFrame &frame,
117 lldb::SBFileSpec &file_spec,
121 RunToAddress (lldb::addr_t addr);
124 ReturnFromFrame (SBFrame &frame, SBValue &return_value);
126 //--------------------------------------------------------------------------
127 /// LLDB currently supports process centric debugging which means when any
128 /// thread in a process stops, all other threads are stopped. The Suspend()
129 /// call here tells our process to suspend a thread and not let it run when
130 /// the other threads in a process are allowed to run. So when
131 /// SBProcess::Continue() is called, any threads that aren't suspended will
132 /// be allowed to run. If any of the SBThread functions for stepping are
133 /// called (StepOver, StepInto, StepOut, StepInstruction, RunToAddres), the
134 /// thread will not be allowed to run and these funtions will simply return.
136 /// Eventually we plan to add support for thread centric debugging where
137 /// each thread is controlled individually and each thread would broadcast
138 /// its state, but we haven't implemented this yet.
140 /// Likewise the SBThread::Resume() call will again allow the thread to run
141 /// when the process is continued.
143 /// Suspend() and Resume() functions are not currently reference counted, if
144 /// anyone has the need for them to be reference counted, please let us
146 //--------------------------------------------------------------------------
163 GetFrameAtIndex (uint32_t idx);
169 SetSelectedFrame (uint32_t frame_idx);
172 EventIsThreadEvent (const SBEvent &event);
175 GetStackFrameFromEvent (const SBEvent &event);
178 GetThreadFromEvent (const SBEvent &event);
183 const lldb::SBThread &
184 operator = (const lldb::SBThread &rhs);
187 operator == (const lldb::SBThread &rhs) const;
190 operator != (const lldb::SBThread &rhs) const;
193 GetDescription (lldb::SBStream &description) const;
196 GetStatus (lldb::SBStream &status) const;
199 friend class SBBreakpoint;
200 friend class SBBreakpointLocation;
201 friend class SBFrame;
202 friend class SBProcess;
203 friend class SBDebugger;
204 friend class SBValue;
207 SetThread (const lldb::ThreadSP& lldb_object_sp);
211 ResumeNewPlan (lldb_private::ExecutionContext &exe_ctx, lldb_private::ThreadPlan *new_plan);
215 lldb::ExecutionContextRefSP m_opaque_sp;
220 #endif // LLDB_SBThread_h_