gimli-rs / gimli

A library for reading and writing the DWARF debugging format

Home Page:https://docs.rs/gimli/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EhHdrTable::lookup doesn't return the address that corresponds to the found FDE

mstange opened this issue · comments

EhHdrTable::lookup takes an address and finds the entry in the table whose address is closest to the looked up address. Then it drops that entry's address on the floor and only returns the "FDE pointer" part of the entry.

I think it would be great if both parts of the entry were returned: The entry address and the entry FDE pointer.

I am interested in the address as an approximation for "the closest function start address". I could of course get that address by parsing the eh_frame section and looking up the FDE, but this seems like a waste if what I'm looking for is already in eh_frame_hdr.

Are you sure don't want to also check the length in the FDE? This seems like useful information, even if you want to always return the address regardless of this check.

It's useful information, but I don't think I need it for my use case - I could treat addresses "between" functions differently, but I'm not sure what kind of treatment would be useful.

For both this and #612, can you do it first without any gimli changes, and then measure whether the changes to support these issues make a noticeable performance difference? I'm reluctant to add support for things that aren't a normal use of the information, and that are already possible without any changes.

For this issue, we probably want to leave the signature of EhHdrTable::lookup unchanged, and add a new function instead.

Sounds good.