1061da546Spatrick //===-- SBFrame.h -----------------------------------------------*- C++ -*-===// 2061da546Spatrick // 3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information. 5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6061da546Spatrick // 7061da546Spatrick //===----------------------------------------------------------------------===// 8061da546Spatrick 9*dda28197Spatrick #ifndef LLDB_API_SBFRAME_H 10*dda28197Spatrick #define LLDB_API_SBFRAME_H 11061da546Spatrick 12061da546Spatrick #include "lldb/API/SBDefines.h" 13061da546Spatrick #include "lldb/API/SBValueList.h" 14061da546Spatrick 15061da546Spatrick namespace lldb { 16061da546Spatrick 17061da546Spatrick class LLDB_API SBFrame { 18061da546Spatrick public: 19061da546Spatrick SBFrame(); 20061da546Spatrick 21061da546Spatrick SBFrame(const lldb::SBFrame &rhs); 22061da546Spatrick 23061da546Spatrick const lldb::SBFrame &operator=(const lldb::SBFrame &rhs); 24061da546Spatrick 25061da546Spatrick ~SBFrame(); 26061da546Spatrick 27061da546Spatrick bool IsEqual(const lldb::SBFrame &that) const; 28061da546Spatrick 29061da546Spatrick explicit operator bool() const; 30061da546Spatrick 31061da546Spatrick bool IsValid() const; 32061da546Spatrick 33061da546Spatrick uint32_t GetFrameID() const; 34061da546Spatrick 35061da546Spatrick lldb::addr_t GetCFA() const; 36061da546Spatrick 37061da546Spatrick lldb::addr_t GetPC() const; 38061da546Spatrick 39061da546Spatrick bool SetPC(lldb::addr_t new_pc); 40061da546Spatrick 41061da546Spatrick lldb::addr_t GetSP() const; 42061da546Spatrick 43061da546Spatrick lldb::addr_t GetFP() const; 44061da546Spatrick 45061da546Spatrick lldb::SBAddress GetPCAddress() const; 46061da546Spatrick 47061da546Spatrick lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const; 48061da546Spatrick 49061da546Spatrick lldb::SBModule GetModule() const; 50061da546Spatrick 51061da546Spatrick lldb::SBCompileUnit GetCompileUnit() const; 52061da546Spatrick 53061da546Spatrick lldb::SBFunction GetFunction() const; 54061da546Spatrick 55061da546Spatrick lldb::SBSymbol GetSymbol() const; 56061da546Spatrick 57061da546Spatrick /// Gets the deepest block that contains the frame PC. 58061da546Spatrick /// 59061da546Spatrick /// See also GetFrameBlock(). 60061da546Spatrick lldb::SBBlock GetBlock() const; 61061da546Spatrick 62061da546Spatrick /// Get the appropriate function name for this frame. Inlined functions in 63061da546Spatrick /// LLDB are represented by Blocks that have inlined function information, so 64061da546Spatrick /// just looking at the SBFunction or SBSymbol for a frame isn't enough. 65061da546Spatrick /// This function will return the appropriate function, symbol or inlined 66061da546Spatrick /// function name for the frame. 67061da546Spatrick /// 68061da546Spatrick /// This function returns: 69061da546Spatrick /// - the name of the inlined function (if there is one) 70061da546Spatrick /// - the name of the concrete function (if there is one) 71061da546Spatrick /// - the name of the symbol (if there is one) 72061da546Spatrick /// - NULL 73061da546Spatrick /// 74061da546Spatrick /// See also IsInlined(). 75061da546Spatrick const char *GetFunctionName(); 76061da546Spatrick 77061da546Spatrick // Get an appropriate function name for this frame that is suitable for 78061da546Spatrick // display to a user 79061da546Spatrick const char *GetDisplayFunctionName(); 80061da546Spatrick 81061da546Spatrick const char *GetFunctionName() const; 82061da546Spatrick 83061da546Spatrick // Return the frame function's language. If there isn't a function, then 84061da546Spatrick // guess the language type from the mangled name. 85061da546Spatrick lldb::LanguageType GuessLanguage() const; 86061da546Spatrick 87061da546Spatrick /// Return true if this frame represents an inlined function. 88061da546Spatrick /// 89061da546Spatrick /// See also GetFunctionName(). 90061da546Spatrick bool IsInlined(); 91061da546Spatrick 92061da546Spatrick bool IsInlined() const; 93061da546Spatrick 94061da546Spatrick bool IsArtificial(); 95061da546Spatrick 96061da546Spatrick bool IsArtificial() const; 97061da546Spatrick 98061da546Spatrick /// The version that doesn't supply a 'use_dynamic' value will use the 99061da546Spatrick /// target's default. 100061da546Spatrick lldb::SBValue EvaluateExpression(const char *expr); 101061da546Spatrick 102061da546Spatrick lldb::SBValue EvaluateExpression(const char *expr, 103061da546Spatrick lldb::DynamicValueType use_dynamic); 104061da546Spatrick 105061da546Spatrick lldb::SBValue EvaluateExpression(const char *expr, 106061da546Spatrick lldb::DynamicValueType use_dynamic, 107061da546Spatrick bool unwind_on_error); 108061da546Spatrick 109061da546Spatrick lldb::SBValue EvaluateExpression(const char *expr, 110061da546Spatrick const SBExpressionOptions &options); 111061da546Spatrick 112061da546Spatrick /// Gets the lexical block that defines the stack frame. Another way to think 113061da546Spatrick /// of this is it will return the block that contains all of the variables 114061da546Spatrick /// for a stack frame. Inlined functions are represented as SBBlock objects 115061da546Spatrick /// that have inlined function information: the name of the inlined function, 116061da546Spatrick /// where it was called from. The block that is returned will be the first 117061da546Spatrick /// block at or above the block for the PC (SBFrame::GetBlock()) that defines 118061da546Spatrick /// the scope of the frame. When a function contains no inlined functions, 119061da546Spatrick /// this will be the top most lexical block that defines the function. 120061da546Spatrick /// When a function has inlined functions and the PC is currently 121061da546Spatrick /// in one of those inlined functions, this method will return the inlined 122061da546Spatrick /// block that defines this frame. If the PC isn't currently in an inlined 123061da546Spatrick /// function, the lexical block that defines the function is returned. 124061da546Spatrick lldb::SBBlock GetFrameBlock() const; 125061da546Spatrick 126061da546Spatrick lldb::SBLineEntry GetLineEntry() const; 127061da546Spatrick 128061da546Spatrick lldb::SBThread GetThread() const; 129061da546Spatrick 130061da546Spatrick const char *Disassemble() const; 131061da546Spatrick 132061da546Spatrick void Clear(); 133061da546Spatrick 134061da546Spatrick bool operator==(const lldb::SBFrame &rhs) const; 135061da546Spatrick 136061da546Spatrick bool operator!=(const lldb::SBFrame &rhs) const; 137061da546Spatrick 138061da546Spatrick /// The version that doesn't supply a 'use_dynamic' value will use the 139061da546Spatrick /// target's default. 140061da546Spatrick lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics, 141061da546Spatrick bool in_scope_only); 142061da546Spatrick 143061da546Spatrick lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics, 144061da546Spatrick bool in_scope_only, 145061da546Spatrick lldb::DynamicValueType use_dynamic); 146061da546Spatrick 147061da546Spatrick lldb::SBValueList GetVariables(const lldb::SBVariablesOptions &options); 148061da546Spatrick 149061da546Spatrick lldb::SBValueList GetRegisters(); 150061da546Spatrick 151061da546Spatrick lldb::SBValue FindRegister(const char *name); 152061da546Spatrick 153061da546Spatrick /// The version that doesn't supply a 'use_dynamic' value will use the 154061da546Spatrick /// target's default. 155061da546Spatrick lldb::SBValue FindVariable(const char *var_name); 156061da546Spatrick 157061da546Spatrick lldb::SBValue FindVariable(const char *var_name, 158061da546Spatrick lldb::DynamicValueType use_dynamic); 159061da546Spatrick 160061da546Spatrick // Find a value for a variable expression path like "rect.origin.x" or 161061da546Spatrick // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ and 162061da546Spatrick // expression result and is not a constant object like 163061da546Spatrick // SBFrame::EvaluateExpression(...) returns, but a child object of the 164061da546Spatrick // variable value. 165061da546Spatrick lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr, 166061da546Spatrick DynamicValueType use_dynamic); 167061da546Spatrick 168061da546Spatrick /// The version that doesn't supply a 'use_dynamic' value will use the 169061da546Spatrick /// target's default. 170061da546Spatrick lldb::SBValue GetValueForVariablePath(const char *var_path); 171061da546Spatrick 172061da546Spatrick /// Find variables, register sets, registers, or persistent variables using 173061da546Spatrick /// the frame as the scope. 174061da546Spatrick /// 175061da546Spatrick /// NB. This function does not look up ivars in the function object pointer. 176061da546Spatrick /// To do that use GetValueForVariablePath. 177061da546Spatrick /// 178061da546Spatrick /// The version that doesn't supply a 'use_dynamic' value will use the 179061da546Spatrick /// target's default. 180061da546Spatrick lldb::SBValue FindValue(const char *name, ValueType value_type); 181061da546Spatrick 182061da546Spatrick lldb::SBValue FindValue(const char *name, ValueType value_type, 183061da546Spatrick lldb::DynamicValueType use_dynamic); 184061da546Spatrick 185061da546Spatrick bool GetDescription(lldb::SBStream &description); 186061da546Spatrick 187061da546Spatrick SBFrame(const lldb::StackFrameSP &lldb_object_sp); 188061da546Spatrick 189061da546Spatrick protected: 190061da546Spatrick friend class SBBlock; 191061da546Spatrick friend class SBExecutionContext; 192061da546Spatrick friend class SBInstruction; 193061da546Spatrick friend class SBThread; 194061da546Spatrick friend class SBValue; 195061da546Spatrick 196061da546Spatrick lldb::StackFrameSP GetFrameSP() const; 197061da546Spatrick 198061da546Spatrick void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp); 199061da546Spatrick 200061da546Spatrick lldb::ExecutionContextRefSP m_opaque_sp; 201061da546Spatrick }; 202061da546Spatrick 203061da546Spatrick } // namespace lldb 204061da546Spatrick 205*dda28197Spatrick #endif // LLDB_API_SBFRAME_H 206