Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read: add support for custom address types #735

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

philipc
Copy link
Collaborator

@philipc philipc commented Jul 8, 2024

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

Preemptively allow complex types that result from adding an associated
type for addresses.
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
@philipc
Copy link
Collaborator Author

philipc commented Jul 8, 2024

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:

  • investigate how much this affects downstream crates
  • investigate how this integrates with the write support (are the convert_address callbacks still needed?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Reader::Address associated type
1 participant