1 //===-- DWARFDIE.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 SymbolFileDWARF_DWARFDIE_h_
11 #define SymbolFileDWARF_DWARFDIE_h_
13 #include "lldb/lldb-types.h"
14 #include "lldb/Core/dwarf.h"
18 class DWARFAttributes;
19 class DWARFCompileUnit;
20 class DWARFDebugInfoEntry;
21 class DWARFDeclContext;
22 class DWARFDIECollection;
23 class SymbolFileDWARF;
34 DWARFDIE (DWARFCompileUnit *cu, DWARFDebugInfoEntry *die) :
40 DWARFDIE (const DWARFCompileUnit *cu, DWARFDebugInfoEntry *die) :
41 m_cu (const_cast<DWARFCompileUnit *>(cu)),
46 DWARFDIE (DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die) :
48 m_die (const_cast<DWARFDebugInfoEntry *>(die))
52 DWARFDIE (const DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die) :
53 m_cu (const_cast<DWARFCompileUnit *>(cu)),
54 m_die (const_cast<DWARFDebugInfoEntry *>(die))
58 //----------------------------------------------------------------------
60 //----------------------------------------------------------------------
61 explicit operator bool () const
73 IsStructOrClass () const;
79 Supports_DW_AT_APPLE_objc_complete_type () const;
81 //----------------------------------------------------------------------
83 //----------------------------------------------------------------------
102 lldb_private::TypeSystem *
103 GetTypeSystem () const;
106 GetDWARFParser () const;
109 Set (DWARFCompileUnit *cu, DWARFDebugInfoEntry *die)
130 GetContainingDWOModule () const;
133 GetContainingDWOModuleDIE () const;
135 //----------------------------------------------------------------------
136 // Accessing information about a DIE
137 //----------------------------------------------------------------------
142 GetTagAsCString () const;
148 GetCompileUnitRelativeOffset () const;
150 //----------------------------------------------------------------------
151 // Get the LLDB user ID for this DIE. This is often just the DIE offset,
152 // but it might have a SymbolFileDWARF::GetID() in the high 32 bits if
153 // we are doing Darwin DWARF in .o file, or DWARF stand alone debug
155 //----------------------------------------------------------------------
163 GetMangledName () const;
169 GetQualifiedName (std::string &storage) const;
172 GetLanguage () const;
177 lldb_private::CompileUnit *
178 GetLLDBCompileUnit () const;
181 ResolveType () const;
183 //----------------------------------------------------------------------
184 // Resolve a type by UID using this DIE's DWARF file
185 //----------------------------------------------------------------------
187 ResolveTypeUID (const DIERef &die_ref) const;
189 //----------------------------------------------------------------------
190 // Functions for obtaining DIE relations and references
191 //----------------------------------------------------------------------
197 GetFirstChild () const;
203 GetReferencedDIE (const dw_attr_t attr) const;
205 //----------------------------------------------------------------------
206 // Get a another DIE from the same DWARF file as this DIE. This will
207 // check the current DIE's compile unit first to see if "die_offset" is
208 // in the same compile unit, and fall back to checking the DWARF file.
209 //----------------------------------------------------------------------
211 GetDIE (dw_offset_t die_offset) const;
214 LookupDeepestBlock (lldb::addr_t file_addr) const;
217 GetParentDeclContextDIE () const;
219 //----------------------------------------------------------------------
220 // DeclContext related functions
221 //----------------------------------------------------------------------
223 GetDeclContextDIEs (DWARFDIECollection &decl_context_dies) const;
226 GetDWARFDeclContext (DWARFDeclContext &dwarf_decl_ctx) const;
229 GetDWOContext (std::vector<lldb_private::CompilerContext> &context) const;
231 //----------------------------------------------------------------------
232 // Getting attribute values from the DIE.
234 // GetAttributeValueAsXXX() functions should only be used if you are
235 // looking for one or two attributes on a DIE. If you are trying to
236 // parse all attributes, use GetAttributes (...) instead
237 //----------------------------------------------------------------------
239 GetAttributeValueAsString (const dw_attr_t attr, const char *fail_value) const;
242 GetAttributeValueAsUnsigned (const dw_attr_t attr, uint64_t fail_value) const;
245 GetAttributeValueAsSigned (const dw_attr_t attr, int64_t fail_value) const;
248 GetAttributeValueAsReference (const dw_attr_t attr, uint64_t fail_value) const;
251 GetAttributeValueAsReferenceDIE (const dw_attr_t attr) const;
254 GetAttributeValueAsAddress (const dw_attr_t attr, uint64_t fail_value) const;
257 GetAttributes (DWARFAttributes &attributes, uint32_t depth = 0) const;
260 GetDIENamesAndRanges (const char * &name,
261 const char * &mangled,
262 DWARFRangeList& ranges,
269 lldb_private::DWARFExpression *frame_base) const;
271 //----------------------------------------------------------------------
273 //----------------------------------------------------------------------
276 Dump (lldb_private::Stream *s, const uint32_t recurse_depth) const;
278 lldb_private::CompilerDecl
281 lldb_private::CompilerDeclContext
282 GetDeclContext() const;
284 lldb_private::CompilerDeclContext
285 GetContainingDeclContext() const;
288 DWARFCompileUnit *m_cu;
289 DWARFDebugInfoEntry *m_die;
292 bool operator == (const DWARFDIE &lhs, const DWARFDIE &rhs);
293 bool operator != (const DWARFDIE &lhs, const DWARFDIE &rhs);
295 #endif // SymbolFileDWARF_DWARFDIE_h_