DWARFGdbIndex.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- DWARFGdbIndex.h ------------------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_DEBUGINFO_DWARF_DWARFGDBINDEX_H
  14. #define LLVM_DEBUGINFO_DWARF_DWARFGDBINDEX_H
  15. #include "llvm/ADT/SmallVector.h"
  16. #include "llvm/ADT/StringRef.h"
  17. #include "llvm/Support/DataExtractor.h"
  18. #include <cstdint>
  19. #include <utility>
  20. namespace llvm {
  21. class raw_ostream;
  22. class DWARFGdbIndex {
  23. uint32_t Version;
  24. uint32_t CuListOffset;
  25. uint32_t TuListOffset;
  26. uint32_t AddressAreaOffset;
  27. uint32_t SymbolTableOffset;
  28. uint32_t ConstantPoolOffset;
  29. struct CompUnitEntry {
  30. uint64_t Offset; /// Offset of a CU in the .debug_info section.
  31. uint64_t Length; /// Length of that CU.
  32. };
  33. SmallVector<CompUnitEntry, 0> CuList;
  34. struct TypeUnitEntry {
  35. uint64_t Offset;
  36. uint64_t TypeOffset;
  37. uint64_t TypeSignature;
  38. };
  39. SmallVector<TypeUnitEntry, 0> TuList;
  40. struct AddressEntry {
  41. uint64_t LowAddress; /// The low address.
  42. uint64_t HighAddress; /// The high address.
  43. uint32_t CuIndex; /// The CU index.
  44. };
  45. SmallVector<AddressEntry, 0> AddressArea;
  46. struct SymTableEntry {
  47. uint32_t NameOffset; /// Offset of the symbol's name in the constant pool.
  48. uint32_t VecOffset; /// Offset of the CU vector in the constant pool.
  49. };
  50. SmallVector<SymTableEntry, 0> SymbolTable;
  51. /// Each value is CU index + attributes.
  52. SmallVector<std::pair<uint32_t, SmallVector<uint32_t, 0>>, 0>
  53. ConstantPoolVectors;
  54. StringRef ConstantPoolStrings;
  55. uint32_t StringPoolOffset;
  56. void dumpCUList(raw_ostream &OS) const;
  57. void dumpTUList(raw_ostream &OS) const;
  58. void dumpAddressArea(raw_ostream &OS) const;
  59. void dumpSymbolTable(raw_ostream &OS) const;
  60. void dumpConstantPool(raw_ostream &OS) const;
  61. bool parseImpl(DataExtractor Data);
  62. public:
  63. void dump(raw_ostream &OS);
  64. void parse(DataExtractor Data);
  65. bool HasContent = false;
  66. bool HasError = false;
  67. };
  68. } // end namespace llvm
  69. #endif // LLVM_DEBUGINFO_DWARF_DWARFGDBINDEX_H
  70. #ifdef __GNUC__
  71. #pragma GCC diagnostic pop
  72. #endif