xref: /freebsd/contrib/llvm-project/lldb/include/lldb/API/SBFrame.h (revision 5ffd83dbcc34f10e07f6d3e968ae6365869615f4)
10b57cec5SDimitry Andric //===-- SBFrame.h -----------------------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
9*5ffd83dbSDimitry Andric #ifndef LLDB_API_SBFRAME_H
10*5ffd83dbSDimitry Andric #define LLDB_API_SBFRAME_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "lldb/API/SBDefines.h"
130b57cec5SDimitry Andric #include "lldb/API/SBValueList.h"
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric namespace lldb {
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric class LLDB_API SBFrame {
180b57cec5SDimitry Andric public:
190b57cec5SDimitry Andric   SBFrame();
200b57cec5SDimitry Andric 
210b57cec5SDimitry Andric   SBFrame(const lldb::SBFrame &rhs);
220b57cec5SDimitry Andric 
230b57cec5SDimitry Andric   const lldb::SBFrame &operator=(const lldb::SBFrame &rhs);
240b57cec5SDimitry Andric 
250b57cec5SDimitry Andric   ~SBFrame();
260b57cec5SDimitry Andric 
270b57cec5SDimitry Andric   bool IsEqual(const lldb::SBFrame &that) const;
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric   explicit operator bool() const;
300b57cec5SDimitry Andric 
310b57cec5SDimitry Andric   bool IsValid() const;
320b57cec5SDimitry Andric 
330b57cec5SDimitry Andric   uint32_t GetFrameID() const;
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric   lldb::addr_t GetCFA() const;
360b57cec5SDimitry Andric 
370b57cec5SDimitry Andric   lldb::addr_t GetPC() const;
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric   bool SetPC(lldb::addr_t new_pc);
400b57cec5SDimitry Andric 
410b57cec5SDimitry Andric   lldb::addr_t GetSP() const;
420b57cec5SDimitry Andric 
430b57cec5SDimitry Andric   lldb::addr_t GetFP() const;
440b57cec5SDimitry Andric 
450b57cec5SDimitry Andric   lldb::SBAddress GetPCAddress() const;
460b57cec5SDimitry Andric 
470b57cec5SDimitry Andric   lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const;
480b57cec5SDimitry Andric 
490b57cec5SDimitry Andric   lldb::SBModule GetModule() const;
500b57cec5SDimitry Andric 
510b57cec5SDimitry Andric   lldb::SBCompileUnit GetCompileUnit() const;
520b57cec5SDimitry Andric 
530b57cec5SDimitry Andric   lldb::SBFunction GetFunction() const;
540b57cec5SDimitry Andric 
550b57cec5SDimitry Andric   lldb::SBSymbol GetSymbol() const;
560b57cec5SDimitry Andric 
570b57cec5SDimitry Andric   /// Gets the deepest block that contains the frame PC.
580b57cec5SDimitry Andric   ///
590b57cec5SDimitry Andric   /// See also GetFrameBlock().
600b57cec5SDimitry Andric   lldb::SBBlock GetBlock() const;
610b57cec5SDimitry Andric 
620b57cec5SDimitry Andric   /// Get the appropriate function name for this frame. Inlined functions in
630b57cec5SDimitry Andric   /// LLDB are represented by Blocks that have inlined function information, so
640b57cec5SDimitry Andric   /// just looking at the SBFunction or SBSymbol for a frame isn't enough.
650b57cec5SDimitry Andric   /// This function will return the appropriate function, symbol or inlined
660b57cec5SDimitry Andric   /// function name for the frame.
670b57cec5SDimitry Andric   ///
680b57cec5SDimitry Andric   /// This function returns:
690b57cec5SDimitry Andric   /// - the name of the inlined function (if there is one)
700b57cec5SDimitry Andric   /// - the name of the concrete function (if there is one)
710b57cec5SDimitry Andric   /// - the name of the symbol (if there is one)
720b57cec5SDimitry Andric   /// - NULL
730b57cec5SDimitry Andric   ///
740b57cec5SDimitry Andric   /// See also IsInlined().
750b57cec5SDimitry Andric   const char *GetFunctionName();
760b57cec5SDimitry Andric 
770b57cec5SDimitry Andric   // Get an appropriate function name for this frame that is suitable for
780b57cec5SDimitry Andric   // display to a user
790b57cec5SDimitry Andric   const char *GetDisplayFunctionName();
800b57cec5SDimitry Andric 
810b57cec5SDimitry Andric   const char *GetFunctionName() const;
820b57cec5SDimitry Andric 
830b57cec5SDimitry Andric   // Return the frame function's language.  If there isn't a function, then
840b57cec5SDimitry Andric   // guess the language type from the mangled name.
850b57cec5SDimitry Andric   lldb::LanguageType GuessLanguage() const;
860b57cec5SDimitry Andric 
870b57cec5SDimitry Andric   /// Return true if this frame represents an inlined function.
880b57cec5SDimitry Andric   ///
890b57cec5SDimitry Andric   /// See also GetFunctionName().
900b57cec5SDimitry Andric   bool IsInlined();
910b57cec5SDimitry Andric 
920b57cec5SDimitry Andric   bool IsInlined() const;
930b57cec5SDimitry Andric 
940b57cec5SDimitry Andric   bool IsArtificial();
950b57cec5SDimitry Andric 
960b57cec5SDimitry Andric   bool IsArtificial() const;
970b57cec5SDimitry Andric 
980b57cec5SDimitry Andric   /// The version that doesn't supply a 'use_dynamic' value will use the
990b57cec5SDimitry Andric   /// target's default.
1000b57cec5SDimitry Andric   lldb::SBValue EvaluateExpression(const char *expr);
1010b57cec5SDimitry Andric 
1020b57cec5SDimitry Andric   lldb::SBValue EvaluateExpression(const char *expr,
1030b57cec5SDimitry Andric                                    lldb::DynamicValueType use_dynamic);
1040b57cec5SDimitry Andric 
1050b57cec5SDimitry Andric   lldb::SBValue EvaluateExpression(const char *expr,
1060b57cec5SDimitry Andric                                    lldb::DynamicValueType use_dynamic,
1070b57cec5SDimitry Andric                                    bool unwind_on_error);
1080b57cec5SDimitry Andric 
1090b57cec5SDimitry Andric   lldb::SBValue EvaluateExpression(const char *expr,
1100b57cec5SDimitry Andric                                    const SBExpressionOptions &options);
1110b57cec5SDimitry Andric 
1120b57cec5SDimitry Andric   /// Gets the lexical block that defines the stack frame. Another way to think
1130b57cec5SDimitry Andric   /// of this is it will return the block that contains all of the variables
1140b57cec5SDimitry Andric   /// for a stack frame. Inlined functions are represented as SBBlock objects
1150b57cec5SDimitry Andric   /// that have inlined function information: the name of the inlined function,
1160b57cec5SDimitry Andric   /// where it was called from. The block that is returned will be the first
1170b57cec5SDimitry Andric   /// block at or above the block for the PC (SBFrame::GetBlock()) that defines
1180b57cec5SDimitry Andric   /// the scope of the frame. When a function contains no inlined functions,
1190b57cec5SDimitry Andric   /// this will be the top most lexical block that defines the function.
1200b57cec5SDimitry Andric   /// When a function has inlined functions and the PC is currently
1210b57cec5SDimitry Andric   /// in one of those inlined functions, this method will return the inlined
1220b57cec5SDimitry Andric   /// block that defines this frame. If the PC isn't currently in an inlined
1230b57cec5SDimitry Andric   /// function, the lexical block that defines the function is returned.
1240b57cec5SDimitry Andric   lldb::SBBlock GetFrameBlock() const;
1250b57cec5SDimitry Andric 
1260b57cec5SDimitry Andric   lldb::SBLineEntry GetLineEntry() const;
1270b57cec5SDimitry Andric 
1280b57cec5SDimitry Andric   lldb::SBThread GetThread() const;
1290b57cec5SDimitry Andric 
1300b57cec5SDimitry Andric   const char *Disassemble() const;
1310b57cec5SDimitry Andric 
1320b57cec5SDimitry Andric   void Clear();
1330b57cec5SDimitry Andric 
1340b57cec5SDimitry Andric   bool operator==(const lldb::SBFrame &rhs) const;
1350b57cec5SDimitry Andric 
1360b57cec5SDimitry Andric   bool operator!=(const lldb::SBFrame &rhs) const;
1370b57cec5SDimitry Andric 
1380b57cec5SDimitry Andric   /// The version that doesn't supply a 'use_dynamic' value will use the
1390b57cec5SDimitry Andric   /// target's default.
1400b57cec5SDimitry Andric   lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
1410b57cec5SDimitry Andric                                  bool in_scope_only);
1420b57cec5SDimitry Andric 
1430b57cec5SDimitry Andric   lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
1440b57cec5SDimitry Andric                                  bool in_scope_only,
1450b57cec5SDimitry Andric                                  lldb::DynamicValueType use_dynamic);
1460b57cec5SDimitry Andric 
1470b57cec5SDimitry Andric   lldb::SBValueList GetVariables(const lldb::SBVariablesOptions &options);
1480b57cec5SDimitry Andric 
1490b57cec5SDimitry Andric   lldb::SBValueList GetRegisters();
1500b57cec5SDimitry Andric 
1510b57cec5SDimitry Andric   lldb::SBValue FindRegister(const char *name);
1520b57cec5SDimitry Andric 
1530b57cec5SDimitry Andric   /// The version that doesn't supply a 'use_dynamic' value will use the
1540b57cec5SDimitry Andric   /// target's default.
1550b57cec5SDimitry Andric   lldb::SBValue FindVariable(const char *var_name);
1560b57cec5SDimitry Andric 
1570b57cec5SDimitry Andric   lldb::SBValue FindVariable(const char *var_name,
1580b57cec5SDimitry Andric                              lldb::DynamicValueType use_dynamic);
1590b57cec5SDimitry Andric 
1600b57cec5SDimitry Andric   // Find a value for a variable expression path like "rect.origin.x" or
1610b57cec5SDimitry Andric   // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ and
1620b57cec5SDimitry Andric   // expression result and is not a constant object like
1630b57cec5SDimitry Andric   // SBFrame::EvaluateExpression(...) returns, but a child object of the
1640b57cec5SDimitry Andric   // variable value.
1650b57cec5SDimitry Andric   lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr,
1660b57cec5SDimitry Andric                                         DynamicValueType use_dynamic);
1670b57cec5SDimitry Andric 
1680b57cec5SDimitry Andric   /// The version that doesn't supply a 'use_dynamic' value will use the
1690b57cec5SDimitry Andric   /// target's default.
1700b57cec5SDimitry Andric   lldb::SBValue GetValueForVariablePath(const char *var_path);
1710b57cec5SDimitry Andric 
1720b57cec5SDimitry Andric   /// Find variables, register sets, registers, or persistent variables using
1730b57cec5SDimitry Andric   /// the frame as the scope.
1740b57cec5SDimitry Andric   ///
1750b57cec5SDimitry Andric   /// NB. This function does not look up ivars in the function object pointer.
1760b57cec5SDimitry Andric   /// To do that use GetValueForVariablePath.
1770b57cec5SDimitry Andric   ///
1780b57cec5SDimitry Andric   /// The version that doesn't supply a 'use_dynamic' value will use the
1790b57cec5SDimitry Andric   /// target's default.
1800b57cec5SDimitry Andric   lldb::SBValue FindValue(const char *name, ValueType value_type);
1810b57cec5SDimitry Andric 
1820b57cec5SDimitry Andric   lldb::SBValue FindValue(const char *name, ValueType value_type,
1830b57cec5SDimitry Andric                           lldb::DynamicValueType use_dynamic);
1840b57cec5SDimitry Andric 
1850b57cec5SDimitry Andric   bool GetDescription(lldb::SBStream &description);
1860b57cec5SDimitry Andric 
1870b57cec5SDimitry Andric   SBFrame(const lldb::StackFrameSP &lldb_object_sp);
1880b57cec5SDimitry Andric 
1890b57cec5SDimitry Andric protected:
1900b57cec5SDimitry Andric   friend class SBBlock;
1910b57cec5SDimitry Andric   friend class SBExecutionContext;
1920b57cec5SDimitry Andric   friend class SBInstruction;
1930b57cec5SDimitry Andric   friend class SBThread;
1940b57cec5SDimitry Andric   friend class SBValue;
1950b57cec5SDimitry Andric 
1960b57cec5SDimitry Andric   lldb::StackFrameSP GetFrameSP() const;
1970b57cec5SDimitry Andric 
1980b57cec5SDimitry Andric   void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);
1990b57cec5SDimitry Andric 
2000b57cec5SDimitry Andric   lldb::ExecutionContextRefSP m_opaque_sp;
2010b57cec5SDimitry Andric };
2020b57cec5SDimitry Andric 
2030b57cec5SDimitry Andric } // namespace lldb
2040b57cec5SDimitry Andric 
205*5ffd83dbSDimitry Andric #endif // LLDB_API_SBFRAME_H
206