]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
Merge OpenSSL 1.0.2h.
[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 <vector>
14 #include <map>
15
16 #include "lldb/lldb-private.h"
17 #include "lldb/lldb-private.h"
18 #include "SymbolFileDWARF.h"
19 #include "DWARFDIE.h"
20
21 typedef std::multimap<const char*, dw_offset_t, CStringCompareFunctionObject> CStringToDIEMap;
22 typedef CStringToDIEMap::iterator CStringToDIEMapIter;
23 typedef CStringToDIEMap::const_iterator CStringToDIEMapConstIter;
24
25 class DWARFDebugInfo
26 {
27 public:
28     typedef dw_offset_t (*Callback)(
29         SymbolFileDWARF* dwarf2Data,
30         DWARFCompileUnit* cu,
31         DWARFDebugInfoEntry* die,
32         const dw_offset_t next_offset,
33         const uint32_t depth,
34         void* userData);
35
36     DWARFDebugInfo();
37     void SetDwarfData(SymbolFileDWARF* dwarf2Data);
38
39     size_t GetNumCompileUnits();
40     bool ContainsCompileUnit (const DWARFCompileUnit *cu) const;
41     DWARFCompileUnit* GetCompileUnitAtIndex (uint32_t idx);
42     DWARFCompileUnit* GetCompileUnit (dw_offset_t cu_offset, uint32_t* idx_ptr = NULL);
43     DWARFCompileUnit* GetCompileUnitContainingDIE (const DIERef& die_ref);
44
45     DWARFDIE GetDIE (const DIERef& die_ref);
46
47     void Dump(lldb_private::Stream *s, const uint32_t die_offset, const uint32_t recurse_depth);
48     static void Parse(SymbolFileDWARF* parser, Callback callback, void* userData);
49     static void Verify(lldb_private::Stream *s, SymbolFileDWARF* dwarf2Data);
50     static void Dump(lldb_private::Stream *s, SymbolFileDWARF* dwarf2Data, const uint32_t die_offset, const uint32_t recurse_depth);
51     bool Find(const char* name, bool ignore_case, std::vector<dw_offset_t>& die_offsets) const;
52     bool Find(lldb_private::RegularExpression& re, std::vector<dw_offset_t>& die_offsets) const;
53
54     enum
55     {
56         eDumpFlag_Verbose               = (1<<0),   // Verbose dumping
57         eDumpFlag_ShowForm              = (1<<1),   // Show the DW_form type
58         eDumpFlag_ShowAncestors         = (1<<2)    // Show all parent DIEs when dumping single DIEs
59     };
60
61     DWARFDebugAranges &
62     GetCompileUnitAranges ();
63
64 protected:
65     typedef std::shared_ptr<DWARFCompileUnit> DWARFCompileUnitSP;
66
67     static bool
68     OffsetLessThanCompileUnitOffset (dw_offset_t offset, const DWARFCompileUnitSP& cu_sp);
69
70     typedef std::vector<DWARFCompileUnitSP>     CompileUnitColl;
71
72     //----------------------------------------------------------------------
73     // Member variables
74     //----------------------------------------------------------------------
75     SymbolFileDWARF* m_dwarf2Data;
76     CompileUnitColl m_compile_units;
77     std::unique_ptr<DWARFDebugAranges> m_cu_aranges_ap; // A quick address to compile unit table
78
79 private:
80     // All parsing needs to be done partially any managed by this class as accessors are called.
81     void ParseCompileUnitHeadersIfNeeded();
82
83     DISALLOW_COPY_AND_ASSIGN (DWARFDebugInfo);
84 };
85
86 #endif  // SymbolFileDWARF_DWARFDebugInfo_h_