AbbreviationsMap.h 719 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include "DwarfTypes.h"
  8. #include <AK/HashMap.h>
  9. #include <AK/Optional.h>
  10. #include <AK/Types.h>
  11. namespace Debug::Dwarf {
  12. class DwarfInfo;
  13. class AbbreviationsMap {
  14. public:
  15. AbbreviationsMap(DwarfInfo const& dwarf_info, u32 offset);
  16. struct AbbreviationEntry {
  17. EntryTag tag;
  18. bool has_children;
  19. Vector<AttributeSpecification> attribute_specifications;
  20. };
  21. AbbreviationEntry const* get(u32 code) const;
  22. private:
  23. ErrorOr<void> populate_map();
  24. DwarfInfo const& m_dwarf_info;
  25. u32 m_offset { 0 };
  26. HashMap<u32, AbbreviationEntry> m_entries;
  27. };
  28. }