mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
LibDebug: Move get_die_at_offset to Dwarf::CompilationUnit
This commit is contained in:
parent
15b3957885
commit
fea9bb8c51
5 changed files with 9 additions and 9 deletions
|
@ -194,7 +194,7 @@ static Optional<Dwarf::DIE> parse_variable_type_die(const Dwarf::DIE& variable_d
|
|||
|
||||
VERIFY(type_die_offset.value().type == Dwarf::AttributeValue::Type::DieReference);
|
||||
|
||||
auto type_die = variable_die.get_die_at_offset(type_die_offset.value().data.as_u32);
|
||||
auto type_die = variable_die.compilation_unit().get_die_at_offset(type_die_offset.value().data.as_u32);
|
||||
auto type_name = type_die.get_attribute(Dwarf::Attribute::Name);
|
||||
if (type_name.has_value()) {
|
||||
variable_info.type_name = type_name.value().data.as_string;
|
||||
|
|
|
@ -23,4 +23,10 @@ DIE CompilationUnit::root_die() const
|
|||
return DIE(*this, m_offset + m_header.header_size());
|
||||
}
|
||||
|
||||
DIE CompilationUnit::get_die_at_offset(u32 die_offset) const
|
||||
{
|
||||
VERIFY(die_offset >= offset() && die_offset < offset() + size());
|
||||
return DIE(*this, die_offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ public:
|
|||
u32 size() const { return m_header.length() + sizeof(u32); }
|
||||
|
||||
DIE root_die() const;
|
||||
DIE get_die_at_offset(u32 offset) const;
|
||||
|
||||
const DwarfInfo& dwarf_info() const { return m_dwarf_info; }
|
||||
const AbbreviationsMap& abbreviations_map() const { return m_abbreviations; }
|
||||
|
|
|
@ -88,10 +88,4 @@ void DIE::for_each_child(Function<void(const DIE& child)> callback) const
|
|||
}
|
||||
}
|
||||
|
||||
DIE DIE::get_die_at_offset(u32 offset) const
|
||||
{
|
||||
VERIFY(offset >= m_compilation_unit.offset() && offset < m_compilation_unit.offset() + m_compilation_unit.size());
|
||||
return DIE(m_compilation_unit, offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,8 +33,7 @@ public:
|
|||
void for_each_child(Function<void(const DIE& child)> callback) const;
|
||||
|
||||
bool is_null() const { return m_tag == EntryTag::None; }
|
||||
|
||||
DIE get_die_at_offset(u32 offset) const;
|
||||
const CompilationUnit& compilation_unit() const { return m_compilation_unit; }
|
||||
|
||||
private:
|
||||
const CompilationUnit& m_compilation_unit;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue