diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2022-09-14 10:39:32 +0200 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-09-17 04:00:54 +0000 |
commit | 75673319adf6a9a8e27d6d9da14168b7b04c6baf (patch) | |
tree | 0d21d5e6ee30b456c678f12c42a144d5c68dc38e | |
parent | 7c5e30daaa615ad3a2ef55222423a747ac0a1227 (diff) | |
download | serenity-75673319adf6a9a8e27d6d9da14168b7b04c6baf.zip |
LibDebug: Break inclusion cycle through many forward-declarations
6 files changed, 23 insertions, 6 deletions
diff --git a/Userland/Libraries/LibDebug/Dwarf/CompilationUnit.cpp b/Userland/Libraries/LibDebug/Dwarf/CompilationUnit.cpp index 9bef566e5a..7f206ad63a 100644 --- a/Userland/Libraries/LibDebug/Dwarf/CompilationUnit.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/CompilationUnit.cpp @@ -5,8 +5,10 @@ */ #include "CompilationUnit.h" -#include "DIE.h" #include <AK/ByteReader.h> +#include <LibDebug/Dwarf/DIE.h> +#include <LibDebug/Dwarf/DwarfInfo.h> +#include <LibDebug/Dwarf/LineProgram.h> namespace Debug::Dwarf { @@ -20,6 +22,8 @@ CompilationUnit::CompilationUnit(DwarfInfo const& dwarf_info, u32 offset, Compil VERIFY(header.version() < 5 || header.unit_type() == CompilationUnitType::Full); } +CompilationUnit::~CompilationUnit() = default; + DIE CompilationUnit::root_die() const { return DIE(*this, m_offset + m_header.header_size()); @@ -31,6 +35,11 @@ DIE CompilationUnit::get_die_at_offset(u32 die_offset) const return DIE(*this, die_offset); } +LineProgram const& CompilationUnit::line_program() const +{ + return *m_line_program; +} + Optional<FlatPtr> CompilationUnit::base_address() const { if (m_has_cached_base_address) diff --git a/Userland/Libraries/LibDebug/Dwarf/CompilationUnit.h b/Userland/Libraries/LibDebug/Dwarf/CompilationUnit.h index c67aeb014e..e2157f2517 100644 --- a/Userland/Libraries/LibDebug/Dwarf/CompilationUnit.h +++ b/Userland/Libraries/LibDebug/Dwarf/CompilationUnit.h @@ -7,9 +7,8 @@ #pragma once #include "AbbreviationsMap.h" -#include "DIE.h" -#include "LineProgram.h" #include <AK/Noncopyable.h> +#include <AK/NonnullOwnPtr.h> #include <AK/Types.h> namespace Debug::Dwarf { @@ -24,6 +23,7 @@ class CompilationUnit { public: CompilationUnit(DwarfInfo const& dwarf_info, u32 offset, CompilationUnitHeader const&, NonnullOwnPtr<LineProgram>&& line_program); + ~CompilationUnit(); u32 offset() const { return m_offset; } u32 size() const { return m_header.length() + sizeof(u32); } @@ -38,7 +38,7 @@ public: DwarfInfo const& dwarf_info() const { return m_dwarf_info; } AbbreviationsMap const& abbreviations_map() const { return m_abbreviations; } - LineProgram const& line_program() const { return *m_line_program; } + LineProgram const& line_program() const; Optional<FlatPtr> base_address() const; // DW_AT_addr_base diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp index 23f7596019..466b824b24 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp @@ -31,6 +31,8 @@ DwarfInfo::DwarfInfo(ELF::Image const& elf) populate_compilation_units(); } +DwarfInfo::~DwarfInfo() = default; + ReadonlyBytes DwarfInfo::section_data(StringView section_name) const { auto section = m_elf.lookup_section(section_name); diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h index ac2ec7e2e5..62b6b890ed 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h +++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h @@ -7,7 +7,6 @@ #pragma once #include "AttributeValue.h" -#include "CompilationUnit.h" #include "DwarfTypes.h" #include <AK/ByteBuffer.h> #include <AK/NonnullOwnPtrVector.h> @@ -15,16 +14,20 @@ #include <AK/RedBlackTree.h> #include <AK/RefCounted.h> #include <AK/String.h> +#include <LibDebug/Dwarf/DIE.h> #include <LibELF/Image.h> namespace Debug::Dwarf { +class CompilationUnit; + class DwarfInfo { AK_MAKE_NONCOPYABLE(DwarfInfo); AK_MAKE_NONMOVABLE(DwarfInfo); public: explicit DwarfInfo(ELF::Image const&); + ~DwarfInfo(); ReadonlyBytes debug_info_data() const { return m_debug_info_data; } ReadonlyBytes abbreviation_data() const { return m_abbreviation_data; } diff --git a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp index 09d27bdf7d..29ff19e762 100644 --- a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp @@ -9,6 +9,7 @@ #include <AK/Function.h> #include <AK/String.h> #include <AK/StringBuilder.h> +#include <LibDebug/Dwarf/DwarfInfo.h> namespace Debug::Dwarf { diff --git a/Userland/Libraries/LibDebug/Dwarf/LineProgram.h b/Userland/Libraries/LibDebug/Dwarf/LineProgram.h index 85e5e3ffdc..037b17f7b2 100644 --- a/Userland/Libraries/LibDebug/Dwarf/LineProgram.h +++ b/Userland/Libraries/LibDebug/Dwarf/LineProgram.h @@ -6,13 +6,15 @@ #pragma once -#include "DwarfInfo.h" #include <AK/FlyString.h> #include <AK/MemoryStream.h> #include <AK/Vector.h> +#include <LibDebug/Dwarf/DwarfTypes.h> namespace Debug::Dwarf { +class DwarfInfo; + struct [[gnu::packed]] LineProgramUnitHeader32Common { u32 length; u16 version; |