LLVM  14.0.0git
DWARFDebugInfoEntry.h
Go to the documentation of this file.
1 //===- DWARFDebugInfoEntry.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 LLVM_DEBUGINFO_DWARF_DWARFDEBUGINFOENTRY_H
10 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGINFOENTRY_H
11 
15 #include <cstdint>
16 
17 namespace llvm {
18 
19 class DataExtractor;
20 class DWARFUnit;
21 
22 /// DWARFDebugInfoEntry - A DIE with only the minimum required data.
24  /// Offset within the .debug_info of the start of this entry.
25  uint64_t Offset = 0;
26 
27  // FIXME: This could be changed to a parent_idx/sibling_idx based solution
28  // like lldb's that could be used to improve the performance of sibling
29  // iteration. Memory usage is probably acceptable - if it's good enough for
30  // lldb it's probably good enough for llvm-symbolizer, etc.
31  // There's some discussion of this direction in D102634.
32  /// The integer depth of this DIE within the compile unit DIEs where the
33  /// compile/type unit DIE has a depth of zero.
34  uint32_t Depth = 0;
35 
36  const DWARFAbbreviationDeclaration *AbbrevDecl = nullptr;
37 
38 public:
39  DWARFDebugInfoEntry() = default;
40 
41  /// Extracts a debug info entry, which is a child of a given unit,
42  /// starting at a given offset. If DIE can't be extracted, returns false and
43  /// doesn't change OffsetPtr.
44  /// High performance extraction should use this call.
45  bool extractFast(const DWARFUnit &U, uint64_t *OffsetPtr,
46  const DWARFDataExtractor &DebugInfoData, uint64_t UEndOffset,
47  uint32_t Depth);
48 
49  uint64_t getOffset() const { return Offset; }
50  uint32_t getDepth() const { return Depth; }
51 
52  dwarf::Tag getTag() const {
53  return AbbrevDecl ? AbbrevDecl->getTag() : dwarf::DW_TAG_null;
54  }
55 
56  bool hasChildren() const { return AbbrevDecl && AbbrevDecl->hasChildren(); }
57 
59  return AbbrevDecl;
60  }
61 };
62 
63 } // end namespace llvm
64 
65 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGINFOENTRY_H
llvm::DWARFAbbreviationDeclaration::getTag
dwarf::Tag getTag() const
Definition: DWARFAbbreviationDeclaration.h:90
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::Depth
@ Depth
Definition: SIMachineScheduler.h:36
llvm::DWARFDebugInfoEntry::getTag
dwarf::Tag getTag() const
Definition: DWARFDebugInfoEntry.h:52
llvm::DWARFAbbreviationDeclaration::hasChildren
bool hasChildren() const
Definition: DWARFAbbreviationDeclaration.h:91
llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr
const DWARFAbbreviationDeclaration * getAbbreviationDeclarationPtr() const
Definition: DWARFDebugInfoEntry.h:58
llvm::DWARFDebugInfoEntry
DWARFDebugInfoEntry - A DIE with only the minimum required data.
Definition: DWARFDebugInfoEntry.h:23
llvm::DWARFDataExtractor
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
Definition: DWARFDataExtractor.h:21
llvm::dwarf::Tag
Tag
Definition: Dwarf.h:104
llvm::DWARFDebugInfoEntry::extractFast
bool extractFast(const DWARFUnit &U, uint64_t *OffsetPtr, const DWARFDataExtractor &DebugInfoData, uint64_t UEndOffset, uint32_t Depth)
Extracts a debug info entry, which is a child of a given unit, starting at a given offset.
Definition: DWARFDebugInfoEntry.cpp:22
uint64_t
llvm::DWARFDebugInfoEntry::getOffset
uint64_t getOffset() const
Definition: DWARFDebugInfoEntry.h:49
DWARFAbbreviationDeclaration.h
Dwarf.h
uint32_t
llvm::DWARFAbbreviationDeclaration
Definition: DWARFAbbreviationDeclaration.h:27
llvm::DWARFUnit
Definition: DWARFUnit.h:203
llvm::DWARFDebugInfoEntry::DWARFDebugInfoEntry
DWARFDebugInfoEntry()=default
llvm::DWARFDebugInfoEntry::hasChildren
bool hasChildren() const
Definition: DWARFDebugInfoEntry.h:56
llvm::DWARFDebugInfoEntry::getDepth
uint32_t getDepth() const
Definition: DWARFDebugInfoEntry.h:50
DWARFDataExtractor.h