LLVM: SBThread.h Source File
Description: C++ source code API documentation for LLDB.
Keywords: LLDB,C++,doxygen,API,documentation

LLDB API Documentation

- Main Page
- Namespaces
- Classes
- Files

- File List

SBThread.h
Go to the documentation of this file.
1 //===-- SBThread.h ----------------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLDB_SBThread_h_
11 #define LLDB_SBThread_h_
12
13 #include "lldb/API/SBDefines.h"
14
15 #include <stdio.h>
16
17 namespace lldb {
18
19 class SBFrame;
20
21 class LLDB_API SBThread {
22 public:
23 enum {
24 eBroadcastBitStackChanged = (1 << 0),
25 eBroadcastBitThreadSuspended = (1 << 1),
26 eBroadcastBitThreadResumed = (1 << 2),
27 eBroadcastBitSelectedFrameChanged = (1 << 3),
28 eBroadcastBitThreadSelected = (1 << 4)
29 };
30
31 static const char *GetBroadcasterClassName();
32
33 SBThread();
34
35 SBThread(const lldb::SBThread &thread);
36
37 SBThread(const lldb::ThreadSP &lldb_object_sp);
38
39 ~SBThread();
40
41 lldb::SBQueue GetQueue() const;
42
43 bool IsValid() const;
44
45 void Clear();
46
47 lldb::StopReason GetStopReason();
48
49 /// Get the number of words associated with the stop reason.
50 /// See also GetStopReasonDataAtIndex().
51 size_t GetStopReasonDataCount();
52
53 //--------------------------------------------------------------------------
54 /// Get information associated with a stop reason.
55 ///
56 /// Breakpoint stop reasons will have data that consists of pairs of
57 /// breakpoint IDs followed by the breakpoint location IDs (they always come
58 /// in pairs).
59 ///
60 /// Stop Reason Count Data Type
61 /// ======================== ===== =========================================
62 /// eStopReasonNone 0
63 /// eStopReasonTrace 0
64 /// eStopReasonBreakpoint N duple: {breakpoint id, location id}
65 /// eStopReasonWatchpoint 1 watchpoint id
66 /// eStopReasonSignal 1 unix signal number
67 /// eStopReasonException N exception data
68 /// eStopReasonExec 0
69 /// eStopReasonPlanComplete 0
70 //--------------------------------------------------------------------------
71 uint64_t GetStopReasonDataAtIndex(uint32_t idx);
72
73 bool GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream);
74
75 SBThreadCollection
76 GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type);
77
78 size_t GetStopDescription(char *dst, size_t dst_len);
79
80 SBValue GetStopReturnValue();
81
82 lldb::tid_t GetThreadID() const;
83
84 uint32_t GetIndexID() const;
85
86 const char *GetName() const;
87
88 const char *GetQueueName() const;
89
90 lldb::queue_id_t GetQueueID() const;
91
92 bool GetInfoItemByPathAsString(const char *path, SBStream &strm);
93
94 void StepOver(lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
95
96 void StepInto(lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
97
98 void StepInto(const char *target_name,
99 lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
100
101 void StepInto(const char *target_name, uint32_t end_line, SBError &error,
102 lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
103
104 void StepOut();
105
106 void StepOutOfFrame(lldb::SBFrame &frame);
107
108 void StepInstruction(bool step_over);
109
110 SBError StepOverUntil(lldb::SBFrame &frame, lldb::SBFileSpec &file_spec,
111 uint32_t line);
112
113 SBError StepUsingScriptedThreadPlan(const char *script_class_name);
114
115 SBError StepUsingScriptedThreadPlan(const char *script_class_name,
116 bool resume_immediately);
117
118 SBError JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line);
119
120 void RunToAddress(lldb::addr_t addr);
121
122 SBError ReturnFromFrame(SBFrame &frame, SBValue &return_value);
123
124 SBError UnwindInnermostExpression();
125
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, RunToAddress), the
134 /// thread will not be allowed to run and these functions will simply return.
135 ///
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.
139 ///
140 /// Likewise the SBThread::Resume() call will again allow the thread to run
141 /// when the process is continued.
142 ///
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
145 /// know.
146 //--------------------------------------------------------------------------
147 bool Suspend();
148
149 bool Resume();
150
151 bool IsSuspended();
152
153 bool IsStopped();
154
155 uint32_t GetNumFrames();
156
157 lldb::SBFrame GetFrameAtIndex(uint32_t idx);
158
159 lldb::SBFrame GetSelectedFrame();
160
161 lldb::SBFrame SetSelectedFrame(uint32_t frame_idx);
162
163 static bool EventIsThreadEvent(const SBEvent &event);
164
165 static SBFrame GetStackFrameFromEvent(const SBEvent &event);
166
167 static SBThread GetThreadFromEvent(const SBEvent &event);
168
169 lldb::SBProcess GetProcess();
170
171 const lldb::SBThread &operator=(const lldb::SBThread &rhs);
172
173 bool operator==(const lldb::SBThread &rhs) const;
174
175 bool operator!=(const lldb::SBThread &rhs) const;
176
177 bool GetDescription(lldb::SBStream &description) const;
178
179 bool GetStatus(lldb::SBStream &status) const;
180
181 SBThread GetExtendedBacktraceThread(const char *type);
182
183 uint32_t GetExtendedBacktraceOriginatingIndexID();
184
185 bool SafeToCallFunctions();
186
187 #ifndef SWIG
188 lldb_private::Thread *operator->();
189
190 lldb_private::Thread *get();
191
192 #endif
193
194 protected:
195 friend class SBBreakpoint;
196 friend class SBBreakpointLocation;
197 friend class SBExecutionContext;
198 friend class SBFrame;
199 friend class SBProcess;
200 friend class SBDebugger;
201 friend class SBValue;
202 friend class lldb_private::QueueImpl;
203 friend class SBQueueItem;
204
205 void SetThread(const lldb::ThreadSP &lldb_object_sp);
206
207 #ifndef SWIG
208 SBError ResumeNewPlan(lldb_private::ExecutionContext &exe_ctx,
209 lldb_private::ThreadPlan *new_plan);
210 #endif
211
212 private:
213 lldb::ExecutionContextRefSP m_opaque_sp;
214 };
215
216 } // namespace lldb
217
218 #endif // LLDB_SBThread_h_
lldb::SBThread
Definition: SBThread.h:21
lldb::SBFrame
class LLDB_API SBFrame
Definition: SBDefines.h:53
lldb::SBBreakpoint
Definition: SBBreakpoint.h:17
lldb::SBFrame
Definition: SBFrame.h:18
SBDefines.h
lldb::SBQueue
Definition: SBQueue.h:20
lldb::SBValue
Definition: SBValue.h:22
lldb::SBFileSpec
Definition: SBFileSpec.h:17
lldb::SBDebugger
Definition: SBDebugger.h:35
lldb::SBProcess
Definition: SBProcess.h:23
lldb::SBQueueItem
Definition: SBQueueItem.h:18
lldb::SBExecutionContext
Definition: SBExecutionContext.h:21
lldb::SBEvent
Definition: SBEvent.h:22
lldb::SBThreadCollection
Definition: SBThreadCollection.h:17
lldb::SBError
Definition: SBError.h:17
lldb::SBStream
Definition: SBStream.h:19
lldb::SBBreakpointLocation
Definition: SBBreakpointLocation.h:18
lldb::SBThread
class LLDB_API SBThread
Definition: SBDefines.h:79