]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
MFV r336950: 9290 device removal reduces redundancy of mirrors
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / SymbolFile / DWARF / DWARFDebugInfo.h
1 //===-- DWARFDebugInfo.h ----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef SymbolFileDWARF_DWARFDebugInfo_h_
11 #define SymbolFileDWARF_DWARFDebugInfo_h_
12
13 #include <map>
14 #include <vector>
15
16 #include "DWARFDIE.h"
17 #include "SymbolFileDWARF.h"
18 #include "lldb/Core/STLUtils.h"
19 #include "lldb/lldb-private.h"
20
21 typedef std::multimap<const char *, dw_offset_t, CStringCompareFunctionObject>
22     CStringToDIEMap;
23 typedef CStringToDIEMap::iterator CStringToDIEMapIter;
24 typedef CStringToDIEMap::const_iterator CStringToDIEMapConstIter;
25
26 class DWARFDebugInfo {
27 public:
28   typedef dw_offset_t (*Callback)(SymbolFileDWARF *dwarf2Data,
29                                   DWARFCompileUnit *cu,
30                                   DWARFDebugInfoEntry *die,
31                                   const dw_offset_t next_offset,
32                                   const uint32_t depth, void *userData);
33
34   DWARFDebugInfo();
35   void SetDwarfData(SymbolFileDWARF *dwarf2Data);
36
37   size_t GetNumCompileUnits();
38   bool ContainsCompileUnit(const DWARFCompileUnit *cu) const;
39   DWARFCompileUnit *GetCompileUnitAtIndex(uint32_t idx);
40   DWARFCompileUnit *GetCompileUnit(dw_offset_t cu_offset,
41                                    uint32_t *idx_ptr = NULL);
42   DWARFCompileUnit *GetCompileUnitContainingDIEOffset(dw_offset_t die_offset);
43   DWARFCompileUnit *GetCompileUnit(const DIERef &die_ref);
44   DWARFDIE GetDIEForDIEOffset(dw_offset_t die_offset);
45   DWARFDIE GetDIE(const DIERef &die_ref);
46
47   void Dump(lldb_private::Stream *s, const uint32_t die_offset,
48             const uint32_t recurse_depth);
49   static void Parse(SymbolFileDWARF *parser, Callback callback, void *userData);
50   static void Verify(lldb_private::Stream *s, SymbolFileDWARF *dwarf2Data);
51   static void Dump(lldb_private::Stream *s, SymbolFileDWARF *dwarf2Data,
52                    const uint32_t die_offset, const uint32_t recurse_depth);
53
54   enum {
55     eDumpFlag_Verbose = (1 << 0),  // Verbose dumping
56     eDumpFlag_ShowForm = (1 << 1), // Show the DW_form type
57     eDumpFlag_ShowAncestors =
58         (1 << 2) // Show all parent DIEs when dumping single DIEs
59   };
60
61   DWARFDebugAranges &GetCompileUnitAranges();
62
63 protected:
64   static bool OffsetLessThanCompileUnitOffset(dw_offset_t offset,
65                                               const DWARFCompileUnitSP &cu_sp);
66
67   typedef std::vector<DWARFCompileUnitSP> CompileUnitColl;
68
69   //----------------------------------------------------------------------
70   // Member variables
71   //----------------------------------------------------------------------
72   SymbolFileDWARF *m_dwarf2Data;
73   CompileUnitColl m_compile_units;
74   std::unique_ptr<DWARFDebugAranges>
75       m_cu_aranges_ap; // A quick address to compile unit table
76
77 private:
78   // All parsing needs to be done partially any managed by this class as
79   // accessors are called.
80   void ParseCompileUnitHeadersIfNeeded();
81
82   DISALLOW_COPY_AND_ASSIGN(DWARFDebugInfo);
83 };
84
85 #endif // SymbolFileDWARF_DWARFDebugInfo_h_