A somewhat detailed explanation of the needs and possible solution is available at http://gcc.gnu.org/wiki/DebugGNUIndexSection .
It was posted for discussion to http://sourceware.org/ml/archer/2009-q3/msg00105.html .
Created attachment 18404 [details]
First shot implementation
Implements the .debug_gnu_index section. It fully implements the proposal, modulo the possible bugs.
For now, .debug_pubtypes and .debug_pubnames are kept around.
It patch doesn't contain any test yet. I'll update it soon with some tests.
Created attachment 18420 [details]
WIP with test
This version fixes a bug in gcc that was preventing it to emit DWARFs for a typedefs enclosed in a namespace, if said namespace contain only typedefs.
As a matter of fact, the exemple accompanying the patch shows what's supported now. Find attached below the generated assembly fo the exemple in the patch.
Created attachment 18421 [details]
Generated assembly for previous test
Assembly generated for the test in attachment #18420 [details]
Created attachment 18434 [details]
This patch removes the addition fix that was carried by previous patch as that fix was pushed upstream, independently as PR debug/41770 .
Adjust tests to pass regtests.
Created attachment 18435 [details]
Okay, this is the patch I wanted to attach. Not #18434. So the previous comment applies to this entry.
*** Bug 39708 has been marked as a duplicate of this bug. ***
Created attachment 19055 [details]
I've slightly updated the patch to handle non-public entities
Created attachment 19056 [details]
patch for readelf
This patch modifies the binutils readelf utility to
dump the new section.
Created attachment 19214 [details]
patch for readelf
This is an updated readelf patch.
Now "readelf -wI" works properly.
Created attachment 19218 [details]
updated gcc patch to put the CU's language in the new section
Created attachment 19219 [details]
updated binutils patch to account for language in new index
I compiled a C++ program with a gcc that includes this patch.
I see some erroneous entries in the resulting index. E.g.:
0xb8 DW_TAG_structure_type ._6
0x3f1 DW_TAG_structure_type basic_string
0x3fc2 DW_TAG_structure_type _Rep
It would be best for gdb if gcc emitted an "empty" section if
there was nothing to index. See PR 42288 for an analogous case.
This is worth doing even though, in this situation, the resulting
CU won't really hold much of interest. The reason is that if all
the CUs are represented, then gdb can defer even mapping .debug_info,
which is significant.
Not working on this atm.
I think we've decided not to pursue this route.