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 ();
101 StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
104 StepInto (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
107 StepInto (const char *target_name, lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
113 StepOutOfFrame (lldb::SBFrame &frame);
116 StepInstruction(bool step_over);
119 StepOverUntil (lldb::SBFrame &frame,
120 lldb::SBFileSpec &file_spec,
124 JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line);
127 RunToAddress (lldb::addr_t addr);
130 ReturnFromFrame (SBFrame &frame, SBValue &return_value);
132 //--------------------------------------------------------------------------
133 /// LLDB currently supports process centric debugging which means when any
134 /// thread in a process stops, all other threads are stopped. The Suspend()
135 /// call here tells our process to suspend a thread and not let it run when
136 /// the other threads in a process are allowed to run. So when
137 /// SBProcess::Continue() is called, any threads that aren't suspended will
138 /// be allowed to run. If any of the SBThread functions for stepping are
139 /// called (StepOver, StepInto, StepOut, StepInstruction, RunToAddres), the
140 /// thread will not be allowed to run and these funtions will simply return.
142 /// Eventually we plan to add support for thread centric debugging where
143 /// each thread is controlled individually and each thread would broadcast
144 /// its state, but we haven't implemented this yet.
146 /// Likewise the SBThread::Resume() call will again allow the thread to run
147 /// when the process is continued.
149 /// Suspend() and Resume() functions are not currently reference counted, if
150 /// anyone has the need for them to be reference counted, please let us
152 //--------------------------------------------------------------------------
169 GetFrameAtIndex (uint32_t idx);
175 SetSelectedFrame (uint32_t frame_idx);
178 EventIsThreadEvent (const SBEvent &event);
181 GetStackFrameFromEvent (const SBEvent &event);
184 GetThreadFromEvent (const SBEvent &event);
189 const lldb::SBThread &
190 operator = (const lldb::SBThread &rhs);
193 operator == (const lldb::SBThread &rhs) const;
196 operator != (const lldb::SBThread &rhs) const;
199 GetDescription (lldb::SBStream &description) const;
202 GetStatus (lldb::SBStream &status) const;
205 GetExtendedBacktraceThread (const char *type);
208 GetExtendedBacktraceOriginatingIndexID ();
211 friend class SBBreakpoint;
212 friend class SBBreakpointLocation;
213 friend class SBFrame;
214 friend class SBProcess;
215 friend class SBDebugger;
216 friend class SBValue;
217 friend class lldb_private::QueueImpl;
218 friend class SBQueueItem;
221 SetThread (const lldb::ThreadSP& lldb_object_sp);
225 ResumeNewPlan (lldb_private::ExecutionContext &exe_ctx, lldb_private::ThreadPlan *new_plan);
229 lldb::ExecutionContextRefSP m_opaque_sp;
234 #endif // LLDB_SBThread_h_