7

dwarf: initial DWARFv5 support by woodruffw · Pull Request #363 · eliben/pyelfto...

 2 years ago
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.
neoserver,ios ssh client

New issue

dwarf: initial DWARFv5 support #363

Conversation

Copy link

Contributor

woodruffw commented on May 24, 2021

edited

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.

Copy link

Contributor

Author

woodruffw commented on May 24, 2021

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.

Copy link

Contributor

Author

woodruffw commented on May 24, 2021

Misc. notes:

  • DW_FORM_addrx3 and DW_FORM_strx3 parsing require support for loading 24-bit unsigned integers. Newer versions of Construct support UBInt24, but the vendored one doesn't. Adding a custom Construct 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.

woodruffw

marked this pull request as ready for review

7 months ago

Copy link

Contributor

Author

woodruffw commented on May 25, 2021

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.

Copy link

Owner

eliben commented on May 27, 2021

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.

eliben

merged commit 4384ad8 into

eliben:master on May 27, 2021

4 checks passed

Copy link

Contributor

Author

woodruffw commented on May 27, 2021

edited

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.

woodruffw

deleted the ww/dwarf-5 branch

7 months ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

eliben

Assignees

No one assigned

Labels
None yet
Projects

None yet

Milestone

No milestone

Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK