]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/API/SBFrame.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / API / SBFrame.h
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
16 namespace lldb {
17
18 class LLDB_API SBFrame {
19 public:
20   SBFrame();
21
22   SBFrame(const lldb::SBFrame &rhs);
23
24   const lldb::SBFrame &operator=(const lldb::SBFrame &rhs);
25
26   ~SBFrame();
27
28   bool IsEqual(const lldb::SBFrame &that) const;
29
30   bool IsValid() const;
31
32   uint32_t GetFrameID() const;
33
34   lldb::addr_t GetCFA() const;
35
36   lldb::addr_t GetPC() const;
37
38   bool SetPC(lldb::addr_t new_pc);
39
40   lldb::addr_t GetSP() const;
41
42   lldb::addr_t GetFP() const;
43
44   lldb::SBAddress GetPCAddress() const;
45
46   lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const;
47
48   lldb::SBModule GetModule() const;
49
50   lldb::SBCompileUnit GetCompileUnit() const;
51
52   lldb::SBFunction GetFunction() const;
53
54   lldb::SBSymbol GetSymbol() const;
55
56   /// Gets the deepest block that contains the frame PC.
57   ///
58   /// See also GetFrameBlock().
59   lldb::SBBlock GetBlock() const;
60
61   /// Get the appropriate function name for this frame. Inlined functions in
62   /// LLDB are represented by Blocks that have inlined function information, so
63   /// just looking at the SBFunction or SBSymbol for a frame isn't enough.
64   /// This function will return the appropriate function, symbol or inlined
65   /// function name for the frame.
66   ///
67   /// This function returns:
68   /// - the name of the inlined function (if there is one)
69   /// - the name of the concrete function (if there is one)
70   /// - the name of the symbol (if there is one)
71   /// - NULL
72   ///
73   /// See also IsInlined().
74   const char *GetFunctionName();
75
76   // Get an appropriate function name for this frame that is suitable for
77   // display to a user
78   const char *GetDisplayFunctionName();
79
80   const char *GetFunctionName() const;
81   
82   // Return the frame function's language.  If there isn't a function, then
83   // guess the language type from the mangled name.
84   lldb::LanguageType GuessLanguage() const;
85
86   /// Return true if this frame represents an inlined function.
87   ///
88   /// See also GetFunctionName().
89   bool IsInlined();
90
91   bool IsInlined() const;
92
93   bool IsArtificial();
94
95   bool IsArtificial() const;
96
97   /// The version that doesn't supply a 'use_dynamic' value will use the
98   /// target's default.
99   lldb::SBValue EvaluateExpression(const char *expr);
100
101   lldb::SBValue EvaluateExpression(const char *expr,
102                                    lldb::DynamicValueType use_dynamic);
103
104   lldb::SBValue EvaluateExpression(const char *expr,
105                                    lldb::DynamicValueType use_dynamic,
106                                    bool unwind_on_error);
107
108   lldb::SBValue EvaluateExpression(const char *expr,
109                                    const SBExpressionOptions &options);
110
111   /// Gets the lexical block that defines the stack frame. Another way to think
112   /// of this is it will return the block that contains all of the variables
113   /// for a stack frame. Inlined functions are represented as SBBlock objects
114   /// that have inlined function information: the name of the inlined function,
115   /// where it was called from. The block that is returned will be the first
116   /// block at or above the block for the PC (SBFrame::GetBlock()) that defines
117   /// the scope of the frame. When a function contains no inlined functions,
118   /// this will be the top most lexical block that defines the function.
119   /// When a function has inlined functions and the PC is currently
120   /// in one of those inlined functions, this method will return the inlined
121   /// block that defines this frame. If the PC isn't currently in an inlined
122   /// function, the lexical block that defines the function is returned.
123   lldb::SBBlock GetFrameBlock() const;
124
125   lldb::SBLineEntry GetLineEntry() const;
126
127   lldb::SBThread GetThread() const;
128
129   const char *Disassemble() const;
130
131   void Clear();
132
133   bool operator==(const lldb::SBFrame &rhs) const;
134
135   bool operator!=(const lldb::SBFrame &rhs) const;
136
137   /// The version that doesn't supply a 'use_dynamic' value will use the
138   /// target's default.
139   lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
140                                  bool in_scope_only);
141
142   lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
143                                  bool in_scope_only,
144                                  lldb::DynamicValueType use_dynamic);
145
146   lldb::SBValueList GetVariables(const lldb::SBVariablesOptions &options);
147
148   lldb::SBValueList GetRegisters();
149
150   lldb::SBValue FindRegister(const char *name);
151
152   /// The version that doesn't supply a 'use_dynamic' value will use the
153   /// target's default.
154   lldb::SBValue FindVariable(const char *var_name);
155
156   lldb::SBValue FindVariable(const char *var_name,
157                              lldb::DynamicValueType use_dynamic);
158
159   // Find a value for a variable expression path like "rect.origin.x" or
160   // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ and
161   // expression result and is not a constant object like
162   // SBFrame::EvaluateExpression(...) returns, but a child object of the
163   // variable value.
164   lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr,
165                                         DynamicValueType use_dynamic);
166
167   /// The version that doesn't supply a 'use_dynamic' value will use the
168   /// target's default.
169   lldb::SBValue GetValueForVariablePath(const char *var_path);
170
171   /// Find variables, register sets, registers, or persistent variables using
172   /// the frame as the scope.
173   ///
174   /// NB. This function does not look up ivars in the function object pointer.
175   /// To do that use GetValueForVariablePath.
176   ///
177   /// The version that doesn't supply a 'use_dynamic' value will use the
178   /// target's default.
179   lldb::SBValue FindValue(const char *name, ValueType value_type);
180
181   lldb::SBValue FindValue(const char *name, ValueType value_type,
182                           lldb::DynamicValueType use_dynamic);
183
184   bool GetDescription(lldb::SBStream &description);
185
186   SBFrame(const lldb::StackFrameSP &lldb_object_sp);
187
188 protected:
189   friend class SBBlock;
190   friend class SBExecutionContext;
191   friend class SBInstruction;
192   friend class SBThread;
193   friend class SBValue;
194
195   lldb::StackFrameSP GetFrameSP() const;
196
197   void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);
198
199   lldb::ExecutionContextRefSP m_opaque_sp;
200 };
201
202 } // namespace lldb
203
204 #endif // LLDB_SBFrame_h_