pyelftools icon indicating copy to clipboard operation
pyelftools copied to clipboard

Support for shared lineprograms

Open eliben opened this issue 12 years ago • 3 comments

Moving from bitbucket issue #22:

Attached is an ELF file for which readelf from pyelftools behaves differently than GNU readelf.

The reason is that the file consists of multiple compilation units that share a single lineprogram. When executing readelf --debug-dump=decodedline , GNU readelf prints the source lines a single time, whereas readelf from pyelftools prints the same source lines once for every compilation unit.

Should we treat lineprograms as entities that are independent of compilation units?


My comments:

Yeah, I can reproduce the difference... Though it's just different behavior from readelf; all information seems to be parsed correctly. I'll take a look at how to make it behave similarly.

[...]

OK, I see what the problem is.

pyelftools enumerates line programs by following each CU and looking at its line program. readelf just goes over the line program section, and extracts the CU name from the line program itself.

This shouldn't be hard to fix by adding a method to DWARFInfo that enumerates line programs in order from the section and not looking up by CU.

Patches welcome!

eliben avatar Jun 09 '13 13:06 eliben

Here's the file: https://dl.dropboxusercontent.com/u/15602400/caller

eliben avatar Jun 09 '13 13:06 eliben

Fixed in recent pull request #56, I believe

eliben avatar Nov 01 '14 13:11 eliben

Unfortunately #56 has nothing to do with this one (afaik). The link was caused by the unittest output using hash-sign+digit in it's output :-(

KarlVogel avatar Nov 01 '14 13:11 KarlVogel