LLDB mainline
|
#include <Variable.h>
Public Types | |
typedef RangeVector< lldb::addr_t, lldb::addr_t > | RangeList |
typedef size_t(* | GetVariableCallback) (void *baton, const char *name, VariableList &var_list) |
Public Member Functions | |
Variable (lldb::user_id_t uid, const char *name, const char *mangled, const lldb::SymbolFileTypeSP &symfile_type_sp, lldb::ValueType scope, SymbolContextScope *owner_scope, const RangeList &scope_range, Declaration *decl, const DWARFExpressionList &location, bool external, bool artificial, bool location_is_constant_data, bool static_member=false) | |
Constructors and Destructors. | |
virtual | ~Variable () |
void | Dump (Stream *s, bool show_context) const |
bool | DumpDeclaration (Stream *s, bool show_fullpaths, bool show_module) |
const Declaration & | GetDeclaration () const |
ConstString | GetName () const |
ConstString | GetUnqualifiedName () const |
SymbolContextScope * | GetSymbolContextScope () const |
bool | NameMatches (ConstString name) const |
Since a variable can have a basename "i" and also a mangled named "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous
namespace)::i", this function will allow a generic match function that can be called by commands and expression parsers to make sure we match anything we come across. | |
bool | NameMatches (const RegularExpression ®ex) const |
Type * | GetType () |
lldb::LanguageType | GetLanguage () const |
lldb::ValueType | GetScope () const |
const RangeList & | GetScopeRange () const |
bool | IsExternal () const |
bool | IsArtificial () const |
bool | IsStaticMember () const |
DWARFExpressionList & | LocationExpressionList () |
const DWARFExpressionList & | LocationExpressionList () const |
bool | DumpLocations (Stream *s, const Address &address) |
size_t | MemorySize () const |
void | CalculateSymbolContext (SymbolContext *sc) |
bool | IsInScope (StackFrame *frame) |
bool | LocationIsValidForFrame (StackFrame *frame) |
bool | LocationIsValidForAddress (const Address &address) |
bool | GetLocationIsConstantValueData () const |
void | SetLocationIsConstantValueData (bool b) |
CompilerDeclContext | GetDeclContext () |
CompilerDecl | GetDecl () |
Public Member Functions inherited from lldb_private::UserID | |
UserID (lldb::user_id_t uid=LLDB_INVALID_UID) | |
Construct with optional user ID. | |
~UserID ()=default | |
Destructor. | |
void | Clear () |
Clears the object state. | |
lldb::user_id_t | GetID () const |
Get accessor for the user ID. | |
void | SetID (lldb::user_id_t uid) |
Set accessor for the user ID. | |
Static Public Member Functions | |
static Status | GetValuesForVariableExpressionPath (llvm::StringRef variable_expr_path, ExecutionContextScope *scope, GetVariableCallback callback, void *baton, VariableList &variable_list, ValueObjectList &valobj_list) |
static void | AutoComplete (const ExecutionContext &exe_ctx, CompletionRequest &request) |
Protected Attributes | |
ConstString | m_name |
The basename of the variable (no namespaces). | |
Mangled | m_mangled |
The mangled name of the variable. | |
lldb::SymbolFileTypeSP | m_symfile_type_sp |
The type pointer of the variable (int, struct, class, etc) global, parameter, local. | |
lldb::ValueType | m_scope |
SymbolContextScope * | m_owner_scope |
The symbol file scope that this variable was defined in. | |
RangeList | m_scope_range |
The list of ranges inside the owner's scope where this variable is valid. | |
Declaration | m_declaration |
Declaration location for this item. | |
DWARFExpressionList | m_location_list |
The location of this variable that can be fed to DWARFExpression::Evaluate(). | |
unsigned | m_external: 1 |
Visible outside the containing compile unit? | |
unsigned | m_artificial: 1 |
Non-zero if the variable is not explicitly declared in source. | |
unsigned | m_loc_is_const_data: 1 |
The m_location expression contains the constant variable value data, not a DWARF location. | |
unsigned | m_static_member: 1 |
Non-zero if variable is static member of a class or struct. | |
Protected Attributes inherited from lldb_private::UserID | |
lldb::user_id_t | m_uid |
The user ID that uniquely identifies an object. | |
Private Member Functions | |
Variable (const Variable &rhs)=delete | |
Variable & | operator= (const Variable &rhs)=delete |
Definition at line 25 of file Variable.h.
typedef size_t(* lldb_private::Variable::GetVariableCallback) (void *baton, const char *name, VariableList &var_list) |
Definition at line 100 of file Variable.h.
Definition at line 27 of file Variable.h.
Variable::Variable | ( | lldb::user_id_t | uid, |
const char * | name, | ||
const char * | mangled, | ||
const lldb::SymbolFileTypeSP & | symfile_type_sp, | ||
lldb::ValueType | scope, | ||
SymbolContextScope * | owner_scope, | ||
const RangeList & | scope_range, | ||
Declaration * | decl, | ||
const DWARFExpressionList & | location, | ||
bool | external, | ||
bool | artificial, | ||
bool | location_is_constant_data, | ||
bool | static_member = false |
||
) |
Constructors and Destructors.
mangled | The mangled or fully qualified name of the variable. |
Definition at line 40 of file Variable.cpp.
|
virtualdefault |
|
privatedelete |
|
static |
Definition at line 720 of file Variable.cpp.
References lldb_private::CompletionRequest::GetCursorArgumentPrefix(), lldb_private::ExecutionContext::GetFramePtr(), and PrivateAutoComplete().
Referenced by lldb_private::CommandCompletions::VariablePath().
void Variable::CalculateSymbolContext | ( | SymbolContext * | sc | ) |
Definition at line 208 of file Variable.cpp.
References lldb_private::SymbolContextScope::CalculateSymbolContext(), lldb_private::SymbolContext::Clear(), m_owner_scope, and lldb_private::SymbolContext::variable.
Referenced by DumpLocations(), lldb_private::Value::GetValueAsData(), IsInScope(), LocationIsValidForAddress(), and lldb_private::ValueObjectVariable::UpdateValue().
void Variable::Dump | ( | Stream * | s, |
bool | show_context | ||
) | const |
Definition at line 104 of file Variable.cpp.
References lldb_private::Stream::AsRawOstream(), lldb_private::SymbolContextScope::CalculateSymbolContextModule(), lldb_private::Declaration::Dump(), lldb_private::SymbolContextScope::DumpSymbolContext(), lldb_private::Type::DumpTypeName(), lldb::eDescriptionLevelBrief, lldb_private::Stream::EOL(), lldb::eValueTypeInvalid, lldb::eValueTypeVariableArgument, lldb::eValueTypeVariableGlobal, lldb::eValueTypeVariableLocal, lldb::eValueTypeVariableThreadLocal, lldb_private::ABI::FindPlugin(), lldb_private::Stream::Format(), lldb_private::DWARFExpressionList::GetDescription(), lldb_private::UserID::GetID(), lldb_private::Stream::Indent(), lldb_private::DWARFExpressionList::IsValid(), m_artificial, m_declaration, m_external, m_location_list, m_name, m_owner_scope, m_scope, m_symfile_type_sp, lldb_private::Stream::Printf(), lldb_private::Stream::PutChar(), and lldb_private::Stream::PutCString().
bool Variable::DumpDeclaration | ( | Stream * | s, |
bool | show_fullpaths, | ||
bool | show_module | ||
) |
Definition at line 170 of file Variable.cpp.
References lldb_private::SymbolContext::block, lldb_private::SymbolContextScope::CalculateSymbolContext(), lldb_private::LineEntry::Clear(), lldb_private::Declaration::DumpStopContext(), lldb_private::SymbolContext::DumpStopContext(), lldb_private::SymbolContext::function, lldb_private::SymbolContext::line_entry, m_declaration, m_owner_scope, and lldb_private::Stream::PutChar().
Definition at line 441 of file Variable.cpp.
References CalculateSymbolContext(), lldb_private::SymbolContextScope::CalculateSymbolContextModule(), lldb_private::DWARFExpressionList::DumpLocations(), lldb::eDescriptionLevelBrief, lldb_private::ABI::FindPlugin(), lldb_private::SymbolContext::function, lldb_private::Function::GetAddressRange(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::Address::GetFileAddress(), LLDB_INVALID_ADDRESS, m_location_list, and m_owner_scope.
CompilerDecl Variable::GetDecl | ( | ) |
Definition at line 203 of file Variable.cpp.
References lldb_private::SymbolFile::GetDeclForUID(), lldb_private::UserID::GetID(), lldb_private::Type::GetSymbolFile(), and GetType().
|
inline |
Definition at line 45 of file Variable.h.
References m_declaration.
CompilerDeclContext Variable::GetDeclContext | ( | ) |
Definition at line 196 of file Variable.cpp.
References lldb_private::SymbolFile::GetDeclContextContainingUID(), lldb_private::UserID::GetID(), lldb_private::Type::GetSymbolFile(), and GetType().
lldb::LanguageType Variable::GetLanguage | ( | ) | const |
Definition at line 56 of file Variable.cpp.
References lldb_private::SymbolContextScope::CalculateSymbolContextCompileUnit(), lldb_private::SymbolContextScope::CalculateSymbolContextFunction(), lldb::eLanguageTypeUnknown, lldb_private::Mangled::GuessLanguage(), m_mangled, and m_owner_scope.
Referenced by lldb_private::SymbolContext::GetLanguage().
|
inline |
Definition at line 96 of file Variable.h.
References m_loc_is_const_data.
Referenced by lldb_private::ValueObjectVariable::UpdateValue().
ConstString Variable::GetName | ( | ) | const |
Definition at line 73 of file Variable.cpp.
References lldb_private::Mangled::GetName(), m_mangled, and m_name.
Referenced by lldb_private::SymbolContext::GetDescription(), and lldb_private::Value::GetValueAsData().
|
inline |
Definition at line 66 of file Variable.h.
References m_scope.
Referenced by lldb_private::SymbolContext::GetDescription().
|
inline |
Definition at line 68 of file Variable.h.
References m_scope_range.
Referenced by LocationIsValidForAddress().
|
inline |
Definition at line 51 of file Variable.h.
References m_owner_scope.
Type * Variable::GetType | ( | ) |
Definition at line 98 of file Variable.cpp.
References m_symfile_type_sp.
Referenced by lldb_private::SymbolContext::Dump(), lldb_private::Value::GetCompilerType(), GetDecl(), and GetDeclContext().
ConstString Variable::GetUnqualifiedName | ( | ) | const |
Definition at line 80 of file Variable.cpp.
References m_name.
|
static |
Definition at line 325 of file Variable.cpp.
References lldb_private::ValueObjectList::Append(), lldb_private::VariableList::Clear(), lldb_private::ValueObjectVariable::Create(), error(), lldb_private::RegularExpression::Execute(), lldb_private::Status::Fail(), lldb_private::ValueObjectList::GetSize(), lldb_private::VariableList::GetSize(), lldb_private::ValueObjectList::GetValueObjectAtIndex(), GetValuesForVariableExpressionPath(), lldb_private::VariableList::GetVariableAtIndex(), lldb_private::ValueObjectList::RemoveValueObjectAtIndex(), lldb_private::VariableList::RemoveVariableAtIndex(), and lldb_private::ValueObjectList::SetValueObjectAtIndex().
Referenced by CommandObjectTargetVariable::DoExecute(), and GetValuesForVariableExpressionPath().
|
inline |
Definition at line 72 of file Variable.h.
References m_artificial.
|
inline |
Definition at line 70 of file Variable.h.
References m_external.
bool Variable::IsInScope | ( | StackFrame * | frame | ) |
Definition at line 275 of file Variable.cpp.
References lldb_private::SymbolContext::block, CalculateSymbolContext(), lldb_private::Block::Contains(), lldb::eValueTypeConstResult, lldb::eValueTypeRegister, lldb::eValueTypeRegisterSet, lldb::eValueTypeVariableArgument, lldb::eValueTypeVariableGlobal, lldb::eValueTypeVariableLocal, lldb::eValueTypeVariableStatic, lldb::eValueTypeVariableThreadLocal, lldb_private::RangeVector< B, S, N >::FindEntryThatContains(), lldb_private::Address::GetFileAddress(), lldb_private::StackFrame::GetFrameCodeAddress(), lldb_private::StackFrame::GetSymbolContext(), lldb_private::RangeVector< B, S, N >::IsEmpty(), m_scope, and m_scope_range.
Referenced by lldb::SBFrame::FindValue(), and lldb_private::StackFrame::GetInScopeVariableList().
|
inline |
Definition at line 74 of file Variable.h.
References m_static_member.
|
inline |
Definition at line 76 of file Variable.h.
References m_location_list.
Referenced by lldb_private::ValueObjectVariable::UpdateValue().
|
inline |
Definition at line 78 of file Variable.h.
References m_location_list.
bool Variable::LocationIsValidForAddress | ( | const Address & | address | ) |
Definition at line 239 of file Variable.cpp.
References CalculateSymbolContext(), lldb_private::DWARFExpressionList::ContainsAddress(), lldb_private::RangeVector< B, S, N >::FindEntryThatContains(), lldb_private::SymbolContext::function, lldb_private::Function::GetAddressRange(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::Address::GetFileAddress(), lldb_private::Address::GetModule(), GetScopeRange(), lldb_private::DWARFExpressionList::IsAlwaysValidSingleExpr(), lldb_private::RangeVector< B, S, N >::IsEmpty(), lldb_private::Address::IsSectionOffset(), LLDB_INVALID_ADDRESS, m_location_list, and lldb_private::SymbolContext::module_sp.
Referenced by lldb_private::Address::Dump().
bool Variable::LocationIsValidForFrame | ( | StackFrame * | frame | ) |
Definition at line 216 of file Variable.cpp.
References lldb_private::StackFrame::CalculateTarget(), lldb_private::DWARFExpressionList::ContainsAddress(), lldb_private::SymbolContext::function, lldb_private::Function::GetAddressRange(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::StackFrame::GetFrameCodeAddressForSymbolication(), lldb_private::Address::GetLoadAddress(), lldb_private::StackFrame::GetSymbolContext(), LLDB_INVALID_ADDRESS, and m_location_list.
Referenced by lldb_private::StackFrame::GetInScopeVariableList().
size_t Variable::MemorySize | ( | ) | const |
Definition at line 194 of file Variable.cpp.
bool Variable::NameMatches | ( | const RegularExpression & | regex | ) | const |
Definition at line 90 of file Variable.cpp.
References lldb_private::ConstString::AsCString(), lldb_private::RegularExpression::Execute(), m_mangled, m_name, and lldb_private::Mangled::NameMatches().
bool Variable::NameMatches | ( | ConstString | name | ) | const |
Since a variable can have a basename "i" and also a mangled named "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous namespace)::i", this function will allow a generic match function that can be called by commands and expression parsers to make sure we match anything we come across.
Definition at line 82 of file Variable.cpp.
References lldb_private::SymbolContextScope::CalculateSymbolContext(), m_mangled, m_name, m_owner_scope, and lldb_private::Mangled::NameMatches().
|
inline |
Definition at line 98 of file Variable.h.
References m_loc_is_const_data.
|
protected |
Non-zero if the variable is not explicitly declared in source.
Definition at line 137 of file Variable.h.
Referenced by Dump(), and IsArtificial().
|
protected |
Declaration location for this item.
Definition at line 130 of file Variable.h.
Referenced by Dump(), DumpDeclaration(), and GetDeclaration().
|
protected |
Visible outside the containing compile unit?
Definition at line 135 of file Variable.h.
Referenced by Dump(), and IsExternal().
|
protected |
The m_location expression contains the constant variable value data, not a DWARF location.
Definition at line 140 of file Variable.h.
Referenced by GetLocationIsConstantValueData(), and SetLocationIsConstantValueData().
|
protected |
The location of this variable that can be fed to DWARFExpression::Evaluate().
Definition at line 133 of file Variable.h.
Referenced by Dump(), DumpLocations(), LocationExpressionList(), LocationIsValidForAddress(), and LocationIsValidForFrame().
|
protected |
The mangled name of the variable.
Definition at line 119 of file Variable.h.
Referenced by GetLanguage(), GetName(), and NameMatches().
|
protected |
The basename of the variable (no namespaces).
Definition at line 117 of file Variable.h.
Referenced by Dump(), GetName(), GetUnqualifiedName(), and NameMatches().
|
protected |
The symbol file scope that this variable was defined in.
Definition at line 125 of file Variable.h.
Referenced by CalculateSymbolContext(), Dump(), DumpDeclaration(), DumpLocations(), GetLanguage(), GetSymbolContextScope(), and NameMatches().
|
protected |
Definition at line 123 of file Variable.h.
Referenced by Dump(), GetScope(), and IsInScope().
|
protected |
The list of ranges inside the owner's scope where this variable is valid.
Definition at line 128 of file Variable.h.
Referenced by GetScopeRange(), and IsInScope().
|
protected |
Non-zero if variable is static member of a class or struct.
Definition at line 142 of file Variable.h.
Referenced by IsStaticMember().
|
protected |
The type pointer of the variable (int, struct, class, etc) global, parameter, local.
Definition at line 122 of file Variable.h.