LLDB mainline
lldb_private::Variable Class Reference

#include <Variable.h>

Inheritance diagram for lldb_private::Variable:
[legend]

Public Types

typedef RangeVector< lldb::addr_t, lldb::addr_tRangeList
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, std::optional< uint64_t > tag_offset=std::nullopt)
 Constructors and Destructors.
virtual ~Variable ()
void Dump (Stream *s, bool show_context) const
bool DumpDeclaration (Stream *s, bool show_fullpaths, bool show_module)
const DeclarationGetDeclaration () const
ConstString GetName () const
ConstString GetUnqualifiedName () const
SymbolContextScopeGetSymbolContextScope () 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 &regex) const
TypeGetType ()
lldb::LanguageType GetLanguage () const
lldb::ValueType GetScope () const
const RangeListGetScopeRange () const
bool IsExternal () const
bool IsArtificial () const
bool IsStaticMember () const
DWARFExpressionListLocationExpressionList ()
const DWARFExpressionListLocationExpressionList () const
uint64_t GetTagOffset () const
bool HasTagOffset () const
bool DumpLocations (Stream *s, const Address &address)
size_t MemorySize () const
void CalculateSymbolContext (SymbolContext *sc)
bool IsInScope (StackFrame *frame)
bool IsInScope (const Block &block, const Address &addr)
 Returns true if this variable is in scope at addr inside block.
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
SymbolContextScopem_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.
std::optional< uint64_t > m_tag_offset
 The value of DW_AT_LLVM_tag_offset if present.
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
Variableoperator= (const Variable &rhs)=delete

Detailed Description

Definition at line 25 of file Variable.h.

Member Typedef Documentation

◆ GetVariableCallback

typedef size_t(* lldb_private::Variable::GetVariableCallback) (void *baton, const char *name, VariableList &var_list)

Definition at line 108 of file Variable.h.

◆ RangeList

Constructor & Destructor Documentation

◆ Variable() [1/2]

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,
std::optional< uint64_t > tag_offset = std::nullopt )

Constructors and Destructors.

Parameters
mangledThe mangled or fully qualified name of the variable.

Definition at line 41 of file Variable.cpp.

References lldb_private::TestingProperties::GetGlobalTestingProperties(), m_artificial, m_declaration, m_external, m_loc_is_const_data, m_location_list, m_mangled, m_name, m_owner_scope, m_scope, m_scope_range, m_static_member, m_symfile_type_sp, m_tag_offset, and lldb_private::UserID::UserID().

Referenced by MemorySize(), operator=(), and Variable().

◆ ~Variable()

Variable::~Variable ( )
virtualdefault

◆ Variable() [2/2]

lldb_private::Variable::Variable ( const Variable & rhs)
privatedelete

References Variable().

Member Function Documentation

◆ AutoComplete()

◆ CalculateSymbolContext()

◆ Dump()

◆ DumpDeclaration()

◆ DumpLocations()

◆ GetDecl()

◆ GetDeclaration()

const Declaration & lldb_private::Variable::GetDeclaration ( ) const
inline

Definition at line 46 of file Variable.h.

References m_declaration.

◆ GetDeclContext()

◆ GetLanguage()

lldb::LanguageType Variable::GetLanguage ( ) const

Definition at line 64 of file Variable.cpp.

References lldb::eLanguageTypeUnknown, m_mangled, and m_owner_scope.

◆ GetLocationIsConstantValueData()

bool lldb_private::Variable::GetLocationIsConstantValueData ( ) const
inline

Definition at line 104 of file Variable.h.

References m_loc_is_const_data.

Referenced by lldb_private::ValueObjectVariable::UpdateValue().

◆ GetName()

ConstString Variable::GetName ( ) const

Definition at line 81 of file Variable.cpp.

References m_mangled, and m_name.

Referenced by lldb_private::Value::GetValueAsData().

◆ GetScope()

lldb::ValueType lldb_private::Variable::GetScope ( ) const
inline

Definition at line 67 of file Variable.h.

References m_scope.

Referenced by IsInRequestedScope().

◆ GetScopeRange()

const RangeList & lldb_private::Variable::GetScopeRange ( ) const
inline

Definition at line 69 of file Variable.h.

References m_scope_range.

Referenced by LocationIsValidForAddress().

◆ GetSymbolContextScope()

SymbolContextScope * lldb_private::Variable::GetSymbolContextScope ( ) const
inline

Definition at line 52 of file Variable.h.

References m_owner_scope.

◆ GetTagOffset()

uint64_t lldb_private::Variable::GetTagOffset ( ) const
inline

Definition at line 83 of file Variable.h.

References m_tag_offset.

◆ GetType()

Type * Variable::GetType ( )

Definition at line 106 of file Variable.cpp.

References m_symfile_type_sp.

Referenced by lldb_private::Value::GetCompilerType(), GetDecl(), and GetDeclContext().

◆ GetUnqualifiedName()

ConstString Variable::GetUnqualifiedName ( ) const

Definition at line 88 of file Variable.cpp.

References m_name.

◆ GetValuesForVariableExpressionPath()

◆ HasTagOffset()

bool lldb_private::Variable::HasTagOffset ( ) const
inline

Definition at line 85 of file Variable.h.

References m_tag_offset.

◆ IsArtificial()

bool lldb_private::Variable::IsArtificial ( ) const
inline

Definition at line 73 of file Variable.h.

References m_artificial.

◆ IsExternal()

bool lldb_private::Variable::IsExternal ( ) const
inline

Definition at line 71 of file Variable.h.

References m_external.

◆ IsInScope() [1/2]

bool Variable::IsInScope ( const Block & block,
const Address & addr )

Returns true if this variable is in scope at addr inside block.

Definition at line 313 of file Variable.cpp.

References lldb_private::SymbolContext::block, CalculateSymbolContext(), lldb_private::Block::Contains(), lldb_private::Address::GetFileAddress(), and m_scope_range.

◆ IsInScope() [2/2]

◆ IsStaticMember()

bool lldb_private::Variable::IsStaticMember ( ) const
inline

Definition at line 75 of file Variable.h.

References m_static_member.

◆ LocationExpressionList() [1/2]

DWARFExpressionList & lldb_private::Variable::LocationExpressionList ( )
inline

Definition at line 77 of file Variable.h.

References m_location_list.

Referenced by lldb_private::ValueObjectVariable::UpdateValue().

◆ LocationExpressionList() [2/2]

const DWARFExpressionList & lldb_private::Variable::LocationExpressionList ( ) const
inline

Definition at line 79 of file Variable.h.

References m_location_list.

◆ LocationIsValidForAddress()

◆ LocationIsValidForFrame()

◆ MemorySize()

size_t Variable::MemorySize ( ) const

Definition at line 202 of file Variable.cpp.

References Variable().

◆ NameMatches() [1/2]

bool Variable::NameMatches ( const RegularExpression & regex) const

Definition at line 98 of file Variable.cpp.

References lldb_private::RegularExpression::Execute(), m_mangled, and m_name.

◆ NameMatches() [2/2]

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 90 of file Variable.cpp.

References m_mangled, m_name, and m_owner_scope.

◆ operator=()

Variable & lldb_private::Variable::operator= ( const Variable & rhs)
privatedelete

References Variable().

◆ SetLocationIsConstantValueData()

void lldb_private::Variable::SetLocationIsConstantValueData ( bool b)
inline

Definition at line 106 of file Variable.h.

References m_loc_is_const_data.

Member Data Documentation

◆ m_artificial

unsigned lldb_private::Variable::m_artificial
protected

Non-zero if the variable is not explicitly declared in source.

Definition at line 145 of file Variable.h.

Referenced by Dump(), IsArtificial(), and Variable().

◆ m_declaration

Declaration lldb_private::Variable::m_declaration
protected

Declaration location for this item.

Definition at line 138 of file Variable.h.

Referenced by Dump(), DumpDeclaration(), GetDeclaration(), and Variable().

◆ m_external

unsigned lldb_private::Variable::m_external
protected

Visible outside the containing compile unit?

Definition at line 143 of file Variable.h.

Referenced by Dump(), IsExternal(), and Variable().

◆ m_loc_is_const_data

unsigned lldb_private::Variable::m_loc_is_const_data
protected

The m_location expression contains the constant variable value data, not a DWARF location.

Definition at line 148 of file Variable.h.

Referenced by GetLocationIsConstantValueData(), SetLocationIsConstantValueData(), and Variable().

◆ m_location_list

DWARFExpressionList lldb_private::Variable::m_location_list
protected

The location of this variable that can be fed to DWARFExpression::Evaluate().

Definition at line 141 of file Variable.h.

Referenced by Dump(), DumpLocations(), LocationExpressionList(), LocationExpressionList(), LocationIsValidForAddress(), LocationIsValidForFrame(), and Variable().

◆ m_mangled

Mangled lldb_private::Variable::m_mangled
protected

The mangled name of the variable.

Definition at line 127 of file Variable.h.

Referenced by GetLanguage(), GetName(), NameMatches(), NameMatches(), and Variable().

◆ m_name

ConstString lldb_private::Variable::m_name
protected

The basename of the variable (no namespaces).

Definition at line 125 of file Variable.h.

Referenced by Dump(), GetName(), GetUnqualifiedName(), NameMatches(), NameMatches(), and Variable().

◆ m_owner_scope

SymbolContextScope* lldb_private::Variable::m_owner_scope
protected

The symbol file scope that this variable was defined in.

Definition at line 133 of file Variable.h.

Referenced by CalculateSymbolContext(), Dump(), DumpDeclaration(), DumpLocations(), GetLanguage(), GetSymbolContextScope(), NameMatches(), and Variable().

◆ m_scope

lldb::ValueType lldb_private::Variable::m_scope
protected

Definition at line 131 of file Variable.h.

Referenced by Dump(), GetScope(), IsInScope(), and Variable().

◆ m_scope_range

RangeList lldb_private::Variable::m_scope_range
protected

The list of ranges inside the owner's scope where this variable is valid.

Definition at line 136 of file Variable.h.

Referenced by GetScopeRange(), IsInScope(), and Variable().

◆ m_static_member

unsigned lldb_private::Variable::m_static_member
protected

Non-zero if variable is static member of a class or struct.

Definition at line 150 of file Variable.h.

Referenced by IsStaticMember(), and Variable().

◆ m_symfile_type_sp

lldb::SymbolFileTypeSP lldb_private::Variable::m_symfile_type_sp
protected

The type pointer of the variable (int, struct, class, etc) global, parameter, local.

Definition at line 130 of file Variable.h.

Referenced by Dump(), GetType(), and Variable().

◆ m_tag_offset

std::optional<uint64_t> lldb_private::Variable::m_tag_offset
protected

The value of DW_AT_LLVM_tag_offset if present.

Definition at line 152 of file Variable.h.

Referenced by GetTagOffset(), HasTagOffset(), and Variable().


The documentation for this class was generated from the following files: