DWARFDebugAbbrev.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //===-- DWARFDebugAbbrev.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. #ifndef LLVM_LIB_DEBUGINFO_DWARFDEBUGABBREV_H
  10. #define LLVM_LIB_DEBUGINFO_DWARFDEBUGABBREV_H
  11. #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
  12. #include <list>
  13. #include <map>
  14. #include <vector>
  15. namespace llvm {
  16. class DWARFAbbreviationDeclarationSet {
  17. uint32_t Offset;
  18. /// Code of the first abbreviation, if all abbreviations in the set have
  19. /// consecutive codes. UINT32_MAX otherwise.
  20. uint32_t FirstAbbrCode;
  21. std::vector<DWARFAbbreviationDeclaration> Decls;
  22. public:
  23. DWARFAbbreviationDeclarationSet();
  24. uint32_t getOffset() const { return Offset; }
  25. void dump(raw_ostream &OS) const;
  26. bool extract(DataExtractor Data, uint32_t *OffsetPtr);
  27. const DWARFAbbreviationDeclaration *
  28. getAbbreviationDeclaration(uint32_t AbbrCode) const;
  29. private:
  30. void clear();
  31. };
  32. class DWARFDebugAbbrev {
  33. typedef std::map<uint64_t, DWARFAbbreviationDeclarationSet>
  34. DWARFAbbreviationDeclarationSetMap;
  35. DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
  36. mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
  37. public:
  38. DWARFDebugAbbrev();
  39. const DWARFAbbreviationDeclarationSet *
  40. getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const;
  41. void dump(raw_ostream &OS) const;
  42. void extract(DataExtractor Data);
  43. private:
  44. void clear();
  45. };
  46. }
  47. #endif