SBFrame.h revision a0d0a7cbd773ded4ced8d5065f993b6e0feb8dfe
1//===-- SBFrame.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_SBFrame_h_
11#define LLDB_SBFrame_h_
12
13#include "lldb/API/SBDefines.h"
14#include "lldb/API/SBValueList.h"
15
16namespace lldb {
17
18class SBValue;
19
20#ifdef SWIG
21%feature("docstring",
22         "Represents one of the stack frames associated with a thread."
23         " SBThread contains SBFrame(s)."
24         ) SBFrame;
25#endif
26class SBFrame
27{
28#ifdef SWIG
29    %feature("autodoc", "1");
30#endif
31
32public:
33    SBFrame ();
34
35    SBFrame (const lldb::SBFrame &rhs);
36
37#ifndef SWIG
38    const lldb::SBFrame &
39    operator =(const lldb::SBFrame &rhs);
40#endif
41
42   ~SBFrame();
43
44    bool
45    IsValid() const;
46
47    uint32_t
48    GetFrameID () const;
49
50    lldb::addr_t
51    GetPC () const;
52
53    bool
54    SetPC (lldb::addr_t new_pc);
55
56    lldb::addr_t
57    GetSP () const;
58
59    lldb::addr_t
60    GetFP () const;
61
62    lldb::SBAddress
63    GetPCAddress () const;
64
65    lldb::SBSymbolContext
66    GetSymbolContext (uint32_t resolve_scope) const;
67
68    lldb::SBModule
69    GetModule () const;
70
71    lldb::SBCompileUnit
72    GetCompileUnit () const;
73
74    lldb::SBFunction
75    GetFunction () const;
76
77    lldb::SBSymbol
78    GetSymbol () const;
79
80    // Gets the deepest block that contains the frame PC
81    lldb::SBBlock
82    GetBlock () const;
83
84    // Get the appropriate function name for this frame. Inlined functions in
85    // LLDB are represented by Blocks that have inlined function information, so
86    // just looking at the SBFunction or SBSymbol for a frame isn't enough.
87    // This function will return the appriopriate function, symbol or inlined
88    // function name for the frame.
89    const char *
90    GetFunctionName();
91
92    // Return true if this frame represents and an inlined function.
93    bool
94    IsInlined();
95
96    // The version that doesn't supply a "use_dynamic" value will use the target's default.
97    lldb::SBValue
98    EvaluateExpression (const char *expr);
99
100    lldb::SBValue
101    EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic);
102
103    // Gets the lexical block that defines the stack frame. Another way to think
104    // of this is it will return the block that contains all of the variables
105    // for a stack frame. Inlined functions are represented as SBBlock objects
106    // that have inlined function information: the name of the inlined function,
107    // where it was called from. The block that is returned will be the first
108    // block at or above the block for the PC (SBFrame::GetBlock()) that defines
109    // the scope of the frame. When a function contains no inlined functions,
110    // this will be the top most lexical block that defines the function.
111    // When a function has inlined functions and the PC is currently
112    // in one of those inlined functions, this method will return the inlined
113    // block that defines this frame. If the PC isn't currently in an inlined
114    // function, the lexical block that defines the function is returned.
115    lldb::SBBlock
116    GetFrameBlock () const;
117
118    lldb::SBLineEntry
119    GetLineEntry () const;
120
121    lldb::SBThread
122    GetThread () const;
123
124    const char *
125    Disassemble () const;
126
127    void
128    Clear();
129
130#ifndef SWIG
131    bool
132    operator == (const lldb::SBFrame &rhs) const;
133
134    bool
135    operator != (const lldb::SBFrame &rhs) const;
136
137#endif
138
139    lldb::SBValueList
140    GetVariables (bool arguments,
141                  bool locals,
142                  bool statics,
143                  bool in_scope_only);
144
145    // The version that doesn't supply a "use_dynamic" value will use the target's default.
146    lldb::SBValueList
147    GetVariables (bool arguments,
148                  bool locals,
149                  bool statics,
150                  bool in_scope_only,
151                  lldb::DynamicValueType  use_dynamic);
152
153    lldb::SBValueList
154    GetRegisters ();
155
156    // The version that doesn't supply a "use_dynamic" value will use the target's default.
157    lldb::SBValue
158    FindVariable (const char *var_name);
159
160    lldb::SBValue
161    FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic);
162
163    // Find variables, register sets, registers, or persistent variables using
164    // the frame as the scope
165    lldb::SBValue
166    FindValue (const char *name, ValueType value_type);
167
168    lldb::SBValue
169    FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic);
170
171    bool
172    GetDescription (lldb::SBStream &description);
173
174#ifndef SWIG
175    SBFrame (const lldb::StackFrameSP &lldb_object_sp);
176#endif
177
178protected:
179    friend class SBValue;
180
181private:
182    friend class SBThread;
183    friend class SBInstruction;
184    friend class lldb_private::ScriptInterpreterPython;
185
186#ifndef SWIG
187
188    lldb_private::StackFrame *
189    operator->() const;
190
191    // Mimic shared pointer...
192    lldb_private::StackFrame *
193    get() const;
194
195    const lldb::StackFrameSP &
196    get_sp() const;
197
198#endif
199
200
201    void
202    SetFrame (const lldb::StackFrameSP &lldb_object_sp);
203
204    lldb::StackFrameSP m_opaque_sp;
205};
206
207} // namespace lldb
208
209#endif  // LLDB_SBFrame_h_
210