mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +00:00
LibDebug: Add DwarfInfo::get_cached_die_at_offset
This function returns a DIE object from the cache with the given offset in the debug_info section.
This commit is contained in:
parent
fb31aae20d
commit
835efa1b6a
2 changed files with 18 additions and 0 deletions
|
@ -308,4 +308,15 @@ Optional<DIE> DwarfInfo::get_die_at_address(FlatPtr address) const
|
|||
return iter->die;
|
||||
}
|
||||
|
||||
Optional<DIE> DwarfInfo::get_cached_die_at_offset(FlatPtr offset) const
|
||||
{
|
||||
if (!m_built_cached_dies)
|
||||
build_cached_dies();
|
||||
|
||||
auto* die = m_cached_dies_by_offset.find(offset);
|
||||
if (!die)
|
||||
return {};
|
||||
return *die;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,6 +39,13 @@ public:
|
|||
|
||||
Optional<DIE> get_die_at_address(FlatPtr) const;
|
||||
|
||||
// Note that even if there is a DIE at the given offset,
|
||||
// but it does not exist in the DIE cache (because for example
|
||||
// it does not contain an address range), then this function will not return it.
|
||||
// To get any DIE object at a given offset in a compilation unit,
|
||||
// use CompilationUnit::get_die_at_offset.
|
||||
Optional<DIE> get_cached_die_at_offset(FlatPtr) const;
|
||||
|
||||
private:
|
||||
void populate_compilation_units();
|
||||
void build_cached_dies() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue