55#include "llvm/Support/PrettyStackTrace.h"
95 return this->
operator bool();
97SBFrame::operator bool()
const {
100 std::unique_lock<std::recursive_mutex> lock;
105 if (target && process) {
108 return GetFrameSP().get() !=
nullptr;
119 std::unique_lock<std::recursive_mutex> lock;
121 SymbolContextItem scope =
static_cast<SymbolContextItem
>(resolve_scope);
124 if (target && process) {
128 sb_sym_ctx = frame->GetSymbolContext(scope);
140 std::unique_lock<std::recursive_mutex> lock;
146 if (target && process) {
152 sb_module.
SetSP(module_sp);
164 std::unique_lock<std::recursive_mutex> lock;
170 if (target && process) {
188 std::unique_lock<std::recursive_mutex> lock;
194 if (target && process) {
212 std::unique_lock<std::recursive_mutex> lock;
218 if (target && process) {
235 std::unique_lock<std::recursive_mutex> lock;
241 if (target && process) {
256 std::unique_lock<std::recursive_mutex> lock;
262 if (target && process) {
277 std::unique_lock<std::recursive_mutex> lock;
283 if (target && process) {
293 return sb_line_entry;
301 std::unique_lock<std::recursive_mutex> lock;
314 std::unique_lock<std::recursive_mutex> lock;
327 std::unique_lock<std::recursive_mutex> lock;
333 if (target && process) {
339 target, AddressClass::eCode);
350 bool ret_val =
false;
351 std::unique_lock<std::recursive_mutex> lock;
356 if (target && process) {
361 ret_val = reg_ctx_sp->SetPC(new_pc);
374 std::unique_lock<std::recursive_mutex> lock;
379 if (target && process) {
384 addr = reg_ctx_sp->GetSP();
397 std::unique_lock<std::recursive_mutex> lock;
402 if (target && process) {
407 addr = reg_ctx_sp->GetFP();
420 std::unique_lock<std::recursive_mutex> lock;
426 if (target && process) {
447 std::unique_lock<std::recursive_mutex> lock;
452 if (frame && target) {
465 if (var_path ==
nullptr || var_path[0] ==
'\0') {
469 std::unique_lock<std::recursive_mutex> lock;
475 if (target && process) {
487 sb_value.
SetSP(value_sp, use_dynamic);
498 std::unique_lock<std::recursive_mutex> lock;
503 if (frame && target) {
518 if (name ==
nullptr || name[0] ==
'\0') {
523 std::unique_lock<std::recursive_mutex> lock;
529 if (target && process) {
537 sb_value.
SetSP(value_sp, use_dynamic);
549 std::unique_lock<std::recursive_mutex> lock;
554 if (frame && target) {
557 value =
FindValue(name, value_type, use_dynamic);
568 if (name ==
nullptr || name[0] ==
'\0') {
573 std::unique_lock<std::recursive_mutex> lock;
579 if (target && process) {
586 switch (value_type) {
595 const bool can_create =
true;
596 const bool get_parent_variables =
true;
597 const bool stop_if_block_is_inlined_function =
true;
601 can_create, get_parent_variables,
602 stop_if_block_is_inlined_function,
607 const bool get_file_globals =
true;
619 sb_value.
SetSP(value_sp, use_dynamic);
628 reg_ctx->GetRegisterInfoByName(name)) {
630 sb_value.
SetSP(value_sp);
640 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
641 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
642 const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
644 (llvm::StringRef(reg_set->
name).equals_insensitive(name) ||
646 .equals_insensitive(name))) {
649 sb_value.
SetSP(value_sp);
662 value_sp = expr_var_sp->GetValueObject();
663 sb_value.
SetSP(value_sp, use_dynamic);
682 return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
700 std::unique_lock<std::recursive_mutex> lock;
712 std::unique_lock<std::recursive_mutex> lock;
716 if (!target || !process)
729 bool in_scope_only) {
733 std::unique_lock<std::recursive_mutex> lock;
738 if (frame && target) {
741 const bool include_runtime_support_values =
758 bool statics,
bool in_scope_only,
763 std::unique_lock<std::recursive_mutex> lock;
767 const bool include_runtime_support_values =
783 std::unique_lock<std::recursive_mutex> lock;
791 const bool recognized_arguments =
795 const bool include_runtime_support_values =
800 std::set<VariableSP> variable_set;
802 if (target && process) {
811 if (var_error.
Fail())
814 const size_t num_variables = variable_list->
GetSize();
816 size_t num_produced = 0;
817 for (
const VariableSP &variable_sp : *variable_list) {
819 "Interrupted getting frame variables with {0} of {1} "
820 "produced.", num_produced, num_variables))
824 bool add_variable =
false;
825 switch (variable_sp->GetScope()) {
829 add_variable = statics;
833 add_variable = arguments;
837 add_variable = locals;
845 if (variable_set.find(variable_sp) == variable_set.end())
846 variable_set.insert(variable_sp);
850 if (in_scope_only && !variable_sp->IsInScope(frame))
856 if (!include_runtime_support_values && valobj_sp !=
nullptr &&
857 valobj_sp->IsRuntimeSupportValue())
861 value_sb.
SetSP(valobj_sp, use_dynamic);
862 value_list.
Append(value_sb);
869 if (recognized_arguments) {
871 if (recognized_frame) {
873 recognized_frame->GetRecognizedArguments();
874 if (recognized_arg_list) {
875 for (
auto &rec_value_sp : recognized_arg_list->GetObjects()) {
877 value_sb.
SetSP(rec_value_sp, use_dynamic);
878 value_list.
Append(value_sb);
894 std::unique_lock<std::recursive_mutex> lock;
900 if (target && process) {
907 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
908 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
925 std::unique_lock<std::recursive_mutex> lock;
931 if (target && process) {
939 reg_ctx->GetRegisterInfoByName(name)) {
941 result.
SetSP(value_sp);
955 std::unique_lock<std::recursive_mutex> lock;
964 error.SetErrorString(
"The provided SBFormat object is invalid");
968 if (target && process) {
978 error.SetErrorStringWithFormat(
979 "It was not possible to generate a frame "
980 "description with the given format string '%s'",
990 std::unique_lock<std::recursive_mutex> lock;
996 if (target && process) {
1015 std::unique_lock<std::recursive_mutex> lock;
1020 if (frame && target) {
1034 error.SetErrorString(
"can't evaluate expressions when the "
1035 "process is running.");
1037 result.
SetSP(error_val_sp,
false);
1051 std::unique_lock<std::recursive_mutex> lock;
1059 if (!language && frame)
1067 bool unwind_on_error) {
1071 std::unique_lock<std::recursive_mutex> lock;
1082 if (!language && frame)
1092 Log *expr_log =
GetLog(LLDBLog::Expressions);
1096 if (expr ==
nullptr || expr[0] ==
'\0') {
1102 std::unique_lock<std::recursive_mutex> lock;
1109 if (target && process) {
1114 std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1118 stack_trace = std::make_unique<llvm::PrettyStackTraceFormat>(
1119 "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
1130 error.SetErrorString(
"can't evaluate expressions when the "
1131 "process is running.");
1133 expr_result.
SetSP(expr_value_sp,
false);
1137 error.SetErrorString(
"sbframe object is not valid.");
1139 expr_result.
SetSP(expr_value_sp,
false);
1144 "** [SBFrame::EvaluateExpression] Expression result is "
1145 "%s, summary %s **",
1149 "** [SBFrame::EvaluateExpression] Expression evaluation failed: "
1165 std::unique_lock<std::recursive_mutex> lock;
1171 if (target && process) {
1195 std::unique_lock<std::recursive_mutex> lock;
1199 return frame->IsArtificial();
1207 std::unique_lock<std::recursive_mutex> lock;
1211 return frame->IsHidden();
1225 std::unique_lock<std::recursive_mutex> lock;
1231 if (target && process) {
1246 const char *name =
nullptr;
1247 std::unique_lock<std::recursive_mutex> lock;
1253 if (target && process) {
1259 eSymbolContextBlock |
1260 eSymbolContextSymbol));
1263 if (inlined_block) {
1270 if (name ==
nullptr) {
1275 if (name ==
nullptr) {
1288 const char *name =
nullptr;
1290 std::unique_lock<std::recursive_mutex> lock;
1296 if (target && process) {
1302 eSymbolContextBlock |
1303 eSymbolContextSymbol));
1306 if (inlined_block) {
1313 if (name ==
nullptr) {
1318 if (name ==
nullptr) {
static llvm::raw_ostream & error(Stream &strm)
#define INTERRUPT_REQUESTED(debugger,...)
This handy define will keep you from having to generate a report for the interruption by hand.
#define LLDB_INSTRUMENT_VA(...)
#define LLDB_LOGF(log,...)
void SetAddress(lldb::SBSection section, lldb::addr_t offset)
void SetPtr(lldb_private::Block *lldb_object_ptr)
void reset(lldb_private::CompileUnit *lldb_object_ptr)
const char * GetCString() const
Get the error string as a NULL terminated UTF8 c-string.
void SetFetchDynamicValue(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
void SetLanguage(lldb::LanguageType language)
lldb_private::EvaluateExpressionOptions & ref() const
void SetIgnoreBreakpoints(bool ignore=true)
void SetUnwindOnError(bool unwind=true)
lldb::DynamicValueType GetFetchDynamicValue() const
lldb::ExecutionContextRefSP m_opaque_sp
lldb::addr_t GetPC() const
const char * GetFunctionName()
Get the appropriate function name for this frame.
lldb::SBValue FindValue(const char *name, ValueType value_type)
Find variables, register sets, registers, or persistent variables using the frame as the scope.
lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr, DynamicValueType use_dynamic)
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const
SBError GetDescriptionWithFormat(const SBFormat &format, SBStream &output)
Similar to GetDescription() but the format of the description can be configured via the format parame...
lldb::SBValue FindRegister(const char *name)
bool SetPC(lldb::addr_t new_pc)
lldb::SBValue FindVariable(const char *var_name)
The version that doesn't supply a 'use_dynamic' value will use the target's default.
const char * GetDisplayFunctionName()
bool IsInlined()
Return true if this frame represents an inlined function.
bool operator==(const lldb::SBFrame &rhs) const
lldb::addr_t GetCFA() const
lldb::addr_t GetFP() const
const lldb::SBFrame & operator=(const lldb::SBFrame &rhs)
lldb::SBLineEntry GetLineEntry() const
lldb::SBValue EvaluateExpression(const char *expr)
The version that doesn't supply a 'use_dynamic' value will use the target's default.
lldb::SBCompileUnit GetCompileUnit() const
uint32_t GetFrameID() const
lldb::SBAddress GetPCAddress() const
lldb::SBFunction GetFunction() const
lldb::SBBlock GetBlock() const
Gets the deepest block that contains the frame PC.
lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics, bool in_scope_only)
The version that doesn't supply a 'use_dynamic' value will use the target's default.
bool IsEqual(const lldb::SBFrame &that) const
const char * Disassemble() const
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
lldb::SBThread GetThread() const
lldb::SBValueList GetRegisters()
lldb::LanguageType GuessLanguage() const
lldb::SBBlock GetFrameBlock() const
Gets the lexical block that defines the stack frame.
lldb::addr_t GetSP() const
lldb::StackFrameSP GetFrameSP() const
bool IsHidden() const
Return whether a frame recognizer decided this frame should not be displayes in backtraces etc.
lldb::SBSymbol GetSymbol() const
lldb::SBModule GetModule() const
bool GetDescription(lldb::SBStream &description)
bool operator!=(const lldb::SBFrame &rhs) const
void reset(lldb_private::Function *lldb_object_ptr)
void SetLineEntry(const lldb_private::LineEntry &lldb_object_ref)
void SetSP(const ModuleSP &module_sp)
lldb_private::Stream & ref()
void reset(lldb_private::Symbol *)
void SetError(const lldb_private::Status &status)
void Append(const lldb::SBValue &val_obj)
void SetSP(const lldb::ValueObjectSP &sp)
const char * GetSummary()
void SetIncludeRuntimeSupportValues(bool)
bool GetIncludeRuntimeSupportValues() const
void SetIncludeLocals(bool)
void SetIncludeArguments(bool)
lldb::DynamicValueType GetUseDynamic() const
bool GetIncludeArguments() const
void SetInScopeOnly(bool)
bool GetIncludeStatics() const
void SetIncludeStatics(bool)
void SetUseDynamic(lldb::DynamicValueType)
bool GetIncludeLocals() const
bool GetInScopeOnly() const
bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const
lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class=AddressClass::eInvalid) const
Get the load address as an opcode load address.
A class that describes a single lexical block.
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
const InlineFunctionInfo * GetInlinedFunctionInfo() const
Get const accessor for any inlined function information.
uint32_t AppendVariables(bool can_create, bool get_parent_variables, bool stop_if_block_is_inlined_function, const std::function< bool(Variable *)> &filter, VariableList *variable_list)
Appends the variables from this block, and optionally from all parent blocks, to variable_list.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
const char * GetCString() const
Get the string value as a C string.
A class to manage flag bits.
Execution context objects refer to objects in the execution of the program that is being debugged.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
const lldb::TargetSP & GetTargetSP() const
Get accessor to get the target shared pointer.
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Target * GetTargetPtr() const
Returns a pointer to the target object.
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
Process * GetProcessPtr() const
Returns a pointer to the process object.
ConstString GetName() const
ConstString GetDisplayName() const
A class that describes information for an inlined function.
ConstString GetDisplayName() const
ConstString GetName() const
bool TryLock(ProcessRunLock *lock)
A plug-in interface definition class for debugging a process.
ProcessRunLock & GetRunLock()
Target & GetTarget()
Get the target object pointer for this module.
This base class provides an interface to stack frames.
@ eExpressionPathOptionCheckPtrVsMember
@ eExpressionPathOptionsAllowDirectIVarAccess
VariableList * GetVariableList(bool get_file_globals, Status *error_ptr)
Retrieve the list of variables that are in scope at this StackFrame's pc.
void DumpUsingSettingsFormat(Stream *strm, bool show_unique=false, const char *frame_marker=nullptr)
Print a description for this frame using the frame-format formatter settings.
lldb::ValueObjectSP GetValueForVariableExpressionPath(llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, uint32_t options, lldb::VariableSP &var_sp, Status &error)
Create a ValueObject for a variable name / pathname, possibly including simple dereference/child sele...
SourceLanguage GuessLanguage()
Similar to GetLanguage(), but is allowed to take a potentially incorrect guess if exact information i...
lldb::RegisterContextSP GetRegisterContext()
Get the RegisterContext for this frame, if possible.
SourceLanguage GetLanguage()
Query this frame to determine what the default language should be when parsing expressions given the ...
lldb::ValueObjectSP GetValueObjectForFrameVariable(const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
Create a ValueObject for a given Variable in this StackFrame.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
uint32_t GetFrameIndex() const
Query this frame to find what frame it is in this Thread's StackFrameList.
Block * GetFrameBlock()
Get the current lexical scope block for this StackFrame, if possible.
bool DumpUsingFormat(Stream &strm, const lldb_private::FormatEntity::Entry *format, llvm::StringRef frame_marker={})
Print a description of this frame using the provided frame format.
lldb::RecognizedStackFrameSP GetRecognizedFrame()
lldb::ValueObjectSP FindVariable(ConstString name)
Attempt to reconstruct the ValueObject for a variable with a given name from within the current Stack...
const Address & GetFrameCodeAddress()
Get an Address for the current pc value in this StackFrame.
lldb::TargetSP CalculateTarget() override
lldb::addr_t GetCallFrameAddress() const
bool Fail() const
Test for error condition.
const char * GetData() const
A stream class that can stream formatted output to a file.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
Block * block
The Block for a given query.
lldb::ModuleSP module_sp
The Module for a given query.
CompileUnit * comp_unit
The CompileUnit for a given query.
Symbol * symbol
The Symbol for a given query.
LineEntry line_entry
The LineEntry for a given query.
ConstString GetName() const
ConstString GetDisplayName() const
bool GetDisplayRuntimeSupportValues() const
SourceLanguage GetLanguage() const
bool GetDisplayExpressionsInCrashlogs() const
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
lldb::ExpressionResults EvaluateExpression(llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, const EvaluateExpressionOptions &options=EvaluateExpressionOptions(), std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx_sp, uint32_t set_idx)
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx_sp, const RegisterInfo *reg_info)
lldb::VariableSP FindVariable(ConstString name, bool include_static_members=true)
size_t AppendVariablesIfUnique(VariableList &var_list)
bool IsInScope(StackFrame *frame)
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::ValueObjectList > ValueObjectListSP
std::shared_ptr< lldb_private::Variable > VariableSP
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
std::shared_ptr< lldb_private::Module > ModuleSP
@ eValueTypeVariableGlobal
globals variable
@ eValueTypeConstResult
constant result variables
@ eValueTypeVariableLocal
function local variables
@ eValueTypeVariableArgument
function argument variables
@ eValueTypeRegister
stack frame register value
@ eValueTypeVariableStatic
static variable
@ eValueTypeRegisterSet
A collection of stack frame register values.
@ eValueTypeVariableThreadLocal
thread local storage variable
Every register is described in detail including its name, alternate name (optional),...
Registers are grouped into register sets.
const char * name
Name of this register set.
const char * short_name
A short name for this register set.
A type-erased pair of llvm::dwarf::SourceLanguageName and version.
lldb::LanguageType AsLanguageType() const