SBThread.h revision c5157ecb9c6185b92923fab50de53f3fad86095d
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
17namespace lldb {
18
19class SBFrame;
20
21class SBThread
22{
23public:
24    SBThread ();
25
26    SBThread (const lldb::SBThread &thread);
27
28   ~SBThread();
29
30    bool
31    IsValid() const;
32
33    void
34    Clear ();
35
36    lldb::StopReason
37    GetStopReason();
38
39    // Get the number of words associated with the stop reason.
40    size_t
41    GetStopReasonDataCount();
42
43    //--------------------------------------------------------------------------
44    // Get information associated with a stop reason.
45    //
46    // Breakpoint stop reasons will have data that consists of pairs of
47    // breakpoint IDs followed by the breakpoint location IDs (they always come
48    // in pairs).
49    //
50    // Stop Reason              Count Data Type
51    // ======================== ===== ==========================================
52    // eStopReasonNone          0
53    // eStopReasonTrace         0
54    // eStopReasonBreakpoint    N     duple: {breakpoint id, location id}
55    // eStopReasonWatchpoint    N     duple: {watchpoint id, location id}
56    // eStopReasonSignal        1     unix signal number
57    // eStopReasonException     N     exception data
58    // eStopReasonPlanComplete  0
59    //--------------------------------------------------------------------------
60    uint64_t
61    GetStopReasonDataAtIndex(uint32_t idx);
62
63    size_t
64    GetStopDescription (char *dst, size_t dst_len);
65
66    lldb::tid_t
67    GetThreadID () const;
68
69    uint32_t
70    GetIndexID () const;
71
72    const char *
73    GetName () const;
74
75    const char *
76    GetQueueName() const;
77
78    void
79    StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
80
81    void
82    StepInto (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
83
84    void
85    StepOut ();
86
87    void
88    StepInstruction(bool step_over);
89
90    void
91    RunToAddress (lldb::addr_t addr);
92
93    uint32_t
94    GetNumFrames ();
95
96    lldb::SBFrame
97    GetFrameAtIndex (uint32_t idx);
98
99    lldb::SBFrame
100    GetSelectedFrame ();
101
102    lldb::SBFrame
103    SetSelectedFrame (uint32_t frame_idx);
104
105    lldb::SBProcess
106    GetProcess ();
107
108#ifndef SWIG
109
110    const lldb::SBThread &
111    operator = (const lldb::SBThread &rhs);
112
113    bool
114    operator == (const lldb::SBThread &rhs) const;
115
116    bool
117    operator != (const lldb::SBThread &rhs) const;
118
119#endif
120
121    bool
122    GetDescription (lldb::SBStream &description) const;
123
124protected:
125    friend class SBBreakpoint;
126    friend class SBBreakpointLocation;
127    friend class SBFrame;
128    friend class SBProcess;
129    friend class SBDebugger;
130    friend class SBValue;
131
132
133#ifndef SWIG
134
135    lldb_private::Thread *
136    get ();
137
138    const lldb_private::Thread *
139    operator->() const;
140
141    const lldb_private::Thread &
142    operator*() const;
143
144
145    lldb_private::Thread *
146    operator->();
147
148    lldb_private::Thread &
149    operator*();
150
151#endif
152
153    SBThread (const lldb::ThreadSP& lldb_object_sp);
154
155    void
156    SetThread (const lldb::ThreadSP& lldb_object_sp);
157
158private:
159    //------------------------------------------------------------------
160    // Classes that inherit from Thread can see and modify these
161    //------------------------------------------------------------------
162
163    lldb::ThreadSP m_opaque_sp;
164};
165
166} // namespace lldb
167
168#endif  // LLDB_SBThread_h_
169