gimli-rs / gimli

A library for reading and writing the DWARF debugging format
https://docs.rs/gimli/
Apache License 2.0
831 stars 105 forks source link

read: add support for custom address types #735

Open philipc opened 2 months ago

philipc commented 2 months ago

Add the Reader::Address associated type, which implements the ReaderAddress trait. This trait is implemented for u64 to provide the existing behaviour of supporting multiple address sizes, as well as for Address32 and Address64 which support a single address size.

The dwarfdump example now provides its own address type, which allows it to show symbols associated with relocated addresses in relocatable object files. For example:

    DW_AT_low_pc                main+0x0
    DW_AT_ranges                <rnglist at .debug_rnglists+0x0000000c>
        [ 0] <start-length main+0x0, 0x17> [main+0x0, main+0x17]

    DW_LNE_set_address to main+0x0

Closes #409

philipc commented 2 months ago

This is a breaking change, and adds significant complexity. While I think the dwarfdump support is neat, I'm not completely convinced it is worth it, so I'm going to leave this as a draft for while.

To do: