Skip to content

Commit

Permalink
read: add support for custom address types
Browse files Browse the repository at this point in the history
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
  • Loading branch information
philipc committed Jul 8, 2024
1 parent 90f9a6a commit b2b9685
Show file tree
Hide file tree
Showing 25 changed files with 1,286 additions and 535 deletions.
6 changes: 3 additions & 3 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ fn bench_evaluating_debug_info_expressions(b: &mut test::Bencher) {
});
}

fn debug_loc_expressions<R: Reader>(
fn debug_loc_expressions<R: Reader<Address = u64>>(
debug_info: &DebugInfo<R>,
debug_abbrev: &DebugAbbrev<R>,
debug_addr: &DebugAddr<R>,
Expand Down Expand Up @@ -702,7 +702,7 @@ mod cfi {
});
}

fn instrs_len<R: Reader>(
fn instrs_len<R: Reader<Address = u64>>(
eh_frame: &EhFrame<R>,
bases: &BaseAddresses,
fde: &FrameDescriptionEntry<R>,
Expand All @@ -712,7 +712,7 @@ mod cfi {
.expect("fold over instructions OK")
}

fn get_fde_with_longest_cfi_instructions<R: Reader>(
fn get_fde_with_longest_cfi_instructions<R: Reader<Address = u64>>(
eh_frame: &EhFrame<R>,
bases: &BaseAddresses,
) -> FrameDescriptionEntry<R> {
Expand Down
Loading

0 comments on commit b2b9685

Please sign in to comment.