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 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 // Resolve a type by UID using this DIE's DWARF file
185 ResolveTypeUID (lldb::user_id_t uid) const;
187 //----------------------------------------------------------------------
188 // Functions for obtaining DIE relations and references
189 //----------------------------------------------------------------------
195 GetFirstChild () const;
201 GetReferencedDIE (const dw_attr_t attr) const;
203 //----------------------------------------------------------------------
204 // Get a another DIE from the same DWARF file as this DIE. This will
205 // check the current DIE's compile unit first to see if "die_offset" is
206 // in the same compile unit, and fall back to checking the DWARF file.
207 //----------------------------------------------------------------------
209 GetDIE (dw_offset_t die_offset) const;
212 LookupDeepestBlock (lldb::addr_t file_addr) const;
215 GetParentDeclContextDIE () const;
217 //----------------------------------------------------------------------
218 // DeclContext related functions
219 //----------------------------------------------------------------------
221 GetDeclContextDIEs (DWARFDIECollection &decl_context_dies) const;
224 GetDWARFDeclContext (DWARFDeclContext &dwarf_decl_ctx) const;
227 GetDWOContext (std::vector<lldb_private::CompilerContext> &context) const;
229 //----------------------------------------------------------------------
230 // Getting attribute values from the DIE.
232 // GetAttributeValueAsXXX() functions should only be used if you are
233 // looking for one or two attributes on a DIE. If you are trying to
234 // parse all attributes, use GetAttributes (...) instead
235 //----------------------------------------------------------------------
237 GetAttributeValueAsString (const dw_attr_t attr, const char *fail_value) const;
240 GetAttributeValueAsUnsigned (const dw_attr_t attr, uint64_t fail_value) const;
243 GetAttributeValueAsSigned (const dw_attr_t attr, int64_t fail_value) const;
246 GetAttributeValueAsReference (const dw_attr_t attr, uint64_t fail_value) const;
249 GetAttributeValueAsAddress (const dw_attr_t attr, uint64_t fail_value) const;
252 GetAttributes (DWARFAttributes &attributes, uint32_t depth = 0) const;
255 GetDIENamesAndRanges (const char * &name,
256 const char * &mangled,
257 DWARFRangeList& ranges,
264 lldb_private::DWARFExpression *frame_base) const;
266 //----------------------------------------------------------------------
268 //----------------------------------------------------------------------
271 Dump (lldb_private::Stream *s, const uint32_t recurse_depth) const;
274 DWARFCompileUnit *m_cu;
275 DWARFDebugInfoEntry *m_die;
278 bool operator == (const DWARFDIE &lhs, const DWARFDIE &rhs);
279 bool operator != (const DWARFDIE &lhs, const DWARFDIE &rhs);
281 #endif // SymbolFileDWARF_DWARFDIE_h_