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