Discussion:
Listing source files with objdump
Bruce Dawson
2013-06-04 23:45:27 UTC
Permalink
I want to get a list of all of the source files and header files used to create a particular shared object. I can do this with "objdump -Wl" in order to get the Directory Table and the File Name Table, but this also emits an enormous volume of other data. The volume of data is large enough that filtering through it (some combination of the time that objdump spends printing it and the time that I spend parsing it) is inconveniently long -- it noticeably increases our build time.

I found the display_debug_lines_raw() function in dwarf.c and I modified it to just print the Directory Table and File Name Table arrays, and that works quite nicely for my purposes. There is still a lot of redundancy (the same files listed many times) but the volume of data is 15-20x smaller so the printing and parsing is no longer a problem.

Does it seem worthwhile to add a new objdump command line option to just dump this information? I could see it being useful for others. Perhaps -WS for Source.

The actual change would be simple (an extra flag to display_debug_lines_raw), but I don't know if it is desirable for the population at large. If not then I'll continue using our custom version.
John Kearney
2013-06-05 01:19:42 UTC
Permalink
I did something similar a while back but never got around to posting it.
I didn't print the tables separately but rather the full paths.

So I for one would be interested in this functionality.


Mit freundlichen Grüßen / Yours Sincerly
John Kearney
Software Developer
QNX Software Systems

Mobile +49 151 1464 8298
| qnx.com



-----Original Message-----
From: binutils-***@sourceware.org [mailto:binutils-***@sourceware.org] On Behalf Of Bruce Dawson
Sent: Mittwoch, 5. Juni 2013 01:45
To: '***@sourceware.org'
Subject: Listing source files with objdump

I want to get a list of all of the source files and header files used to create a particular shared object. I can do this with "objdump -Wl" in order to get the Directory Table and the File Name Table, but this also emits an enormous volume of other data. The volume of data is large enough that filtering through it (some combination of the time that objdump spends printing it and the time that I spend parsing it) is inconveniently long -- it noticeably increases our build time.

I found the display_debug_lines_raw() function in dwarf.c and I modified it to just print the Directory Table and File Name Table arrays, and that works quite nicely for my purposes. There is still a lot of redundancy (the same files listed many times) but the volume of data is 15-20x smaller so the printing and parsing is no longer a problem.

Does it seem worthwhile to add a new objdump command line option to just dump this information? I could see it being useful for others. Perhaps -WS for Source.

The actual change would be simple (an extra flag to display_debug_lines_raw), but I don't know if it is desirable for the population at large. If not then I'll continue using our custom version.
nick clifton
2013-06-05 10:23:24 UTC
Permalink
Hi Bruce,
Post by Bruce Dawson
I want to get a list of all of the source files and header files used to create a particular shared object.
Presumably you do not have access to the build system that created the
shared object in the first place ?
Post by Bruce Dawson
Does it seem worthwhile to add a new objdump command line option to
just dump this information? I could see it being useful for others.
Perhaps -WS for Source.
Go for it. :-)

Cheers
Nick
Bruce Dawson
2013-06-05 19:08:19 UTC
Permalink
I'll poke around and see if I can submit a patch. The actual coding is simple enough, but I may decide not to bother submitting just 'cause that always takes a while on a new project.

I do have access to the build system -- this is running on the build machine. The main value it has over the list of source files in the makefile is that it also includes any header files that were brought in, which may contain a significant amount of code.

For each file I then get the Perforce path and version information, which gives us a machine-neutral specifier for all of the files.

-----Original Message-----
From: nick clifton [mailto:***@redhat.com]
Sent: Wednesday, June 05, 2013 3:23 AM
To: Bruce Dawson; '***@sourceware.org'
Subject: Re: Listing source files with objdump

Hi Bruce,
Post by Bruce Dawson
I want to get a list of all of the source files and header files used to create a particular shared object.
Presumably you do not have access to the build system that created the shared object in the first place ?
Post by Bruce Dawson
Does it seem worthwhile to add a new objdump command line option to > just dump this information? I could see it being useful for others.
Perhaps -WS for Source.
Go for it. :-)

Cheers
Nick

Loading...