52 #include "llvm/Support/PrettyStackTrace.h" 94 return this->
operator bool();
96 SBFrame::operator bool()
const {
99 std::unique_lock<std::recursive_mutex> lock;
102 Target *target = exe_ctx.GetTargetPtr();
103 Process *process = exe_ctx.GetProcessPtr();
104 if (target && process) {
119 std::unique_lock<std::recursive_mutex> lock;
121 SymbolContextItem scope =
static_cast<SymbolContextItem
>(resolve_scope);
123 Target *target = exe_ctx.GetTargetPtr();
124 Process *process = exe_ctx.GetProcessPtr();
125 if (target && process) {
128 frame = exe_ctx.GetFramePtr();
142 std::unique_lock<std::recursive_mutex> lock;
146 Target *target = exe_ctx.GetTargetPtr();
147 Process *process = exe_ctx.GetProcessPtr();
148 if (target && process) {
151 frame = exe_ctx.GetFramePtr();
153 module_sp = frame->GetSymbolContext(eSymbolContextModule).module_sp;
154 sb_module.SetSP(module_sp);
167 std::unique_lock<std::recursive_mutex> lock;
171 Target *target = exe_ctx.GetTargetPtr();
172 Process *process = exe_ctx.GetProcessPtr();
173 if (target && process) {
176 frame = exe_ctx.GetFramePtr();
179 frame->GetSymbolContext(eSymbolContextCompUnit).comp_unit);
191 std::unique_lock<std::recursive_mutex> lock;
195 Target *target = exe_ctx.GetTargetPtr();
196 Process *process = exe_ctx.GetProcessPtr();
197 if (target && process) {
200 frame = exe_ctx.GetFramePtr();
203 frame->GetSymbolContext(eSymbolContextFunction).function);
215 std::unique_lock<std::recursive_mutex> lock;
219 Target *target = exe_ctx.GetTargetPtr();
220 Process *process = exe_ctx.GetProcessPtr();
221 if (target && process) {
224 frame = exe_ctx.GetFramePtr();
226 sb_symbol.
reset(frame->GetSymbolContext(eSymbolContextSymbol).symbol);
238 std::unique_lock<std::recursive_mutex> lock;
242 Target *target = exe_ctx.GetTargetPtr();
243 Process *process = exe_ctx.GetProcessPtr();
244 if (target && process) {
247 frame = exe_ctx.GetFramePtr();
249 sb_block.SetPtr(frame->GetSymbolContext(eSymbolContextBlock).block);
259 std::unique_lock<std::recursive_mutex> lock;
263 Target *target = exe_ctx.GetTargetPtr();
264 Process *process = exe_ctx.GetProcessPtr();
265 if (target && process) {
268 frame = exe_ctx.GetFramePtr();
270 sb_block.SetPtr(frame->GetFrameBlock());
280 std::unique_lock<std::recursive_mutex> lock;
284 Target *target = exe_ctx.GetTargetPtr();
285 Process *process = exe_ctx.GetProcessPtr();
286 if (target && process) {
289 frame = exe_ctx.GetFramePtr();
291 sb_line_entry.SetLineEntry(
292 frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
304 std::unique_lock<std::recursive_mutex> lock;
309 frame_idx = frame->GetFrameIndex();
317 std::unique_lock<std::recursive_mutex> lock;
330 std::unique_lock<std::recursive_mutex> lock;
334 Target *target = exe_ctx.GetTargetPtr();
335 Process *process = exe_ctx.GetProcessPtr();
336 if (target && process) {
339 frame = exe_ctx.GetFramePtr();
341 addr = frame->GetFrameCodeAddress().GetOpcodeLoadAddress(
342 target, AddressClass::eCode);
353 bool ret_val =
false;
354 std::unique_lock<std::recursive_mutex> lock;
358 Target *target = exe_ctx.GetTargetPtr();
359 Process *process = exe_ctx.GetProcessPtr();
360 if (target && process) {
363 frame = exe_ctx.GetFramePtr();
365 ret_val = frame->GetRegisterContext()->SetPC(new_pc);
377 std::unique_lock<std::recursive_mutex> lock;
381 Target *target = exe_ctx.GetTargetPtr();
382 Process *process = exe_ctx.GetProcessPtr();
383 if (target && process) {
386 frame = exe_ctx.GetFramePtr();
388 addr = frame->GetRegisterContext()->GetSP();
400 std::unique_lock<std::recursive_mutex> lock;
404 Target *target = exe_ctx.GetTargetPtr();
405 Process *process = exe_ctx.GetProcessPtr();
406 if (target && process) {
409 frame = exe_ctx.GetFramePtr();
411 addr = frame->GetRegisterContext()->GetFP();
422 std::unique_lock<std::recursive_mutex> lock;
426 Target *target = exe_ctx.GetTargetPtr();
427 Process *process = exe_ctx.GetProcessPtr();
428 if (target && process) {
431 frame = exe_ctx.GetFramePtr();
433 sb_addr.
SetAddress(&frame->GetFrameCodeAddress());
447 (
const char *), var_path);
450 std::unique_lock<std::recursive_mutex> lock;
454 Target *target = exe_ctx.GetTargetPtr();
455 if (frame && target) {
470 if (var_path ==
nullptr || var_path[0] ==
'\0') {
474 std::unique_lock<std::recursive_mutex> lock;
478 Target *target = exe_ctx.GetTargetPtr();
479 Process *process = exe_ctx.GetProcessPtr();
480 if (target && process) {
483 frame = exe_ctx.GetFramePtr();
487 ValueObjectSP value_sp(frame->GetValueForVariableExpressionPath(
489 StackFrame::eExpressionPathOptionCheckPtrVsMember |
490 StackFrame::eExpressionPathOptionsAllowDirectIVarAccess,
492 sb_value.
SetSP(value_sp, use_dynamic);
504 std::unique_lock<std::recursive_mutex> lock;
508 Target *target = exe_ctx.GetTargetPtr();
509 if (frame && target) {
525 if (name ==
nullptr || name[0] ==
'\0') {
529 ValueObjectSP value_sp;
530 std::unique_lock<std::recursive_mutex> lock;
534 Target *target = exe_ctx.GetTargetPtr();
535 Process *process = exe_ctx.GetProcessPtr();
536 if (target && process) {
539 frame = exe_ctx.GetFramePtr();
544 sb_value.
SetSP(value_sp, use_dynamic);
557 std::unique_lock<std::recursive_mutex> lock;
561 Target *target = exe_ctx.GetTargetPtr();
562 if (frame && target) {
565 value =
FindValue(name, value_type, use_dynamic);
574 name, value_type, use_dynamic);
578 if (name ==
nullptr || name[0] ==
'\0') {
582 ValueObjectSP value_sp;
583 std::unique_lock<std::recursive_mutex> lock;
587 Target *target = exe_ctx.GetTargetPtr();
588 Process *process = exe_ctx.GetProcessPtr();
589 if (target && process) {
592 frame = exe_ctx.GetFramePtr();
596 switch (value_type) {
603 SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock));
605 const bool can_create =
true;
606 const bool get_parent_variables =
true;
607 const bool stop_if_block_is_inlined_function =
true;
611 can_create, get_parent_variables,
612 stop_if_block_is_inlined_function,
616 const bool get_file_globals =
true;
617 VariableList *frame_vars = frame->GetVariableList(get_file_globals);
622 VariableSP variable_sp(
625 value_sp = frame->GetValueObjectForFrameVariable(variable_sp,
627 sb_value.
SetSP(value_sp, use_dynamic);
633 RegisterContextSP reg_ctx(frame->GetRegisterContext());
635 const uint32_t num_regs = reg_ctx->GetRegisterCount();
636 for (
uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
637 const RegisterInfo *reg_info =
638 reg_ctx->GetRegisterInfoAtIndex(reg_idx);
640 ((reg_info->name &&
strcasecmp(reg_info->name, name) == 0) ||
641 (reg_info->alt_name &&
642 strcasecmp(reg_info->alt_name, name) == 0))) {
643 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx);
644 sb_value.
SetSP(value_sp);
654 RegisterContextSP reg_ctx(frame->GetRegisterContext());
656 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
657 for (
uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
658 const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
660 ((reg_set->name &&
strcasecmp(reg_set->name, name) == 0) ||
661 (reg_set->short_name &&
662 strcasecmp(reg_set->short_name, name) == 0))) {
664 ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx);
665 sb_value.
SetSP(value_sp);
675 ExpressionVariableSP expr_var_sp(
678 value_sp = expr_var_sp->GetValueObject();
679 sb_value.
SetSP(value_sp, use_dynamic);
698 lldb::StackFrameSP that_sp = that.
GetFrameSP();
699 return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
719 std::unique_lock<std::recursive_mutex> lock;
722 ThreadSP thread_sp(exe_ctx.GetThreadSP());
731 const char *disassembly =
nullptr;
732 std::unique_lock<std::recursive_mutex> lock;
736 Target *target = exe_ctx.GetTargetPtr();
737 Process *process = exe_ctx.GetProcessPtr();
738 if (target && process) {
741 frame = exe_ctx.GetFramePtr();
743 disassembly = frame->Disassemble();
752 bool in_scope_only) {
754 (
bool,
bool,
bool,
bool), arguments, locals, statics,
758 std::unique_lock<std::recursive_mutex> lock;
762 Target *target = exe_ctx.GetTargetPtr();
763 if (frame && target) {
766 const bool include_runtime_support_values =
783 bool statics,
bool in_scope_only,
787 arguments, locals, statics, in_scope_only, use_dynamic);
789 std::unique_lock<std::recursive_mutex> lock;
792 Target *target = exe_ctx.GetTargetPtr();
793 const bool include_runtime_support_values =
810 std::unique_lock<std::recursive_mutex> lock;
814 Target *target = exe_ctx.GetTargetPtr();
818 const bool recognized_arguments =
822 const bool include_runtime_support_values =
827 std::set<VariableSP> variable_set;
828 Process *process = exe_ctx.GetProcessPtr();
829 if (target && process) {
832 frame = exe_ctx.GetFramePtr();
836 variable_list = frame->GetVariableList(
true);
838 const size_t num_variables = variable_list->
GetSize();
840 for (i = 0; i < num_variables; ++i) {
843 bool add_variable =
false;
844 switch (variable_sp->GetScope()) {
848 add_variable = statics;
852 add_variable = arguments;
856 add_variable = locals;
864 if (variable_set.find(variable_sp) == variable_set.end())
865 variable_set.insert(variable_sp);
869 if (in_scope_only && !variable_sp->IsInScope(frame))
872 ValueObjectSP valobj_sp(frame->GetValueObjectForFrameVariable(
875 if (!include_runtime_support_values && valobj_sp !=
nullptr &&
876 valobj_sp->IsRuntimeSupportValue())
880 value_sb.
SetSP(valobj_sp, use_dynamic);
881 value_list.
Append(value_sb);
887 if (recognized_arguments) {
888 auto recognized_frame = frame->GetRecognizedFrame();
889 if (recognized_frame) {
890 ValueObjectListSP recognized_arg_list =
891 recognized_frame->GetRecognizedArguments();
892 if (recognized_arg_list) {
893 for (
auto &rec_value_sp : recognized_arg_list->GetObjects()) {
895 value_sb.
SetSP(rec_value_sp, use_dynamic);
896 value_list.
Append(value_sb);
912 std::unique_lock<std::recursive_mutex> lock;
916 Target *target = exe_ctx.GetTargetPtr();
917 Process *process = exe_ctx.GetProcessPtr();
918 if (target && process) {
921 frame = exe_ctx.GetFramePtr();
923 RegisterContextSP reg_ctx(frame->GetRegisterContext());
925 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
926 for (
uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
928 ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx));
943 ValueObjectSP value_sp;
944 std::unique_lock<std::recursive_mutex> lock;
948 Target *target = exe_ctx.GetTargetPtr();
949 Process *process = exe_ctx.GetProcessPtr();
950 if (target && process) {
953 frame = exe_ctx.GetFramePtr();
955 RegisterContextSP reg_ctx(frame->GetRegisterContext());
957 const uint32_t num_regs = reg_ctx->GetRegisterCount();
958 for (
uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
959 const RegisterInfo *reg_info =
960 reg_ctx->GetRegisterInfoAtIndex(reg_idx);
962 ((reg_info->name &&
strcasecmp(reg_info->name, name) == 0) ||
963 (reg_info->alt_name &&
964 strcasecmp(reg_info->alt_name, name) == 0))) {
965 value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx);
966 result.
SetSP(value_sp);
984 std::unique_lock<std::recursive_mutex> lock;
988 Target *target = exe_ctx.GetTargetPtr();
989 Process *process = exe_ctx.GetProcessPtr();
990 if (target && process) {
993 frame = exe_ctx.GetFramePtr();
995 frame->DumpUsingSettingsFormat(&strm);
1010 std::unique_lock<std::recursive_mutex> lock;
1014 Target *target = exe_ctx.GetTargetPtr();
1015 if (frame && target) {
1018 frame->CalculateTarget()->GetPreferDynamicValue();
1036 fetch_dynamic_value);
1042 std::unique_lock<std::recursive_mutex> lock;
1046 Target *target = exe_ctx.GetTargetPtr();
1056 bool unwind_on_error) {
1059 fetch_dynamic_value, unwind_on_error);
1062 std::unique_lock<std::recursive_mutex> lock;
1069 Target *target = exe_ctx.GetTargetPtr();
1087 if (expr ==
nullptr || expr[0] ==
'\0') {
1091 ValueObjectSP expr_value_sp;
1093 std::unique_lock<std::recursive_mutex> lock;
1098 Target *target = exe_ctx.GetTargetPtr();
1099 Process *process = exe_ctx.GetProcessPtr();
1101 if (target && process) {
1104 frame = exe_ctx.GetFramePtr();
1106 std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1109 frame->DumpUsingSettingsFormat(&frame_description);
1110 stack_trace = llvm::make_unique<llvm::PrettyStackTraceFormat>(
1111 "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value " 1124 expr_log->
Printf(
"** [SBFrame::EvaluateExpression] Expression result is " 1125 "%s, summary %s **",
1140 std::unique_lock<std::recursive_mutex> lock;
1144 Target *target = exe_ctx.GetTargetPtr();
1145 Process *process = exe_ctx.GetProcessPtr();
1146 if (target && process) {
1149 frame = exe_ctx.GetFramePtr();
1152 Block *block = frame->GetSymbolContext(eSymbolContextBlock).block;
1170 std::unique_lock<std::recursive_mutex> lock;
1189 std::unique_lock<std::recursive_mutex> lock;
1193 Target *target = exe_ctx.GetTargetPtr();
1194 Process *process = exe_ctx.GetProcessPtr();
1195 if (target && process) {
1198 frame = exe_ctx.GetFramePtr();
1200 return frame->GuessLanguage();
1210 const char *name =
nullptr;
1211 std::unique_lock<std::recursive_mutex> lock;
1215 Target *target = exe_ctx.GetTargetPtr();
1216 Process *process = exe_ctx.GetProcessPtr();
1217 if (target && process) {
1220 frame = exe_ctx.GetFramePtr();
1222 SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
1223 eSymbolContextBlock |
1224 eSymbolContextSymbol));
1227 if (inlined_block) {
1231 inlined_info->
GetName(sc.function->GetLanguage()).AsCString();
1235 if (name ==
nullptr) {
1240 if (name ==
nullptr) {
1242 name = sc.symbol->GetName().GetCString();
1253 const char *name =
nullptr;
1255 std::unique_lock<std::recursive_mutex> lock;
1259 Target *target = exe_ctx.GetTargetPtr();
1260 Process *process = exe_ctx.GetProcessPtr();
1261 if (target && process) {
1264 frame = exe_ctx.GetFramePtr();
1266 SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
1267 eSymbolContextBlock |
1268 eSymbolContextSymbol));
1271 if (inlined_block) {
1279 if (name ==
nullptr) {
1281 name = sc.function->GetDisplayName().
GetCString();
1284 if (name ==
nullptr) {
1286 name = sc.symbol->GetDisplayName().GetCString();
1344 (
bool,
bool,
bool,
bool));
const char * Disassemble() const
lldb::LanguageType GuessLanguage() const
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
void RegisterMethods< SBFrame >(Registry &R)
The registry contains a unique mapping between functions and their ID.
lldb_private::EvaluateExpressionOptions & ref() const
Enumerations for broadcasting.
ConstString GetDisplayName(lldb::LanguageType language) const
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
lldb::SBValue FindRegister(const char *name)
A stream class that can stream formatted output to a file.
bool IsInScope(StackFrame *frame)
Defines a symbol context baton that can be handed other debug core functions.
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
bool GetInScopeOnly() const
bool TryLock(ProcessRunLock *lock)
bool GetDisplayRuntimeSupportValues() const
lldb::addr_t GetCallFrameAddress() 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)
bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const
void SetAddress(lldb::SBSection section, lldb::addr_t offset)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void SetIncludeLocals(bool)
const char * GetData() const
A class that describes a single lexical block.
void SetSP(const lldb::ValueObjectSP &sp)
bool IsArtificial() const
Query whether this frame is artificial (e.g a synthesized result of inferring missing tail call frame...
lldb::ExecutionContextRefSP m_opaque_sp
bool GetDisplayExpressionsInCrashlogs() const
lldb::SBValue FindValue(const char *name, ValueType value_type)
Find variables, register sets, registers, or persistent variables using the frame as the scope...
bool operator==(const lldb::SBFrame &rhs) const
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
lldb::SBAddress GetPCAddress() const
void SetUseDynamic(lldb::DynamicValueType)
void SetInScopeOnly(bool)
lldb::VariableSP GetVariableAtIndex(size_t idx) const
lldb::SBValueList GetRegisters()
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
bool IsEqual(const lldb::SBFrame &that) const
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)
#define LLDB_INVALID_ADDRESS
Invalid value definitions.
bool operator!=(const lldb::SBFrame &rhs) const
LanguageType
Programming language type.
void SetSymbolContext(const lldb_private::SymbolContext *sc_ptr)
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
void SetIncludeArguments(bool)
const char * GetFunctionName()
Get the appropriate function name for this frame.
Log * GetLogIfAllCategoriesSet(uint32_t mask)
void SetIncludeRuntimeSupportValues(bool)
uint32_t GetFrameID() const
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.
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
ConstString GetName(lldb::LanguageType language) const
lldb::VariableSP FindVariable(ConstString name, bool include_static_members=true)
bool GetDescription(lldb::SBStream &description)
size_t AppendVariablesIfUnique(VariableList &var_list)
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
lldb::DynamicValueType GetFetchDynamicValue() const
A plug-in interface definition class for debugging a process.
const lldb::SBFrame & operator=(const lldb::SBFrame &rhs)
void SetLanguage(lldb::LanguageType language)
Execution context objects refer to objects in the execution of the program that is being debugged...
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
lldb::SBValue EvaluateExpression(const char *expr)
The version that doesn't supply a 'use_dynamic' value will use the target's default.
lldb_private::Stream & ref()
const char * GetDisplayFunctionName()
bool GetIncludeLocals() const
const InlineFunctionInfo * GetInlinedFunctionInfo() const
Get const accessor for any inlined function information.
#define LLDB_RECORD_METHOD_CONST(Result, Class, Method, Signature,...)
bool GetIncludeRuntimeSupportValues() const
lldb::SBFunction GetFunction() const
const char * GetSummary()
lldb::DynamicValueType GetUseDynamic() const
A class that describes information for an inlined function.
lldb::StackFrameSP GetFrameSP() const
A uniqued constant string class.
Unknown or invalid language value.
lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr, DynamicValueType use_dynamic)
const char * GetCString() const
Get the string value as a C string.
bool GetIncludeStatics() const
ProcessRunLock & GetRunLock()
bool IsInlined()
Return true if this frame represents an inlined function.
lldb::SBCompileUnit GetCompileUnit() const
lldb::addr_t GetCFA() const
void SetIgnoreBreakpoints(bool ignore=true)
lldb::SBLineEntry GetLineEntry() const
lldb::SBThread GetThread() const
lldb::SBValue FindVariable(const char *var_name)
The version that doesn't supply a 'use_dynamic' value will use the target's default.
lldb::addr_t GetSP() const
lldb::SBBlock GetBlock() const
Gets the deepest block that contains the frame PC.
int strcasecmp(const char *s1, const char *s2)
lldb::addr_t GetFP() const
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
void SetFetchDynamicValue(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
#define LIBLLDB_LOG_EXPRESSIONS
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const
lldb::SBModule GetModule() const
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.
void reset(lldb_private::Function *lldb_object_ptr)
lldb::SBSymbol GetSymbol() const
bool GetIncludeArguments() const
Block * block
The Block for a given query.
void Printf(const char *format,...) __attribute__((format(printf
bool SetPC(lldb::addr_t new_pc)
lldb::LanguageType GetLanguage()
Query this frame to determine what the default language should be when parsing expressions given the ...
void reset(lldb_private::Symbol *)
lldb::LanguageType GetLanguage() const
#define LLDB_RECORD_RESULT(Result)
lldb::SBBlock GetFrameBlock() const
Gets the lexical block that defines the stack frame.
lldb::addr_t GetPC() const
This base class provides an interface to stack frames.
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)
void SetUnwindOnError(bool unwind=true)
void SetIncludeStatics(bool)
lldb::TargetSP CalculateTarget() override
void Append(const lldb::SBValue &val_obj)