1 //===-- Variable.h ----------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_Variable_h_
11 #define liblldb_Variable_h_
15 #include "lldb/lldb-private.h"
16 #include "lldb/lldb-enumerations.h"
17 #include "lldb/Core/Mangled.h"
18 #include "lldb/Core/UserID.h"
19 #include "lldb/Expression/DWARFExpression.h"
20 #include "lldb/Symbol/Declaration.h"
22 namespace lldb_private {
24 class Variable : public UserID
27 //------------------------------------------------------------------
28 // Constructors and Destructors
29 //------------------------------------------------------------------
30 Variable (lldb::user_id_t uid,
32 const char *mangled, // The mangled variable name for variables in namespaces
33 const lldb::SymbolFileTypeSP &symfile_type_sp,
34 lldb::ValueType scope,
35 SymbolContextScope *owner_scope,
37 const DWARFExpression& location,
45 Dump(Stream *s, bool show_context) const;
48 DumpDeclaration (Stream *s,
53 GetDeclaration() const
62 GetSymbolContextScope() const
67 // Since a variable can have a basename "i" and also a mangled
68 // named "_ZN12_GLOBAL__N_11iE" and a demangled mangled name
69 // "(anonymous namespace)::i", this function will allow a generic match
70 // function that can be called by commands and expression parsers to make
71 // sure we match anything we come across.
73 NameMatches (const ConstString &name) const
77 return m_mangled.NameMatches (name);
81 NameMatches (const RegularExpression& regex) const;
110 const DWARFExpression &
111 LocationExpression() const
117 DumpLocationForAddress (Stream *s,
118 const Address &address);
124 CalculateSymbolContext (SymbolContext *sc);
127 IsInScope (StackFrame *frame);
130 LocationIsValidForFrame (StackFrame *frame);
133 LocationIsValidForAddress (const Address &address);
136 GetLocationIsConstantValueData () const
138 return m_loc_is_const_data;
142 SetLocationIsConstantValueData (bool b)
144 m_loc_is_const_data = b;
147 typedef size_t (*GetVariableCallback) (void *baton,
149 VariableList &var_list);
153 GetValuesForVariableExpressionPath (const char *variable_expr_path,
154 ExecutionContextScope *scope,
155 GetVariableCallback callback,
157 VariableList &variable_list,
158 ValueObjectList &valobj_list);
161 AutoComplete (const ExecutionContext &exe_ctx,
164 bool &word_complete);
167 ConstString m_name; // The basename of the variable (no namespaces)
168 Mangled m_mangled; // The mangled name of the variable
169 lldb::SymbolFileTypeSP m_symfile_type_sp; // The type pointer of the variable (int, struct, class, etc)
170 lldb::ValueType m_scope; // global, parameter, local
171 SymbolContextScope *m_owner_scope; // The symbol file scope that this variable was defined in
172 Declaration m_declaration; // Declaration location for this item.
173 DWARFExpression m_location; // The location of this variable that can be fed to DWARFExpression::Evaluate()
174 uint8_t m_external:1, // Visible outside the containing compile unit?
175 m_artificial:1, // Non-zero if the variable is not explicitly declared in source
176 m_loc_is_const_data:1; // The m_location expression contains the constant variable value data, not a DWARF location
178 Variable(const Variable& rhs);
179 Variable& operator=(const Variable& rhs);
182 } // namespace lldb_private
184 #endif // liblldb_Variable_h_