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

Every DebugStr has an offset of 0 in simple example #530

Open
leo60228 opened this issue Jul 24, 2020 · 8 comments
Open

Every DebugStr has an offset of 0 in simple example #530

leo60228 opened this issue Jul 24, 2020 · 8 comments

Comments

@leo60228
Copy link

This is really strange, and it doesn't affect the dwarfdump example despite the fact that I can't find any difference between what they do...

simple.txt
obj.zip

@bjorn3
Copy link
Contributor

bjorn3 commented Jul 24, 2020

The simple example doesn't handle relocations, so all relocatable offsets will be handled as if they are zero. This is only affects object files and not linked executables and libraries, as for those the debug info relocations are resolved by the linker.

@leo60228
Copy link
Author

...oops. Should I just copy add_relocations from dwarfdump.rs?

@bjorn3
Copy link
Contributor

bjorn3 commented Jul 24, 2020

You also need to use the Relocate type from dwarfdump.rs as reader instead of EndianSlice.

@leo60228
Copy link
Author

That worked, thanks! Should this be documented somewhere?

@philipc
Copy link
Collaborator

philipc commented Jul 24, 2020

If you can point to a good spot to document it where you would have found it.

@leo60228
Copy link
Author

A comment in examples/simple.rs saying something like // WARNING: This does not apply relocations, and so will not work for some types of files. would be helpful.

@richlowe
Copy link

I ran into this exact same thing years later, and agree that that comment would have saved me a lot of debugging. :)

@philipc
Copy link
Collaborator

philipc commented Mar 26, 2024

I'm changing object and gimli to make it easier to handle relocations, and I'll update the example to use it.

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

No branches or pull requests

4 participants