This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch] Fix readelf display of indirect strings
- From: Cary Coutant <ccoutant at google dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Mon, 7 Dec 2009 14:22:40 -0800
- Subject: [patch] Fix readelf display of indirect strings
The following patch was committed on 12/3/09 to add support for .debug_pubtypes:
2009-12-03 Nick Clifton <nickc@redhat.com>
PR binutils/11045
* dwarf.c (do_debug_pubtypes): New variable.
(dwarf_select_sections_by_names): Handle .debug_pubtypes.
(dwarf_select_sections_by_letters): Add 't' for .debug_pubtype.
(dwarf_select_sections_all): Set do_debug_pubtypes.
(debug_displays): Add support for .debug_pubtypes.
* dwarf.h (do_debug_pubtypes): Export.
* objdump.c (usage): Add -wt or --dwarf=pubtypes.
* readelf.c (usage): Likewise.
(process_section_headers): Enable debug display if
do_debug_pubtypes is set.
* doc/binutils.texi: Document -wt/--dwarf=pubtypes option.
Unfortunately, it broke the display of indirect strings, by inserting
a duplicate entry in debug_displays[] and making debug_displays[str]
refer to the .debug_macinfo section. (The enum
dwarf_section_display_enum in dwarf.h must match the entries in
debug_displays.)
While looking over that patch, I also noticed a typo that will cause
--debug-dump=pubtypes to dump the pubnames section instead of the
pubtypes section.
This patch fixes both of those problems.
Tested on x86_64-linux. OK? (I would commit this as obvious, but I
wanted Nick to confirm the change to dwarf_select_sections_by_names.)
-cary
* dwarf.c (dwarf_select_sections_by_names): Handle pubtypes correctly.
(debug_displays): Remove duplicate entry for debug_pubtypes.
Index: dwarf.c
===================================================================
RCS file: /cvs/src/src/binutils/dwarf.c,v
retrieving revision 1.58
diff -u -p -r1.58 dwarf.c
--- dwarf.c 3 Dec 2009 12:28:36 -0000 1.58
+++ dwarf.c 7 Dec 2009 22:07:46 -0000
@@ -4868,7 +4868,7 @@ dwarf_select_sections_by_names (const ch
{ "loc", & do_debug_loc, 1 },
{ "macro", & do_debug_macinfo, 1 },
{ "pubnames", & do_debug_pubnames, 1 },
- { "pubtypes", & do_debug_pubnames, 1 },
+ { "pubtypes", & do_debug_pubtypes, 1 },
/* This entry is for compatability
with earlier versions of readelf. */
{ "ranges", & do_debug_aranges, 1 },
@@ -5009,8 +5009,6 @@ struct dwarf_section_display debug_displ
display_debug_lines, &do_debug_lines, 1 },
{ { ".debug_pubnames", ".zdebug_pubnames", NULL, NULL, 0, 0 },
display_debug_pubnames, &do_debug_pubnames, 0 },
- { { ".debug_pubtypes", ".zdebug_pubtypes", NULL, NULL, 0, 0 },
- display_debug_pubnames, &do_debug_pubtypes, 0 },
{ { ".eh_frame", "", NULL, NULL, 0, 0 },
display_debug_frames, &do_debug_frames, 1 },
{ { ".debug_macinfo", ".zdebug_macinfo", NULL, NULL, 0, 0 },