mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:37:43 +00:00
LibDebug: Break inclusion cycle through many forward-declarations
This commit is contained in:
parent
7c5e30daaa
commit
75673319ad
6 changed files with 23 additions and 6 deletions
|
@ -5,8 +5,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CompilationUnit.h"
|
#include "CompilationUnit.h"
|
||||||
#include "DIE.h"
|
|
||||||
#include <AK/ByteReader.h>
|
#include <AK/ByteReader.h>
|
||||||
|
#include <LibDebug/Dwarf/DIE.h>
|
||||||
|
#include <LibDebug/Dwarf/DwarfInfo.h>
|
||||||
|
#include <LibDebug/Dwarf/LineProgram.h>
|
||||||
|
|
||||||
namespace Debug::Dwarf {
|
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);
|
VERIFY(header.version() < 5 || header.unit_type() == CompilationUnitType::Full);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CompilationUnit::~CompilationUnit() = default;
|
||||||
|
|
||||||
DIE CompilationUnit::root_die() const
|
DIE CompilationUnit::root_die() const
|
||||||
{
|
{
|
||||||
return DIE(*this, m_offset + m_header.header_size());
|
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);
|
return DIE(*this, die_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LineProgram const& CompilationUnit::line_program() const
|
||||||
|
{
|
||||||
|
return *m_line_program;
|
||||||
|
}
|
||||||
|
|
||||||
Optional<FlatPtr> CompilationUnit::base_address() const
|
Optional<FlatPtr> CompilationUnit::base_address() const
|
||||||
{
|
{
|
||||||
if (m_has_cached_base_address)
|
if (m_has_cached_base_address)
|
||||||
|
|
|
@ -7,9 +7,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "AbbreviationsMap.h"
|
#include "AbbreviationsMap.h"
|
||||||
#include "DIE.h"
|
|
||||||
#include "LineProgram.h"
|
|
||||||
#include <AK/Noncopyable.h>
|
#include <AK/Noncopyable.h>
|
||||||
|
#include <AK/NonnullOwnPtr.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
|
|
||||||
namespace Debug::Dwarf {
|
namespace Debug::Dwarf {
|
||||||
|
@ -24,6 +23,7 @@ class CompilationUnit {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CompilationUnit(DwarfInfo const& dwarf_info, u32 offset, CompilationUnitHeader const&, NonnullOwnPtr<LineProgram>&& line_program);
|
CompilationUnit(DwarfInfo const& dwarf_info, u32 offset, CompilationUnitHeader const&, NonnullOwnPtr<LineProgram>&& line_program);
|
||||||
|
~CompilationUnit();
|
||||||
|
|
||||||
u32 offset() const { return m_offset; }
|
u32 offset() const { return m_offset; }
|
||||||
u32 size() const { return m_header.length() + sizeof(u32); }
|
u32 size() const { return m_header.length() + sizeof(u32); }
|
||||||
|
@ -38,7 +38,7 @@ public:
|
||||||
|
|
||||||
DwarfInfo const& dwarf_info() const { return m_dwarf_info; }
|
DwarfInfo const& dwarf_info() const { return m_dwarf_info; }
|
||||||
AbbreviationsMap const& abbreviations_map() const { return m_abbreviations; }
|
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;
|
Optional<FlatPtr> base_address() const;
|
||||||
|
|
||||||
// DW_AT_addr_base
|
// DW_AT_addr_base
|
||||||
|
|
|
@ -31,6 +31,8 @@ DwarfInfo::DwarfInfo(ELF::Image const& elf)
|
||||||
populate_compilation_units();
|
populate_compilation_units();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DwarfInfo::~DwarfInfo() = default;
|
||||||
|
|
||||||
ReadonlyBytes DwarfInfo::section_data(StringView section_name) const
|
ReadonlyBytes DwarfInfo::section_data(StringView section_name) const
|
||||||
{
|
{
|
||||||
auto section = m_elf.lookup_section(section_name);
|
auto section = m_elf.lookup_section(section_name);
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "AttributeValue.h"
|
#include "AttributeValue.h"
|
||||||
#include "CompilationUnit.h"
|
|
||||||
#include "DwarfTypes.h"
|
#include "DwarfTypes.h"
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/NonnullOwnPtrVector.h>
|
#include <AK/NonnullOwnPtrVector.h>
|
||||||
|
@ -15,16 +14,20 @@
|
||||||
#include <AK/RedBlackTree.h>
|
#include <AK/RedBlackTree.h>
|
||||||
#include <AK/RefCounted.h>
|
#include <AK/RefCounted.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
|
#include <LibDebug/Dwarf/DIE.h>
|
||||||
#include <LibELF/Image.h>
|
#include <LibELF/Image.h>
|
||||||
|
|
||||||
namespace Debug::Dwarf {
|
namespace Debug::Dwarf {
|
||||||
|
|
||||||
|
class CompilationUnit;
|
||||||
|
|
||||||
class DwarfInfo {
|
class DwarfInfo {
|
||||||
AK_MAKE_NONCOPYABLE(DwarfInfo);
|
AK_MAKE_NONCOPYABLE(DwarfInfo);
|
||||||
AK_MAKE_NONMOVABLE(DwarfInfo);
|
AK_MAKE_NONMOVABLE(DwarfInfo);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DwarfInfo(ELF::Image const&);
|
explicit DwarfInfo(ELF::Image const&);
|
||||||
|
~DwarfInfo();
|
||||||
|
|
||||||
ReadonlyBytes debug_info_data() const { return m_debug_info_data; }
|
ReadonlyBytes debug_info_data() const { return m_debug_info_data; }
|
||||||
ReadonlyBytes abbreviation_data() const { return m_abbreviation_data; }
|
ReadonlyBytes abbreviation_data() const { return m_abbreviation_data; }
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
|
#include <LibDebug/Dwarf/DwarfInfo.h>
|
||||||
|
|
||||||
namespace Debug::Dwarf {
|
namespace Debug::Dwarf {
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,15 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "DwarfInfo.h"
|
|
||||||
#include <AK/FlyString.h>
|
#include <AK/FlyString.h>
|
||||||
#include <AK/MemoryStream.h>
|
#include <AK/MemoryStream.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
#include <LibDebug/Dwarf/DwarfTypes.h>
|
||||||
|
|
||||||
namespace Debug::Dwarf {
|
namespace Debug::Dwarf {
|
||||||
|
|
||||||
|
class DwarfInfo;
|
||||||
|
|
||||||
struct [[gnu::packed]] LineProgramUnitHeader32Common {
|
struct [[gnu::packed]] LineProgramUnitHeader32Common {
|
||||||
u32 length;
|
u32 length;
|
||||||
u16 version;
|
u16 version;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue