CompilationUnit.cpp 620 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include "CompilationUnit.h"
  7. #include "DIE.h"
  8. namespace Debug::Dwarf {
  9. CompilationUnit::CompilationUnit(const DwarfInfo& dwarf_info, u32 offset, const CompilationUnitHeader& header)
  10. : m_dwarf_info(dwarf_info)
  11. , m_offset(offset)
  12. , m_header(header)
  13. , m_abbreviations(dwarf_info, header.abbrev_offset())
  14. {
  15. VERIFY(header.version() < 5 || header.unit_type() == CompilationUnitType::Full);
  16. }
  17. DIE CompilationUnit::root_die() const
  18. {
  19. return DIE(*this, m_offset + m_header.header_size());
  20. }
  21. }