xref: /freebsd-src/contrib/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h (revision a7dea1671b87c07d2d266f836bfa8b58efc7c134)
1 //===-- DWARFDIE.h ----------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef SymbolFileDWARF_DWARFDIE_h_
10 #define SymbolFileDWARF_DWARFDIE_h_
11 
12 #include "DWARFBaseDIE.h"
13 #include "llvm/ADT/SmallSet.h"
14 
15 class DWARFDIE : public DWARFBaseDIE {
16 public:
17   using DWARFBaseDIE::DWARFBaseDIE;
18 
19   // Tests
20   bool IsStructUnionOrClass() const;
21 
22   bool IsMethod() const;
23 
24   // Accessors
25   lldb::ModuleSP GetContainingDWOModule() const;
26 
27   DWARFDIE
28   GetContainingDWOModuleDIE() const;
29 
30   // Accessing information about a DIE
31   const char *GetMangledName() const;
32 
33   const char *GetPubname() const;
34 
35   const char *GetQualifiedName(std::string &storage) const;
36 
37   using DWARFBaseDIE::GetName;
38   void GetName(lldb_private::Stream &s) const;
39 
40   void AppendTypeName(lldb_private::Stream &s) const;
41 
42   lldb_private::Type *ResolveType() const;
43 
44   // Resolve a type by UID using this DIE's DWARF file
45   lldb_private::Type *ResolveTypeUID(const DWARFDIE &die) const;
46 
47   // Functions for obtaining DIE relations and references
48 
49   DWARFDIE
50   GetParent() const;
51 
52   DWARFDIE
53   GetFirstChild() const;
54 
55   DWARFDIE
56   GetSibling() const;
57 
58   DWARFDIE
59   GetReferencedDIE(const dw_attr_t attr) const;
60 
61   // Get a another DIE from the same DWARF file as this DIE. This will
62   // check the current DIE's compile unit first to see if "die_offset" is
63   // in the same compile unit, and fall back to checking the DWARF file.
64   DWARFDIE
65   GetDIE(dw_offset_t die_offset) const;
66   using DWARFBaseDIE::GetDIE;
67 
68   DWARFDIE
69   LookupDeepestBlock(lldb::addr_t file_addr) const;
70 
71   DWARFDIE
72   GetParentDeclContextDIE() const;
73 
74   // DeclContext related functions
75   std::vector<DWARFDIE> GetDeclContextDIEs() const;
76 
77   void GetDWARFDeclContext(DWARFDeclContext &dwarf_decl_ctx) const;
78 
79   /// Return this DIE's decl context as it is needed to look up types
80   /// in Clang's -gmodules debug info format.
81   void
82   GetDeclContext(std::vector<lldb_private::CompilerContext> &context) const;
83 
84   // Getting attribute values from the DIE.
85   //
86   // GetAttributeValueAsXXX() functions should only be used if you are
87   // looking for one or two attributes on a DIE. If you are trying to
88   // parse all attributes, use GetAttributes (...) instead
89   DWARFDIE
90   GetAttributeValueAsReferenceDIE(const dw_attr_t attr) const;
91 
92   bool GetDIENamesAndRanges(const char *&name, const char *&mangled,
93                             DWARFRangeList &ranges, int &decl_file,
94                             int &decl_line, int &decl_column, int &call_file,
95                             int &call_line, int &call_column,
96                             lldb_private::DWARFExpression *frame_base) const;
97 
98   // CompilerDecl related functions
99 
100   lldb_private::CompilerDecl GetDecl() const;
101 
102   lldb_private::CompilerDeclContext GetDeclContext() const;
103 
104   lldb_private::CompilerDeclContext GetContainingDeclContext() const;
105 };
106 
107 #endif // SymbolFileDWARF_DWARFDIE_h_
108