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
Add the ability to print module_name:offset, or address of frame #44
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general, thanks for this!
I added a few minor comments. I'm wondering whether it would make sense to remove the cfg
restrictions from print_addresses
etc and to only keep it for module_info
. The fallback function for module_info
could then just always return None
/Err
. As far as I see, this should be the only thing that's really platform dependent here? Should probably also rename the feature into something like resolve-modules
then.
I've applied all review issues. Please let me know if there is anything else you'd like. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cfg
condition on the module_info
fallback doesn't seem to be the proper inverse of the Linux implementation. I commented on how I imagined it, but perhaps there is a good reason for doing it like you're doing it that I just fail to see?
Co-authored-by: Joel Höner <joel@zyantific.com>
Co-authored-by: Joel Höner <joel@zyantific.com>
If you could cut a version when you've merged, it would be greatly appreciated. |
Will do. Thanks for the PR! :) |
Done. |
This PR adds the ability to print the module_name:offset (or address, if module_name cannot be found) of each frame. This helps when debugging black-box third-party code.
Currently, module name resolution is implemented by walking the
/proc/self/maps
pseudo-file. This is available on most unix-like OSes, with the notable exception of macos/ios. As such, this feature is a noop on those system.The feature is both hidden behind a feature flag (
print-addresses
), because it has a regex dependency, and must be explicitly turned on by callingprint_addresses(true)
on theBacktracePrinter
.