Go to the documentation of this file.
53 #include "llvm/Support/PrettyStackTrace.h"
93 return this->
operator bool();
95 SBFrame::operator bool()
const {
98 std::unique_lock<std::recursive_mutex> lock;
103 if (target && process) {
106 return GetFrameSP().get() !=
nullptr;
117 std::unique_lock<std::recursive_mutex> lock;
119 SymbolContextItem scope =
static_cast<SymbolContextItem
>(resolve_scope);
122 if (target && process) {
126 sb_sym_ctx = frame->GetSymbolContext(scope);
138 std::unique_lock<std::recursive_mutex> lock;
144 if (target && process) {
150 sb_module.
SetSP(module_sp);
162 std::unique_lock<std::recursive_mutex> lock;
168 if (target && process) {
186 std::unique_lock<std::recursive_mutex> lock;
192 if (target && process) {
210 std::unique_lock<std::recursive_mutex> lock;
216 if (target && process) {
233 std::unique_lock<std::recursive_mutex> lock;
239 if (target && process) {
254 std::unique_lock<std::recursive_mutex> lock;
260 if (target && process) {
275 std::unique_lock<std::recursive_mutex> lock;
281 if (target && process) {
291 return sb_line_entry;
299 std::unique_lock<std::recursive_mutex> lock;
312 std::unique_lock<std::recursive_mutex> lock;
325 std::unique_lock<std::recursive_mutex> lock;
331 if (target && process) {
337 target, AddressClass::eCode);
348 bool ret_val =
false;
349 std::unique_lock<std::recursive_mutex> lock;
354 if (target && process) {
358 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext()) {
359 ret_val = reg_ctx_sp->SetPC(new_pc);
372 std::unique_lock<std::recursive_mutex> lock;
377 if (target && process) {
381 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext()) {
382 addr = reg_ctx_sp->GetSP();
395 std::unique_lock<std::recursive_mutex> lock;
400 if (target && process) {
404 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext()) {
405 addr = reg_ctx_sp->GetFP();
418 std::unique_lock<std::recursive_mutex> lock;
424 if (target && process) {
445 std::unique_lock<std::recursive_mutex> lock;
450 if (frame && target) {
463 if (var_path ==
nullptr || var_path[0] ==
'\0') {
467 std::unique_lock<std::recursive_mutex> lock;
473 if (target && process) {
482 StackFrame::eExpressionPathOptionCheckPtrVsMember |
483 StackFrame::eExpressionPathOptionsAllowDirectIVarAccess,
485 sb_value.
SetSP(value_sp, use_dynamic);
496 std::unique_lock<std::recursive_mutex> lock;
501 if (frame && target) {
516 if (name ==
nullptr || name[0] ==
'\0') {
520 ValueObjectSP value_sp;
521 std::unique_lock<std::recursive_mutex> lock;
527 if (target && process) {
535 sb_value.
SetSP(value_sp, use_dynamic);
547 std::unique_lock<std::recursive_mutex> lock;
552 if (frame && target) {
555 value =
FindValue(name, value_type, use_dynamic);
566 if (name ==
nullptr || name[0] ==
'\0') {
570 ValueObjectSP value_sp;
571 std::unique_lock<std::recursive_mutex> lock;
577 if (target && process) {
584 switch (value_type) {
593 const bool can_create =
true;
594 const bool get_parent_variables =
true;
595 const bool stop_if_block_is_inlined_function =
true;
599 can_create, get_parent_variables,
600 stop_if_block_is_inlined_function,
604 const bool get_file_globals =
true;
610 VariableSP variable_sp(
615 sb_value.
SetSP(value_sp, use_dynamic);
623 if (
const RegisterInfo *reg_info =
624 reg_ctx->GetRegisterInfoByName(name)) {
625 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_info);
626 sb_value.
SetSP(value_sp);
636 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
637 for (
uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
638 const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
640 (llvm::StringRef(reg_set->name).equals_insensitive(name) ||
641 llvm::StringRef(reg_set->short_name)
642 .equals_insensitive(name))) {
644 ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx);
645 sb_value.
SetSP(value_sp);
655 ExpressionVariableSP expr_var_sp(
658 value_sp = expr_var_sp->GetValueObject();
659 sb_value.
SetSP(value_sp, use_dynamic);
677 lldb::StackFrameSP that_sp = that.
GetFrameSP();
678 return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
696 std::unique_lock<std::recursive_mutex> lock;
708 const char *disassembly =
nullptr;
709 std::unique_lock<std::recursive_mutex> lock;
715 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) {
810 const size_t num_variables = variable_list->
GetSize();
812 for (
const VariableSP &variable_sp : *variable_list) {
814 bool add_variable =
false;
815 switch (variable_sp->GetScope()) {
819 add_variable = statics;
823 add_variable = arguments;
827 add_variable = locals;
835 if (variable_set.find(variable_sp) == variable_set.end())
836 variable_set.insert(variable_sp);
840 if (in_scope_only && !variable_sp->IsInScope(frame))
846 if (!include_runtime_support_values && valobj_sp !=
nullptr &&
847 valobj_sp->IsRuntimeSupportValue())
851 value_sb.
SetSP(valobj_sp, use_dynamic);
852 value_list.
Append(value_sb);
858 if (recognized_arguments) {
860 if (recognized_frame) {
861 ValueObjectListSP recognized_arg_list =
862 recognized_frame->GetRecognizedArguments();
863 if (recognized_arg_list) {
864 for (
auto &rec_value_sp : recognized_arg_list->GetObjects()) {
866 value_sb.
SetSP(rec_value_sp, use_dynamic);
867 value_list.
Append(value_sb);
883 std::unique_lock<std::recursive_mutex> lock;
889 if (target && process) {
896 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
897 for (
uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
899 ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx));
913 ValueObjectSP value_sp;
914 std::unique_lock<std::recursive_mutex> lock;
920 if (target && process) {
927 if (
const RegisterInfo *reg_info =
928 reg_ctx->GetRegisterInfoByName(name)) {
929 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_info);
930 result.
SetSP(value_sp);
945 std::unique_lock<std::recursive_mutex> lock;
951 if (target && process) {
970 std::unique_lock<std::recursive_mutex> lock;
975 if (frame && target) {
1000 std::unique_lock<std::recursive_mutex> lock;
1014 bool unwind_on_error) {
1018 std::unique_lock<std::recursive_mutex> lock;
1037 Log *expr_log =
GetLog(LLDBLog::Expressions);
1041 if (expr ==
nullptr || expr[0] ==
'\0') {
1045 ValueObjectSP expr_value_sp;
1047 std::unique_lock<std::recursive_mutex> lock;
1055 if (target && process) {
1060 std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1064 stack_trace = std::make_unique<llvm::PrettyStackTraceFormat>(
1065 "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
1078 "** [SBFrame::EvaluateExpression] Expression result is "
1079 "%s, summary %s **",
1094 std::unique_lock<std::recursive_mutex> lock;
1098 Target *target = exe_ctx.GetTargetPtr();
1099 Process *process = exe_ctx.GetProcessPtr();
1100 if (target && process) {
1103 frame = exe_ctx.GetFramePtr();
1124 std::unique_lock<std::recursive_mutex> lock;
1143 std::unique_lock<std::recursive_mutex> lock;
1149 if (target && process) {
1164 const char *name =
nullptr;
1165 std::unique_lock<std::recursive_mutex> lock;
1169 Target *target = exe_ctx.GetTargetPtr();
1170 Process *process = exe_ctx.GetProcessPtr();
1171 if (target && process) {
1174 frame = exe_ctx.GetFramePtr();
1177 eSymbolContextBlock |
1178 eSymbolContextSymbol));
1181 if (inlined_block) {
1188 if (name ==
nullptr) {
1190 name = sc.function->GetName().GetCString();
1193 if (name ==
nullptr) {
1195 name = sc.symbol->GetName().GetCString();
1206 const char *name =
nullptr;
1208 std::unique_lock<std::recursive_mutex> lock;
1214 if (target && process) {
1220 eSymbolContextBlock |
1221 eSymbolContextSymbol));
1224 if (inlined_block) {
1231 if (name ==
nullptr) {
1236 if (name ==
nullptr) {
lldb::SBThread GetThread() const
lldb::TargetSP CalculateTarget() override
lldb::addr_t GetSP() const
lldb::LanguageType GuessLanguage() const
Block * block
The Block for a given query.
CompileUnit * comp_unit
The CompileUnit for a given query.
lldb_private::Stream & ref()
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
lldb::SBFunction GetFunction() const
bool GetDisplayExpressionsInCrashlogs() const
lldb::SBValue FindRegister(const char *name)
@ eValueTypeVariableGlobal
globals variable
lldb::StackFrameSP GetFrameSP() const
lldb::ExecutionContextRefSP m_opaque_sp
VariableList * GetVariableList(bool get_file_globals)
Retrieve the list of variables that are in scope at this StackFrame's pc.
Process * GetProcessPtr() const
Returns a pointer to the process object.
lldb::DynamicValueType GetFetchDynamicValue() const
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.
bool GetIncludeLocals() const
bool operator==(const lldb::SBFrame &rhs) const
const Address & GetFrameCodeAddress()
Get an Address for the current pc value in this StackFrame.
ConstString GetDisplayName() const
#define LLDB_LOGF(log,...)
lldb::SBValue FindValue(const char *name, ValueType value_type)
Find variables, register sets, registers, or persistent variables using the frame as the scope.
Block * GetFrameBlock()
Get the current lexical scope block for this StackFrame, if possible.
LanguageType
Programming language type.
lldb::VariableSP FindVariable(ConstString name, bool include_static_members=true)
lldb::SBValueList GetRegisters()
lldb::SBAddress GetPCAddress() const
void SetUnwindOnError(bool unwind=true)
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
lldb::DynamicValueType GetUseDynamic() const
@ eValueTypeRegisterSet
A collection of stack frame register values.
lldb::ValueObjectSP FindVariable(ConstString name)
Attempt to reconstruct the ValueObject for a variable with a given name from within the current Stack...
void SetPtr(lldb_private::Block *lldb_object_ptr)
lldb::SBCompileUnit GetCompileUnit() const
void SetAddress(lldb::SBSection section, lldb::addr_t offset)
ProcessRunLock & GetRunLock()
lldb_private::EvaluateExpressionOptions & ref() const
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const
lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class=AddressClass::eInvalid) const
Get the load address as an opcode load address.
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
bool IsInlined()
Return true if this frame represents an inlined function.
lldb::SBBlock GetFrameBlock() const
Gets the lexical block that defines the stack frame.
bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const
lldb::addr_t GetCallFrameAddress() const
lldb::SBValue EvaluateExpression(const char *expr)
The version that doesn't supply a 'use_dynamic' value will use the target's default.
static llvm::raw_ostream & error(Stream &strm)
Symbol * symbol
The Symbol for a given query.
bool IsInScope(StackFrame *frame)
lldb::SBSymbol GetSymbol() const
void reset(lldb_private::Symbol *)
bool GetIncludeStatics() const
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
bool TryLock(ProcessRunLock *lock)
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.
lldb::addr_t GetCFA() const
void SetSP(const ModuleSP &module_sp)
const char * GetDisplayFunctionName()
const char * GetData() const
Function * function
The Function for a given query.
lldb::SBLineEntry GetLineEntry() const
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...
lldb::SBBlock GetBlock() const
Gets the deepest block that contains the frame PC.
void SetInScopeOnly(bool)
lldb::SBModule GetModule() const
void Append(const lldb::SBValue &val_obj)
bool operator!=(const lldb::SBFrame &rhs) const
ConstString GetName() const
bool GetDescription(lldb::SBStream &description)
void reset(lldb_private::Function *lldb_object_ptr)
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 * Disassemble() const
lldb::addr_t GetPC() const
@ eValueTypeVariableArgument
function argument variables
lldb::addr_t GetFP() const
uint32_t GetFrameID() const
const lldb::SBFrame & operator=(const lldb::SBFrame &rhs)
bool GetIncludeRuntimeSupportValues() const
bool GetIncludeArguments() const
void SetIncludeRuntimeSupportValues(bool)
bool GetDisplayRuntimeSupportValues() const
lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr, DynamicValueType use_dynamic)
bool SetPC(lldb::addr_t new_pc)
void SetLanguage(lldb::LanguageType language)
void SetIncludeLocals(bool)
void SetFetchDynamicValue(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
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.
ConstString GetDisplayName() const
@ eValueTypeVariableLocal
function local variables
@ eLanguageTypeUnknown
Unknown or invalid language value.
bool GetInScopeOnly() const
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)
const char * GetSummary()
lldb::LanguageType GuessLanguage()
lldb::LanguageType GetLanguage()
Query this frame to determine what the default language should be when parsing expressions given the ...
bool IsArtificial() const
Query whether this frame is artificial (e.g a synthesized result of inferring missing tail call frame...
const char * Disassemble()
Return the disassembly for the instructions of this StackFrame's function as a single C string.
void SetSP(const lldb::ValueObjectSP &sp)
void SetIncludeStatics(bool)
bool IsEqual(const lldb::SBFrame &that) const
void reset(lldb_private::CompileUnit *lldb_object_ptr)
lldb::ModuleSP module_sp
The Module for a given query.
#define LLDB_INVALID_ADDRESS
const char * GetCString() const
Get the string value as a C string.
const lldb::TargetSP & GetTargetSP() const
Get accessor to get the target shared pointer.
void SetUseDynamic(lldb::DynamicValueType)
size_t AppendVariablesIfUnique(VariableList &var_list)
@ eValueTypeVariableThreadLocal
thread local storage variable
A class that represents a running process on the host machine.
lldb::LanguageType GetLanguage() const
@ eValueTypeConstResult
constant result variables
lldb::RegisterContextSP GetRegisterContext()
Get the RegisterContext for this frame, if possible.
#define LLDB_INSTRUMENT_VA(...)
void SetLineEntry(const lldb_private::LineEntry &lldb_object_ref)
const char * GetFunctionName()
Get the appropriate function name for this frame.
lldb::RecognizedStackFrameSP GetRecognizedFrame()
@ eValueTypeRegister
stack frame register value
uint32_t GetFrameIndex() const
Query this frame to find what frame it is in this Thread's StackFrameList.
@ eValueTypeVariableStatic
static variable
const InlineFunctionInfo * GetInlinedFunctionInfo() const
Get const accessor for any inlined function information.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
LineEntry line_entry
The LineEntry for a given query.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
ConstString GetDisplayName() const
void SetIncludeArguments(bool)
Execution context objects refer to objects in the execution of the program that is being debugged.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
Target * GetTargetPtr() const
Returns a pointer to the target object.
void SetIgnoreBreakpoints(bool ignore=true)
lldb::ValueObjectSP GetValueObjectForFrameVariable(const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
Create a ValueObject for a given Variable in this StackFrame.