dwarf: initial DWARFv5 support by woodruffw · Pull Request #363 · eliben/pyelfto...
source link: https://github.com/eliben/pyelftools/pull/363
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
New issue
dwarf: initial DWARFv5 support #363
Conversation
This is very WIP. My plan is to get the initial stream and CU parsing in place, stub out support for the new line table format, and add some tests.
See #325.
It looks like the latest stable version of readelf
(2.36.1) in GNU binutils still doesn't have great support for DWARFv5, so direct comparisons against their output probably aren't going to be very fruitful.
However, as of 778fd8a on this branch, I can run readelf.py --debug-dump=info WHATEVER
on a few trivial ELFs that use DWARFv5 on my system. I plan to work more on line program handling and other major parts that have changed, but I figured I'd make an initial stop here to see if it's best to merge this initial work first.
Misc. notes:
DW_FORM_addrx3
andDW_FORM_strx3
parsing require support for loading 24-bit unsigned integers. Newer versions of Construct supportUBInt24
, but the vendored one doesn't. Adding a customConstruct
subclass for it probably wouldn't be too hard, but I have no idea how many DWARF emitters actually use these 24-bit forms. Maybe not worth it.- I've done some plumbing to connect some of the new DWARFv5 sections up, so that the values of the various new forms (e.g.
DW_FORM_strx
) can be properly resolved. But those new sections aren't actually being parsed yet.
I think this is ready for an initial review. I've added a basic DWARFv5 sample as a smoke test, just to confirm that we can populate a DWARFInfo
at minimum and succeed at parsing v5-style CU headers.
Thank you, this looks like a good start!
It's a shame readelf
doesn't support it yet; I wonder if we can find some alternative for more exhaustive testing. The readelf-comparison tests give pyelftools very strong test coverage.
It's a shame
readelf
doesn't support it yet; I wonder if we can find some alternative for more exhaustive testing. The readelf-comparison tests give pyelftools very strong test coverage.
I've been doing my local testing against llvm-dwarfdump
, which seems to perform admirably against DWARFv5 (i.e., it both parses correctly and resolves most of the new indirect references/indices).
Unfortunately, its output is pretty different (in terms of format) from readelf
, so adding support for it (via another CLI?) would probably be nontrivial. I'll see if there's some way to get it to dump a JSON or YAML representation...
Edit: LLVM's obj2yaml
might do the trick here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No one assigned
None yet
No milestone
Successfully merging this pull request may close these issues.
None yet
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK