pyelftools icon indicating copy to clipboard operation
pyelftools copied to clipboard

Add support for DWARF version 5

Open gpollo opened this issue 5 years ago • 9 comments

pyelftools still doesn't support DWARF version 5 as seen here. Is there anything considerable to be done except changing those lines and adding the new DW_TAG and DW_AT? If no work as been done, I might give it a try as I need some DWARF version 5 information.

gpollo avatar Jul 13 '20 13:07 gpollo

Locations section parsing would need to be rewritten.

sevaa avatar Jul 13 '20 13:07 sevaa

There's actually a significant amount of change in DWARF v5. New line table header format, which can move pathnames to a new section. Location lists and range lists have a radically different encoding and use new section names. References to .debug_str from .debug_info can be indirect through a .debug_str_offsets section. Addresses can be in a separate .debug_addr section and referenced by index. If you want to get super fancy there are several new unit types which can refer to debug info in a separate ".dwo" (dwarf object) file.

Those are the big items, off the top of my head. There's a bunch of new FORMs to support the indirect references, and of course new DW_TAG and DW_AT items.

I know the DWARF side of things pretty well but I'm not such a great Python coder, and it's not clear my employer would give me time to work on this. But I thought it was worth spelling out the scope a little more fully.

pogo59 avatar Sep 09 '20 20:09 pogo59

I'm taking an initial stab at this, starting with the changes to CU headers.

woodruffw avatar May 24 '21 16:05 woodruffw

Since this has been merged, a new release would be awesome!

pombredanne avatar Aug 14 '21 07:08 pombredanne

One thing to keep in mind: the support I added is very preliminary. I’m positive additional work will be needed to fully support DWARF5!

Sent from mobile. Please excuse my brevity.

On Aug 14, 2021, at 3:37 AM, Philippe Ombredanne @.***> wrote:

 Since this has been merged, a new release would be awesome!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

woodruffw avatar Aug 14 '21 17:08 woodruffw

One thing to keep in mind: the support I added is very preliminary. I’m positive additional work will be needed to fully support DWARF5!

That's OK IMHO... at least we can start playing with these.

pombredanne avatar Aug 14 '21 21:08 pombredanne

For the paranoid among us, one could make DWARF 5 support explicitly opt-in. Like, a flag that is False by default.

That said, I, as a consumer of pyelftools, would rather take my chances with the experimental code as it is.

sevaa avatar Aug 15 '21 08:08 sevaa

Hi, I would like to support @sevaa 's request for a release with experimental code. As a user of this, it is better to have a solution that sometimes works (experimental DWARF 5 support), than one that never works (no DWARF 5 support)

noppej avatar Feb 02 '22 14:02 noppej

Version 0.28 was released with all the latest stuff inside

eliben avatar Feb 03 '22 14:02 eliben

How come this is still open? :)

sevaa avatar Dec 18 '23 16:12 sevaa