Skip to content

Conversation

calebh
Copy link

@calebh calebh commented Jul 7, 2025

This fixes issue #589 (see that issue for more information on this pull request)

I'm not sure if the resolve_abstract_origin function should be further abstracted to resolve references that are not only abstract_origin.

@ltfish
Copy link
Member

ltfish commented Jul 8, 2025

LGTM. @rhelmot ?

@rhelmot
Copy link
Member

rhelmot commented Jul 8, 2025

lgtm, but can we throw an error if the form is not something we've explicitly got a case to handle?

@calebh
Copy link
Author

calebh commented Jul 9, 2025

lgtm, but can we throw an error if the form is not something we've explicitly got a case to handle?

Sure, we can do that. As I've been going through the DWARF code, I've been finding tons of places where it's assumed that a ref4 relative reference is used. I might end up changing all of these to account for the possibility of an absolute reference.

… can handle any attribute. An error is now thrown if the reference form is not one we can understand.
@calebh
Copy link
Author

calebh commented Jul 14, 2025

@rhelmot I have pushed another commit that further abstract the reference resolving to work with any reference attribute. I went ahead and changed all the functions that previously had hard coded relative offset calculations to use the new functions.

References of unsupported form will now throw a ValueError. According to the DWARF specs, the specific forms that are still unsupported are DW_FORM_ref_sig8, DW_FORM_ref_sup4, and DW_FORM_ref_sup8. I don't happen to have any binaries handy with these specific reference forms, so I'm not sure how to implement and test them.

@rhelmot
Copy link
Member

rhelmot commented Jul 15, 2025

This diff looks good, can you please address the formatting issues by running pre-commit?

…e. Changed and simplified implementation of resolve_reference_addr to make use of this method. Cleaned up imports that are now unused.
@calebh
Copy link
Author

calebh commented Jul 16, 2025

I was able to further simplify the code by making use of the get_DIE_from_attribute method available from a DIE object. Using this method means that we now support all the different types of references used by the elftools DWARF library. I also made sure that the lines are under the character limit as the last pre-commit pointed out.

@rhelmot
Copy link
Member

rhelmot commented Aug 14, 2025

I'm sorry I failed to follow up on this - you are still having some issues with our lint and autoformatter. Can you please run pip install pre-commit && pre-commit run, or allow us to push to your fork so I can do it for you?

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

Successfully merging this pull request may close these issues.

3 participants