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) {
360 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext()) {
361 ret_val = reg_ctx_sp->SetPC(new_pc);
374 std::unique_lock<std::recursive_mutex> lock;
379 if (target && process) {
383 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext()) {
384 addr = reg_ctx_sp->GetSP();
397 std::unique_lock<std::recursive_mutex> lock;
402 if (target && process) {
406 if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext()) {
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') {
522 ValueObjectSP value_sp;
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') {
572 ValueObjectSP value_sp;
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;
614 VariableSP variable_sp(
619 sb_value.
SetSP(value_sp, use_dynamic);
627 if (
const RegisterInfo *reg_info =
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) ||
645 llvm::StringRef(reg_set->short_name)
646 .equals_insensitive(name))) {
649 sb_value.
SetSP(value_sp);
659 ExpressionVariableSP expr_var_sp(
662 value_sp = expr_var_sp->GetValueObject();
663 sb_value.
SetSP(value_sp, use_dynamic);
681 lldb::StackFrameSP that_sp = that.
GetFrameSP();
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 for (
const VariableSP &variable_sp : *variable_list) {
819 LLDB_LOG(log,
"Interrupted SBFrame::GetVariables");
823 bool add_variable =
false;
824 switch (variable_sp->GetScope()) {
828 add_variable = statics;
832 add_variable = arguments;
836 add_variable = locals;
844 if (variable_set.find(variable_sp) == variable_set.end())
845 variable_set.insert(variable_sp);
849 if (in_scope_only && !variable_sp->IsInScope(frame))
855 if (!include_runtime_support_values && valobj_sp !=
nullptr &&
856 valobj_sp->IsRuntimeSupportValue())
860 value_sb.
SetSP(valobj_sp, use_dynamic);
861 value_list.
Append(value_sb);
867 if (recognized_arguments) {
869 if (recognized_frame) {
870 ValueObjectListSP recognized_arg_list =
871 recognized_frame->GetRecognizedArguments();
872 if (recognized_arg_list) {
873 for (
auto &rec_value_sp : recognized_arg_list->GetObjects()) {
875 value_sb.
SetSP(rec_value_sp, use_dynamic);
876 value_list.
Append(value_sb);
892 std::unique_lock<std::recursive_mutex> lock;
898 if (target && process) {
905 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
906 for (
uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
922 ValueObjectSP value_sp;
923 std::unique_lock<std::recursive_mutex> lock;
929 if (target && process) {
936 if (
const RegisterInfo *reg_info =
937 reg_ctx->GetRegisterInfoByName(name)) {
939 result.
SetSP(value_sp);
954 std::unique_lock<std::recursive_mutex> lock;
960 if (target && process) {
979 std::unique_lock<std::recursive_mutex> lock;
984 if (frame && target) {
998 error.SetErrorString(
"can't evaluate expressions when the "
999 "process is running.");
1001 result.
SetSP(error_val_sp,
false);
1015 std::unique_lock<std::recursive_mutex> lock;
1029 bool unwind_on_error) {
1033 std::unique_lock<std::recursive_mutex> lock;
1052 Log *expr_log =
GetLog(LLDBLog::Expressions);
1056 if (expr ==
nullptr || expr[0] ==
'\0') {
1060 ValueObjectSP expr_value_sp;
1062 std::unique_lock<std::recursive_mutex> lock;
1069 if (target && process) {
1074 std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1078 stack_trace = std::make_unique<llvm::PrettyStackTraceFormat>(
1079 "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
1090 error.SetErrorString(
"can't evaluate expressions when the "
1091 "process is running.");
1093 expr_result.
SetSP(expr_value_sp,
false);
1097 error.SetErrorString(
"sbframe object is not valid.");
1099 expr_result.
SetSP(expr_value_sp,
false);
1104 "** [SBFrame::EvaluateExpression] Expression result is "
1105 "%s, summary %s **",
1109 "** [SBFrame::EvaluateExpression] Expression evaluation failed: "
1125 std::unique_lock<std::recursive_mutex> lock;
1131 if (target && process) {
1155 std::unique_lock<std::recursive_mutex> lock;
1174 std::unique_lock<std::recursive_mutex> lock;
1180 if (target && process) {
1195 const char *name =
nullptr;
1196 std::unique_lock<std::recursive_mutex> lock;
1202 if (target && process) {
1208 eSymbolContextBlock |
1209 eSymbolContextSymbol));
1212 if (inlined_block) {
1219 if (name ==
nullptr) {
1224 if (name ==
nullptr) {
1237 const char *name =
nullptr;
1239 std::unique_lock<std::recursive_mutex> lock;
1245 if (target && process) {
1251 eSymbolContextBlock |
1252 eSymbolContextSymbol));
1255 if (inlined_block) {
1262 if (name ==
nullptr) {
1267 if (name ==
nullptr) {
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT_VA(...)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#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
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.
A class to manage flag bits.
bool InterruptRequested()
This is the correct way to query the state of Interruption.
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::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.
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::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)
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