1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

LibDebug: Make use of the newly supported data forms

With this change, our DWARF 5 support is nearly feature-complete.
This commit is contained in:
Daniel Bertalan 2021-10-09 17:45:48 +02:00 committed by Linus Groh
parent 8278039105
commit 622d408d82
2 changed files with 31 additions and 4 deletions

View file

@ -326,10 +326,16 @@ void DwarfInfo::build_cached_dies() const
auto get_ranges_of_die = [this](DIE const& die) -> Vector<DIERange> {
auto ranges = die.get_attribute(Attribute::Ranges);
if (ranges.has_value()) {
// TODO Support DW_FORM_rnglistx
if (ranges->form() != AttributeDataForm::SecOffset)
return {};
auto offset = ranges->as_unsigned();
size_t offset;
if (ranges->form() == AttributeDataForm::SecOffset) {
offset = ranges->as_unsigned();
} else {
auto index = ranges->as_unsigned();
auto base = die.compilation_unit().range_lists_base();
// FIXME: This assumes that the format is DWARf32
auto offsets = reinterpret_cast<u32 const*>(debug_range_lists_data().offset(base));
offset = offsets[index] + base;
}
AddressRanges address_ranges(debug_range_lists_data(), offset, die.compilation_unit());
Vector<DIERange> entries;
address_ranges.for_each_range([&entries](auto range) {