]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/API/SBFrame.h
Merge clang 7.0.1 and several follow-up changes
[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   /// The version that doesn't supply a 'use_dynamic' value will use the
94   /// target's default.
95   lldb::SBValue EvaluateExpression(const char *expr);
96
97   lldb::SBValue EvaluateExpression(const char *expr,
98                                    lldb::DynamicValueType use_dynamic);
99
100   lldb::SBValue EvaluateExpression(const char *expr,
101                                    lldb::DynamicValueType use_dynamic,
102                                    bool unwind_on_error);
103
104   lldb::SBValue EvaluateExpression(const char *expr,
105                                    const SBExpressionOptions &options);
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 GetFrameBlock() const;
120
121   lldb::SBLineEntry GetLineEntry() const;
122
123   lldb::SBThread GetThread() const;
124
125   const char *Disassemble() const;
126
127   void Clear();
128
129   bool operator==(const lldb::SBFrame &rhs) const;
130
131   bool operator!=(const lldb::SBFrame &rhs) const;
132
133   /// The version that doesn't supply a 'use_dynamic' value will use the
134   /// target's default.
135   lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
136                                  bool in_scope_only);
137
138   lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
139                                  bool in_scope_only,
140                                  lldb::DynamicValueType use_dynamic);
141
142   lldb::SBValueList GetVariables(const lldb::SBVariablesOptions &options);
143
144   lldb::SBValueList GetRegisters();
145
146   lldb::SBValue FindRegister(const char *name);
147
148   /// The version that doesn't supply a 'use_dynamic' value will use the
149   /// target's default.
150   lldb::SBValue FindVariable(const char *var_name);
151
152   lldb::SBValue FindVariable(const char *var_name,
153                              lldb::DynamicValueType use_dynamic);
154
155   // Find a value for a variable expression path like "rect.origin.x" or
156   // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ and
157   // expression result and is not a constant object like
158   // SBFrame::EvaluateExpression(...) returns, but a child object of the
159   // variable value.
160   lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr,
161                                         DynamicValueType use_dynamic);
162
163   /// The version that doesn't supply a 'use_dynamic' value will use the
164   /// target's default.
165   lldb::SBValue GetValueForVariablePath(const char *var_path);
166
167   /// Find variables, register sets, registers, or persistent variables using
168   /// the frame as the scope.
169   ///
170   /// NB. This function does not look up ivars in the function object pointer.
171   /// To do that use GetValueForVariablePath.
172   ///
173   /// The version that doesn't supply a 'use_dynamic' value will use the
174   /// target's default.
175   lldb::SBValue FindValue(const char *name, ValueType value_type);
176
177   lldb::SBValue FindValue(const char *name, ValueType value_type,
178                           lldb::DynamicValueType use_dynamic);
179
180   bool GetDescription(lldb::SBStream &description);
181
182   SBFrame(const lldb::StackFrameSP &lldb_object_sp);
183
184 protected:
185   friend class SBBlock;
186   friend class SBExecutionContext;
187   friend class SBInstruction;
188   friend class SBThread;
189   friend class SBValue;
190
191   lldb::StackFrameSP GetFrameSP() const;
192
193   void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);
194
195   lldb::ExecutionContextRefSP m_opaque_sp;
196 };
197
198 } // namespace lldb
199
200 #endif // LLDB_SBFrame_h_