56#include "llvm/Support/PrettyStackTrace.h"
96 return this->
operator bool();
98SBFrame::operator bool()
const {
101 std::unique_lock<std::recursive_mutex> lock;
106 if (target && process) {
109 return GetFrameSP().get() !=
nullptr;
120 std::unique_lock<std::recursive_mutex> lock;
122 SymbolContextItem scope =
static_cast<SymbolContextItem
>(resolve_scope);
125 if (target && process) {
129 sb_sym_ctx = frame->GetSymbolContext(scope);
141 std::unique_lock<std::recursive_mutex> lock;
147 if (target && process) {
153 sb_module.
SetSP(module_sp);
165 std::unique_lock<std::recursive_mutex> lock;
171 if (target && process) {
189 std::unique_lock<std::recursive_mutex> lock;
195 if (target && process) {
213 std::unique_lock<std::recursive_mutex> lock;
219 if (target && process) {
236 std::unique_lock<std::recursive_mutex> lock;
242 if (target && process) {
257 std::unique_lock<std::recursive_mutex> lock;
263 if (target && process) {
278 std::unique_lock<std::recursive_mutex> lock;
284 if (target && process) {
294 return sb_line_entry;
302 std::unique_lock<std::recursive_mutex> lock;
315 std::unique_lock<std::recursive_mutex> lock;
328 std::unique_lock<std::recursive_mutex> lock;
334 if (target && process) {
340 target, AddressClass::eCode);
351 bool ret_val =
false;
352 std::unique_lock<std::recursive_mutex> lock;
357 if (target && process) {
362 ret_val = reg_ctx_sp->SetPC(new_pc);
375 std::unique_lock<std::recursive_mutex> lock;
380 if (target && process) {
385 addr = reg_ctx_sp->GetSP();
398 std::unique_lock<std::recursive_mutex> lock;
403 if (target && process) {
408 addr = reg_ctx_sp->GetFP();
421 std::unique_lock<std::recursive_mutex> lock;
427 if (target && process) {
448 std::unique_lock<std::recursive_mutex> lock;
453 if (frame && target) {
466 if (var_path ==
nullptr || var_path[0] ==
'\0') {
470 std::unique_lock<std::recursive_mutex> lock;
476 if (target && process) {
488 sb_value.
SetSP(value_sp, use_dynamic);
499 std::unique_lock<std::recursive_mutex> lock;
504 if (frame && target) {
519 if (name ==
nullptr || name[0] ==
'\0') {
524 std::unique_lock<std::recursive_mutex> lock;
530 if (target && process) {
538 sb_value.
SetSP(value_sp, use_dynamic);
550 std::unique_lock<std::recursive_mutex> lock;
555 if (frame && target) {
558 value =
FindValue(name, value_type, use_dynamic);
569 if (name ==
nullptr || name[0] ==
'\0') {
574 std::unique_lock<std::recursive_mutex> lock;
580 if (target && process) {
587 switch (value_type) {
596 const bool can_create =
true;
597 const bool get_parent_variables =
true;
598 const bool stop_if_block_is_inlined_function =
true;
602 can_create, get_parent_variables,
603 stop_if_block_is_inlined_function,
608 const bool get_file_globals =
true;
620 sb_value.
SetSP(value_sp, use_dynamic);
629 reg_ctx->GetRegisterInfoByName(name)) {
631 sb_value.
SetSP(value_sp);
641 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
642 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
643 const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
645 (llvm::StringRef(reg_set->
name).equals_insensitive(name) ||
647 .equals_insensitive(name))) {
650 sb_value.
SetSP(value_sp);
663 value_sp = expr_var_sp->GetValueObject();
664 sb_value.
SetSP(value_sp, use_dynamic);
683 return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
701 std::unique_lock<std::recursive_mutex> lock;
713 std::unique_lock<std::recursive_mutex> lock;
717 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) {
812 if (var_error.
Fail())
813 value_list.
SetError(std::move(var_error));
815 const size_t num_variables = variable_list->
GetSize();
817 size_t num_produced = 0;
818 for (
const VariableSP &variable_sp : *variable_list) {
820 "Interrupted getting frame variables with {0} of {1} "
821 "produced.", num_produced, num_variables))
825 bool add_variable =
false;
826 switch (variable_sp->GetScope()) {
830 add_variable = statics;
834 add_variable = arguments;
838 add_variable = locals;
846 if (variable_set.find(variable_sp) == variable_set.end())
847 variable_set.insert(variable_sp);
851 if (in_scope_only && !variable_sp->IsInScope(frame))
857 if (!include_runtime_support_values && valobj_sp !=
nullptr &&
858 valobj_sp->IsRuntimeSupportValue())
862 value_sb.
SetSP(valobj_sp, use_dynamic);
863 value_list.
Append(value_sb);
870 if (recognized_arguments) {
872 if (recognized_frame) {
874 recognized_frame->GetRecognizedArguments();
875 if (recognized_arg_list) {
876 for (
auto &rec_value_sp : recognized_arg_list->GetObjects()) {
878 value_sb.
SetSP(rec_value_sp, use_dynamic);
879 value_list.
Append(value_sb);
895 std::unique_lock<std::recursive_mutex> lock;
901 if (target && process) {
908 const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
909 for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
926 std::unique_lock<std::recursive_mutex> lock;
932 if (target && process) {
940 reg_ctx->GetRegisterInfoByName(name)) {
942 result.
SetSP(value_sp);
956 std::unique_lock<std::recursive_mutex> lock;
965 error.SetErrorString(
"The provided SBFormat object is invalid");
969 if (target && process) {
979 error.SetErrorStringWithFormat(
980 "It was not possible to generate a frame "
981 "description with the given format string '%s'",
991 std::unique_lock<std::recursive_mutex> lock;
997 if (target && process) {
1016 std::unique_lock<std::recursive_mutex> lock;
1021 if (frame && target) {
1036 "process is running.");
1039 result.
SetSP(error_val_sp,
false);
1053 std::unique_lock<std::recursive_mutex> lock;
1061 if (!language && frame)
1069 bool unwind_on_error) {
1073 std::unique_lock<std::recursive_mutex> lock;
1084 if (!language && frame)
1094 Log *expr_log =
GetLog(LLDBLog::Expressions);
1098 if (expr ==
nullptr || expr[0] ==
'\0') {
1104 std::unique_lock<std::recursive_mutex> lock;
1111 if (target && process) {
1116 std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1120 stack_trace = std::make_unique<llvm::PrettyStackTraceFormat>(
1121 "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
1133 "process is running.");
1135 expr_result.
SetSP(expr_value_sp,
false);
1141 expr_result.
SetSP(expr_value_sp,
false);
1146 "** [SBFrame::EvaluateExpression] Expression result is "
1147 "%s, summary %s **",
1151 "** [SBFrame::EvaluateExpression] Expression evaluation failed: "
1162 std::unique_lock<std::recursive_mutex> lock;
1182 std::unique_lock<std::recursive_mutex> lock;
1188 if (target && process) {
1208 std::unique_lock<std::recursive_mutex> lock;
1212 return frame->IsArtificial();
1220 std::unique_lock<std::recursive_mutex> lock;
1224 return frame->IsHidden();
1238 std::unique_lock<std::recursive_mutex> lock;
1244 if (target && process) {
1259 const char *name =
nullptr;
1260 std::unique_lock<std::recursive_mutex> lock;
1266 if (target && process) {
1280 const char *name =
nullptr;
1282 std::unique_lock<std::recursive_mutex> lock;
1288 if (target && process) {
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.
SBStructuredData GetLanguageSpecificData() const
Language plugins can use this API to report language-specific runtime information about this compile ...
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()
StructuredDataImplUP m_impl_up
void reset(lldb_private::Symbol *)
void Append(const lldb::SBValue &val_obj)
void SetError(lldb_private::Status &&status)
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.
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 * 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.
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
const char * GetFunctionName()
Get the frame's demangled name.
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.
bool IsInlined()
Query whether this frame is a concrete frame on the call stack, or if it is an inlined frame derived ...
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.
StructuredData::ObjectSP GetLanguageSpecificData()
Language plugins can use this API to report language-specific runtime information about this compile ...
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.
const char * GetDisplayFunctionName()
Get the frame's demangled display name.
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
static Status FromErrorString(const char *str)
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.
std::shared_ptr< Object > ObjectSP
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.
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