This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch]: dump .eh_frame in objdump


Hi,

I don't think there is a good reason for *not* dumping .eh_frame in
objdump -W.  This is nasty on non-ELF platforms (PE, Mach-O), and by default
readelf -w dumps it.
With this patch, readelf -w and objdump -W dump the same sections.

(Maybe we should add a new letter -e- to dump only .eh_frame, but this will
be a separate patch).

No regressions on x86_64.

Tristan.

binutils/
2009-07-06  Tristan Gingold  <gingold@adacore.com>

	* objdump.c (dump_dwarf_section): Handle .eh_frame like other dwarf
	sections.
	* dwarf.h (struct dwarf_section_display): Remove eh_frame field.
	* dwarf.c (debug_displays): Adjust for removed field.

Index: binutils/dwarf.c
===================================================================
RCS file: /cvs/src/src/binutils/dwarf.c,v
retrieving revision 1.48
diff -u -p -r1.48 dwarf.c
--- binutils/dwarf.c	3 Jul 2009 08:53:49 -0000	1.48
+++ binutils/dwarf.c	6 Jul 2009 08:17:30 -0000
@@ -4878,35 +4878,35 @@ dwarf_select_sections_all (void)
 struct dwarf_section_display debug_displays[] =
 {
   { { ".debug_abbrev",		".zdebug_abbrev",	NULL,	NULL,	0,	0 },
-    display_debug_abbrev,		&do_debug_abbrevs,	0,	0 },
+    display_debug_abbrev,		&do_debug_abbrevs,	0 },
   { { ".debug_aranges",		".zdebug_aranges",	NULL,	NULL,	0,	0 },
-    display_debug_aranges,		&do_debug_aranges,	1,	0 },
+    display_debug_aranges,		&do_debug_aranges,	1 },
   { { ".debug_frame",		".zdebug_frame",	NULL,	NULL,	0,	0 },
-    display_debug_frames,		&do_debug_frames,	1,	0 },
+    display_debug_frames,		&do_debug_frames,	1 },
   { { ".debug_info",		".zdebug_info",		NULL,	NULL,	0,	0 },
-    display_debug_info,			&do_debug_info,		1,	0 },
+    display_debug_info,			&do_debug_info,		1 },
   { { ".debug_line",		".zdebug_line",		NULL,	NULL,	0,	0 },
-    display_debug_lines,		&do_debug_lines,	1,	0 },
+    display_debug_lines,		&do_debug_lines,	1 },
   { { ".debug_pubnames",	".zdebug_pubnames",	NULL,	NULL,	0,	0 },
-    display_debug_pubnames,		&do_debug_pubnames,	0,	0 },
+    display_debug_pubnames,		&do_debug_pubnames,	0 },
   { { ".eh_frame",		"",			NULL,	NULL,	0,	0 },
-    display_debug_frames,		&do_debug_frames,	1,	1 },
+    display_debug_frames,		&do_debug_frames,	1 },
   { { ".debug_macinfo",		".zdebug_macinfo",	NULL,	NULL,	0,	0 },
-    display_debug_macinfo,		&do_debug_macinfo,	0,	0 },
+    display_debug_macinfo,		&do_debug_macinfo,	0 },
   { { ".debug_str",		".zdebug_str",		NULL,	NULL,	0,	0 },
-    display_debug_str,			&do_debug_str,		0,	0 },
+    display_debug_str,			&do_debug_str,		0 },
   { { ".debug_loc",		".zdebug_loc",		NULL,	NULL,	0,	0 },
-    display_debug_loc,			&do_debug_loc,		1,	0 },
+    display_debug_loc,			&do_debug_loc,		1 },
   { { ".debug_pubtypes",	".zdebug_pubtypes",	NULL,	NULL,	0,	0 },
-    display_debug_pubnames,		&do_debug_pubnames,	0,	0 },
+    display_debug_pubnames,		&do_debug_pubnames,	0 },
   { { ".debug_ranges",		".zdebug_ranges",	NULL,	NULL,	0,	0 },
-    display_debug_ranges,		&do_debug_ranges,	1,	0 },
+    display_debug_ranges,		&do_debug_ranges,	1 },
   { { ".debug_static_func",	".zdebug_static_func",	NULL,	NULL,	0,	0 },
-    display_debug_not_supported,	NULL,			0,	0 },
+    display_debug_not_supported,	NULL,			0 },
   { { ".debug_static_vars",	".zdebug_static_vars",	NULL,	NULL,	0,	0 },
-    display_debug_not_supported,	NULL,			0,	0 },
+    display_debug_not_supported,	NULL,			0 },
   { { ".debug_types",		".zdebug_types",	NULL,	NULL,	0,	0 },
-    display_debug_not_supported,	NULL,			0,	0 },
+    display_debug_not_supported,	NULL,			0 },
   { { ".debug_weaknames",	".zdebug_weaknames",	NULL,	NULL,	0,	0 },
-    display_debug_not_supported,	NULL,			0,	0 }
+    display_debug_not_supported,	NULL,			0 }
 };
Index: binutils/dwarf.h
===================================================================
RCS file: /cvs/src/src/binutils/dwarf.h,v
retrieving revision 1.8
diff -u -p -r1.8 dwarf.h
--- binutils/dwarf.h	9 Feb 2009 09:14:15 -0000	1.8
+++ binutils/dwarf.h	6 Jul 2009 08:17:30 -0000
@@ -51,7 +51,6 @@ struct dwarf_section_display
   int (*display) (struct dwarf_section *, void *);
   int *enabled;
   unsigned int relocate : 1;
-  unsigned int eh_frame : 1;
 };
 
 enum dwarf_section_display_enum {
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.159
diff -u -p -r1.159 objdump.c
--- binutils/objdump.c	18 Jun 2009 10:31:21 -0000	1.159
+++ binutils/objdump.c	6 Jul 2009 08:17:30 -0000
@@ -2236,21 +2236,18 @@ dump_dwarf_section (bfd *abfd, asection 
 	&& debug_displays [i].enabled != NULL
 	&& *debug_displays [i].enabled)
       {
-	if (!debug_displays [i].eh_frame)
-	  {
-	    struct dwarf_section *sec = &debug_displays [i].section;
+	struct dwarf_section *sec = &debug_displays [i].section;
 
-	    if (strcmp (sec->uncompressed_name, match) == 0)
-	      sec->name = sec->uncompressed_name;
-	    else
-	      sec->name = sec->compressed_name;
-	    if (load_specific_debug_section (i, section, abfd))
-	      {
-		debug_displays [i].display (sec, abfd);
-
-		if (i != info && i != abbrev)
-		  free_debug_section (i);
-	      }
+	if (strcmp (sec->uncompressed_name, match) == 0)
+	  sec->name = sec->uncompressed_name;
+	else
+	  sec->name = sec->compressed_name;
+	if (load_specific_debug_section (i, section, abfd))
+	  {
+	    debug_displays [i].display (sec, abfd);
+	    
+	    if (i != info && i != abbrev)
+	      free_debug_section (i);
 	  }
 	break;
       }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]