53#include "llvm/Support/PrettyStackTrace.h"
93 return this->
operator bool();
95SBFrame::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) {
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;
611 VariableSP variable_sp(
616 sb_value.
SetSP(value_sp, use_dynamic);
624 if (
const RegisterInfo *reg_info =
625 reg_ctx->GetRegisterInfoByName(name)) {
627 sb_value.
SetSP(value_sp);
637 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
638 for (
uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
639 const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
641 (llvm::StringRef(reg_set->name).equals_insensitive(name) ||
642 llvm::StringRef(reg_set->short_name)
643 .equals_insensitive(name))) {
646 sb_value.
SetSP(value_sp);
656 ExpressionVariableSP expr_var_sp(
659 value_sp = expr_var_sp->GetValueObject();
660 sb_value.
SetSP(value_sp, use_dynamic);
678 lldb::StackFrameSP that_sp = that.
GetFrameSP();
679 return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
697 std::unique_lock<std::recursive_mutex> lock;
709 const char *disassembly =
nullptr;
710 std::unique_lock<std::recursive_mutex> lock;
716 if (target && process) {
730 bool in_scope_only) {
734 std::unique_lock<std::recursive_mutex> lock;
739 if (frame && target) {
742 const bool include_runtime_support_values =
759 bool statics,
bool in_scope_only,
764 std::unique_lock<std::recursive_mutex> lock;
768 const bool include_runtime_support_values =
784 std::unique_lock<std::recursive_mutex> lock;
792 const bool recognized_arguments =
796 const bool include_runtime_support_values =
801 std::set<VariableSP> variable_set;
803 if (target && process) {
811 if (var_error.
Fail())
814 const size_t num_variables = variable_list->
GetSize();
816 for (
const VariableSP &variable_sp : *variable_list) {
818 bool add_variable =
false;
819 switch (variable_sp->GetScope()) {
823 add_variable = statics;
827 add_variable = arguments;
831 add_variable = locals;
839 if (variable_set.find(variable_sp) == variable_set.end())
840 variable_set.insert(variable_sp);
844 if (in_scope_only && !variable_sp->IsInScope(frame))
850 if (!include_runtime_support_values && valobj_sp !=
nullptr &&
851 valobj_sp->IsRuntimeSupportValue())
855 value_sb.
SetSP(valobj_sp, use_dynamic);
856 value_list.
Append(value_sb);
862 if (recognized_arguments) {
864 if (recognized_frame) {
865 ValueObjectListSP recognized_arg_list =
866 recognized_frame->GetRecognizedArguments();
867 if (recognized_arg_list) {
868 for (
auto &rec_value_sp : recognized_arg_list->GetObjects()) {
870 value_sb.
SetSP(rec_value_sp, use_dynamic);
871 value_list.
Append(value_sb);
887 std::unique_lock<std::recursive_mutex> lock;
893 if (target && process) {
900 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
901 for (
uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
917 ValueObjectSP value_sp;
918 std::unique_lock<std::recursive_mutex> lock;
924 if (target && process) {
931 if (
const RegisterInfo *reg_info =
932 reg_ctx->GetRegisterInfoByName(name)) {
934 result.
SetSP(value_sp);
949 std::unique_lock<std::recursive_mutex> lock;
955 if (target && process) {
974 std::unique_lock<std::recursive_mutex> lock;
979 if (frame && target) {
1004 std::unique_lock<std::recursive_mutex> lock;
1018 bool unwind_on_error) {
1022 std::unique_lock<std::recursive_mutex> lock;
1041 Log *expr_log =
GetLog(LLDBLog::Expressions);
1045 if (expr ==
nullptr || expr[0] ==
'\0') {
1049 ValueObjectSP expr_value_sp;
1051 std::unique_lock<std::recursive_mutex> lock;
1059 if (target && process) {
1064 std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1068 stack_trace = std::make_unique<llvm::PrettyStackTraceFormat>(
1069 "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
1082 "** [SBFrame::EvaluateExpression] Expression result is "
1083 "%s, summary %s **",
1098 std::unique_lock<std::recursive_mutex> lock;
1104 if (target && process) {
1128 std::unique_lock<std::recursive_mutex> lock;
1147 std::unique_lock<std::recursive_mutex> lock;
1153 if (target && process) {
1168 const char *name =
nullptr;
1169 std::unique_lock<std::recursive_mutex> lock;
1175 if (target && process) {
1181 eSymbolContextBlock |
1182 eSymbolContextSymbol));
1185 if (inlined_block) {
1192 if (name ==
nullptr) {
1197 if (name ==
nullptr) {
1210 const char *name =
nullptr;
1212 std::unique_lock<std::recursive_mutex> lock;
1218 if (target && process) {
1224 eSymbolContextBlock |
1225 eSymbolContextSymbol));
1228 if (inlined_block) {
1235 if (name ==
nullptr) {
1240 if (name ==
nullptr) {
static llvm::raw_ostream & error(Stream &strm)
#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)
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
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
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.
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()
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::LanguageType GetLanguage()
Query this frame to determine what the default language should be when parsing expressions given the ...
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::RegisterContextSP GetRegisterContext()
Get the RegisterContext for this frame, if possible.
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.
const char * Disassemble()
Return the disassembly for the instructions of this StackFrame's function as a single C string.
bool IsArtificial() const
Query whether this frame is artificial (e.g a synthesized result of inferring missing tail call frame...
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.
lldb::LanguageType GuessLanguage()
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
lldb::LanguageType 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::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)
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ 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