blob: 413d16c1f3f50b7fa4d1a611f0ac410e6d9de297 [file] [log] [blame]
Johnny Chenc3fba812011-07-18 20:13:38 +00001//===-- SWIG Interface for SBThread -----------------------------*- 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
10namespace lldb {
11
12%feature("docstring",
13"Represents a thread of execution. SBProcess contains SBThread(s).
14
15SBThread supports frame iteration. For example (from test/python_api/
16lldbutil/iter/TestLLDBIterator.py),
17
18 from lldbutil import print_stacktrace
19 stopped_due_to_breakpoint = False
20 for thread in process:
21 if self.TraceOn():
22 print_stacktrace(thread)
23 ID = thread.GetThreadID()
24 if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
25 stopped_due_to_breakpoint = True
26 for frame in thread:
27 self.assertTrue(frame.GetThread().GetThreadID() == ID)
28 if self.TraceOn():
29 print frame
30
31 self.assertTrue(stopped_due_to_breakpoint)
32
33See also SBProcess and SBFrame."
34) SBThread;
35class SBThread
36{
37public:
38 SBThread ();
39
40 SBThread (const lldb::SBThread &thread);
41
42 ~SBThread();
43
44 bool
45 IsValid() const;
46
47 void
48 Clear ();
49
50 lldb::StopReason
51 GetStopReason();
52
53 %feature("docstring", "
54 /// Get the number of words associated with the stop reason.
55 /// See also GetStopReasonDataAtIndex().
56 ") GetStopReasonDataCount;
57 size_t
58 GetStopReasonDataCount();
59
60 %feature("docstring", "
61 //--------------------------------------------------------------------------
62 /// Get information associated with a stop reason.
63 ///
64 /// Breakpoint stop reasons will have data that consists of pairs of
65 /// breakpoint IDs followed by the breakpoint location IDs (they always come
66 /// in pairs).
67 ///
68 /// Stop Reason Count Data Type
69 /// ======================== ===== =========================================
70 /// eStopReasonNone 0
71 /// eStopReasonTrace 0
72 /// eStopReasonBreakpoint N duple: {breakpoint id, location id}
73 /// eStopReasonWatchpoint N duple: {watchpoint id, location id}
74 /// eStopReasonSignal 1 unix signal number
75 /// eStopReasonException N exception data
76 /// eStopReasonPlanComplete 0
77 //--------------------------------------------------------------------------
78 ") GetStopReasonDataAtIndex;
79 uint64_t
80 GetStopReasonDataAtIndex(uint32_t idx);
81
82 size_t
83 GetStopDescription (char *dst, size_t dst_len);
84
Jim Ingham1586d972011-12-17 01:35:57 +000085 SBValue
86 GetStopReturnValue ();
87
Johnny Chenc3fba812011-07-18 20:13:38 +000088 lldb::tid_t
89 GetThreadID () const;
90
91 uint32_t
92 GetIndexID () const;
93
94 const char *
95 GetName () const;
96
97 const char *
98 GetQueueName() const;
99
100 void
101 StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
102
103 void
104 StepInto (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
105
106 void
107 StepOut ();
108
109 void
110 StepOutOfFrame (lldb::SBFrame &frame);
111
112 void
113 StepInstruction(bool step_over);
114
115 SBError
116 StepOverUntil (lldb::SBFrame &frame,
117 lldb::SBFileSpec &file_spec,
118 uint32_t line);
119
120 void
121 RunToAddress (lldb::addr_t addr);
122
123 %feature("docstring", "
124 //--------------------------------------------------------------------------
125 /// LLDB currently supports process centric debugging which means when any
126 /// thread in a process stops, all other threads are stopped. The Suspend()
127 /// call here tells our process to suspend a thread and not let it run when
128 /// the other threads in a process are allowed to run. So when
129 /// SBProcess::Continue() is called, any threads that aren't suspended will
130 /// be allowed to run. If any of the SBThread functions for stepping are
131 /// called (StepOver, StepInto, StepOut, StepInstruction, RunToAddres), the
132 /// thread will now be allowed to run and these funtions will simply return.
133 ///
134 /// Eventually we plan to add support for thread centric debugging where
135 /// each thread is controlled individually and each thread would broadcast
136 /// its state, but we haven't implemented this yet.
137 ///
138 /// Likewise the SBThread::Resume() call will again allow the thread to run
139 /// when the process is continued.
140 ///
141 /// Suspend() and Resume() functions are not currently reference counted, if
142 /// anyone has the need for them to be reference counted, please let us
143 /// know.
144 //--------------------------------------------------------------------------
145 ") Suspend;
146 bool
147 Suspend();
148
149 bool
150 Resume ();
151
152 bool
153 IsSuspended();
154
155 uint32_t
156 GetNumFrames ();
157
158 lldb::SBFrame
159 GetFrameAtIndex (uint32_t idx);
160
161 lldb::SBFrame
162 GetSelectedFrame ();
163
164 lldb::SBFrame
165 SetSelectedFrame (uint32_t frame_idx);
166
167 lldb::SBProcess
168 GetProcess ();
169
170 bool
171 GetDescription (lldb::SBStream &description) const;
172};
173
174} // namespace lldb