From: Tristan Gingold Date: Mon, 24 May 2010 13:21:26 +0000 (+0000) Subject: 2010-05-24 Tristan Gingold X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6f875884e04b91b36840b991ce4509f9bf560367;p=binutils-gdb.git 2010-05-24 Tristan Gingold * readelf.c (usage): Add new trace sections for --debug-dump. (process_section_headers): Handle dump of trace sections. * objdump.c (usage): Add new trace sections for --dwarf. * dwarf.h (do_trace_info, do_trace_abbrevs): New variables. (do_trace_aranges): Ditto. (enum dwarf_section_display_enum): Add trace_info, trace_abbrev and trace_aranges literals. * dwarf.c (do_trace_info, do_trace_abbrevs): New variables. (do_trace_aranges): Ditto. (process_debug_info): Add abbrev_sec argument and replace abbrev with abbrev_sec. (load_debug_info): Adjust call of process_debug_info. (display_debug_info): Ditto. (display_trace_info): New function. (dwarf_select_sections_by_names): Add trace_info, trace_abbrevs and trace_aranges sections name. (dwarf_select_sections_all): Also select trace sections. (debug_displays): Reindent. Add entries for the trace sections. * doc/binutils.texi (readelf): Document new --dwarf parameters. (objdump): Ditto. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 9c8d87cecf9..2c2a060e054 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,26 @@ +2010-05-24 Tristan Gingold + + * readelf.c (usage): Add new trace sections for --debug-dump. + (process_section_headers): Handle dump of trace sections. + * objdump.c (usage): Add new trace sections for --dwarf. + * dwarf.h (do_trace_info, do_trace_abbrevs): New variables. + (do_trace_aranges): Ditto. + (enum dwarf_section_display_enum): Add trace_info, trace_abbrev + and trace_aranges literals. + * dwarf.c (do_trace_info, do_trace_abbrevs): New variables. + (do_trace_aranges): Ditto. + (process_debug_info): Add abbrev_sec argument and replace + abbrev with abbrev_sec. + (load_debug_info): Adjust call of process_debug_info. + (display_debug_info): Ditto. + (display_trace_info): New function. + (dwarf_select_sections_by_names): Add trace_info, trace_abbrevs + and trace_aranges sections name. + (dwarf_select_sections_all): Also select trace sections. + (debug_displays): Reindent. Add entries for the trace sections. + * doc/binutils.texi (readelf): Document new --dwarf parameters. + (objdump): Ditto. + 2010-05-18 H.J. Lu PR gas/11600 diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index a3c2f998be8..9f374f8dc21 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -1707,7 +1707,7 @@ objdump [@option{-a}|@option{--archive-headers}] [@option{-R}|@option{--dynamic-reloc}] [@option{-s}|@option{--full-contents}] [@option{-W[lLiaprmfFsoRt]}| - @option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes]] + @option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges]] [@option{-G}|@option{--stabs}] [@option{-t}|@option{--syms}] [@option{-T}|@option{--dynamic-syms}] @@ -2080,13 +2080,16 @@ Display @var{width} bytes on a single line when disassembling instructions. @item -W[lLiaprmfFsoRt] -@itemx --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes] +@itemx --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges] @cindex DWARF @cindex debug symbols Displays the contents of the debug sections in the file, if any are present. If one of the optional letters or words follows the switch then only data found in those specific sections will be dumped. +Note that there is no single letter option to display the content of +trace sections. + @item -G @itemx --stabs @cindex stab @@ -3907,7 +3910,7 @@ readelf [@option{-a}|@option{--all}] [@option{-R} |@option{--relocated-dump=}] [@option{-c}|@option{--archive-index}] [@option{-w[lLiaprmfFsoRt]}| - @option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes]] + @option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges]] [@option{-I}|@option{--histogram}] [@option{-v}|@option{--version}] [@option{-W}|@option{--wide}] @@ -4059,11 +4062,14 @@ of binary archives. Performs the same function as the @option{t} command to @command{ar}, but without using the BFD library. @xref{ar}. @item -w[lLiaprmfFsoRt] -@itemx --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes] +@itemx --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges] Displays the contents of the debug sections in the file, if any are present. If one of the optional letters or words follows the switch then only data found in those specific sections will be dumped. +Note that there is no single letter option to display the content of +trace sections. + Note: the @option{=decodedline} option will display the interpreted contents of a .debug_line section whereas the @option{=rawline} option dumps the contents in a raw format. diff --git a/binutils/dwarf.c b/binutils/dwarf.c index af5a507db1f..c5921528fcf 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -53,6 +53,9 @@ int do_debug_frames_interp; int do_debug_macinfo; int do_debug_str; int do_debug_loc; +int do_trace_info; +int do_trace_abbrevs; +int do_trace_aranges; int do_wide; /* Values for do_debug_lines. */ @@ -1873,6 +1876,7 @@ read_and_display_attr (unsigned long attribute, static int process_debug_info (struct dwarf_section *section, void *file, + enum dwarf_section_display_enum abbrev_sec, int do_loc, int do_types) { @@ -1944,11 +1948,11 @@ process_debug_info (struct dwarf_section *section, load_debug_section (str, file); } - load_debug_section (abbrev, file); - if (debug_displays [abbrev].section.start == NULL) + load_debug_section (abbrev_sec, file); + if (debug_displays [abbrev_sec].section.start == NULL) { warn (_("Unable to locate %s section!\n"), - debug_displays [abbrev].section.name); + debug_displays [abbrev_sec].section.name); return 0; } @@ -2066,16 +2070,17 @@ process_debug_info (struct dwarf_section *section, /* Process the abbrevs used by this compilation unit. DWARF sections under Mach-O have non-zero addresses. */ - if (compunit.cu_abbrev_offset >= debug_displays [abbrev].section.size) + if (compunit.cu_abbrev_offset >= debug_displays [abbrev_sec].section.size) warn (_("Debug info is corrupted, abbrev offset (%lx) is larger than abbrev section size (%lx)\n"), (unsigned long) compunit.cu_abbrev_offset, - (unsigned long) debug_displays [abbrev].section.size); + (unsigned long) debug_displays [abbrev_sec].section.size); else process_abbrev_section - ((unsigned char *) debug_displays [abbrev].section.start - + compunit.cu_abbrev_offset - debug_displays [abbrev].section.address, - (unsigned char *) debug_displays [abbrev].section.start - + debug_displays [abbrev].section.size); + ((unsigned char *) debug_displays [abbrev_sec].section.start + + compunit.cu_abbrev_offset + - debug_displays [abbrev_sec].section.address, + (unsigned char *) debug_displays [abbrev_sec].section.start + + debug_displays [abbrev_sec].section.size); level = 0; while (tags < start) @@ -2226,7 +2231,7 @@ load_debug_info (void * file) return num_debug_info_entries; if (load_debug_section (info, file) - && process_debug_info (&debug_displays [info].section, file, 1, 0)) + && process_debug_info (&debug_displays [info].section, file, abbrev, 1, 0)) return num_debug_info_entries; num_debug_info_entries = DEBUG_INFO_UNAVAILABLE; @@ -3588,13 +3593,19 @@ display_debug_str (struct dwarf_section *section, static int display_debug_info (struct dwarf_section *section, void *file) { - return process_debug_info (section, file, 0, 0); + return process_debug_info (section, file, abbrev, 0, 0); } static int display_debug_types (struct dwarf_section *section, void *file) { - return process_debug_info (section, file, 0, 1); + return process_debug_info (section, file, abbrev, 0, 1); +} + +static int +display_trace_info (struct dwarf_section *section, void *file) +{ + return process_debug_info (section, file, trace_abbrev, 0, 0); } static int @@ -5035,6 +5046,10 @@ dwarf_select_sections_by_names (const char *names) with earlier versions of readelf. */ { "ranges", & do_debug_aranges, 1 }, { "str", & do_debug_str, 1 }, + /* These trace_* sections are used by Itanium VMS. */ + { "trace_abbrev", & do_trace_abbrevs, 1 }, + { "trace_aranges", & do_trace_aranges, 1 }, + { "trace_info", & do_trace_info, 1 }, { NULL, NULL, 0 } }; @@ -5155,40 +5170,49 @@ dwarf_select_sections_all (void) do_debug_macinfo = 1; do_debug_str = 1; do_debug_loc = 1; + do_trace_info = 1; + do_trace_abbrevs = 1; + do_trace_aranges = 1; } struct dwarf_section_display debug_displays[] = { - { { ".debug_abbrev", ".zdebug_abbrev", NULL, NULL, 0, 0 }, + { { ".debug_abbrev", ".zdebug_abbrev", NULL, NULL, 0, 0 }, display_debug_abbrev, &do_debug_abbrevs, 0 }, - { { ".debug_aranges", ".zdebug_aranges", NULL, NULL, 0, 0 }, + { { ".debug_aranges", ".zdebug_aranges", NULL, NULL, 0, 0 }, display_debug_aranges, &do_debug_aranges, 1 }, - { { ".debug_frame", ".zdebug_frame", NULL, NULL, 0, 0 }, + { { ".debug_frame", ".zdebug_frame", NULL, NULL, 0, 0 }, display_debug_frames, &do_debug_frames, 1 }, - { { ".debug_info", ".zdebug_info", NULL, NULL, 0, 0 }, + { { ".debug_info", ".zdebug_info", NULL, NULL, 0, 0 }, display_debug_info, &do_debug_info, 1 }, - { { ".debug_line", ".zdebug_line", NULL, NULL, 0, 0 }, + { { ".debug_line", ".zdebug_line", NULL, NULL, 0, 0 }, display_debug_lines, &do_debug_lines, 1 }, - { { ".debug_pubnames", ".zdebug_pubnames", NULL, NULL, 0, 0 }, + { { ".debug_pubnames", ".zdebug_pubnames", NULL, NULL, 0, 0 }, display_debug_pubnames, &do_debug_pubnames, 0 }, - { { ".eh_frame", "", NULL, NULL, 0, 0 }, + { { ".eh_frame", "", NULL, NULL, 0, 0 }, display_debug_frames, &do_debug_frames, 1 }, - { { ".debug_macinfo", ".zdebug_macinfo", NULL, NULL, 0, 0 }, + { { ".debug_macinfo", ".zdebug_macinfo", NULL, NULL, 0, 0 }, display_debug_macinfo, &do_debug_macinfo, 0 }, - { { ".debug_str", ".zdebug_str", NULL, NULL, 0, 0 }, + { { ".debug_str", ".zdebug_str", NULL, NULL, 0, 0 }, display_debug_str, &do_debug_str, 0 }, - { { ".debug_loc", ".zdebug_loc", NULL, NULL, 0, 0 }, + { { ".debug_loc", ".zdebug_loc", NULL, NULL, 0, 0 }, display_debug_loc, &do_debug_loc, 1 }, - { { ".debug_pubtypes", ".zdebug_pubtypes", NULL, NULL, 0, 0 }, + { { ".debug_pubtypes", ".zdebug_pubtypes", NULL, NULL, 0, 0 }, display_debug_pubnames, &do_debug_pubtypes, 0 }, - { { ".debug_ranges", ".zdebug_ranges", NULL, NULL, 0, 0 }, + { { ".debug_ranges", ".zdebug_ranges", NULL, NULL, 0, 0 }, display_debug_ranges, &do_debug_ranges, 1 }, - { { ".debug_static_func", ".zdebug_static_func", NULL, NULL, 0, 0 }, + { { ".debug_static_func", ".zdebug_static_func", NULL, NULL, 0, 0 }, display_debug_not_supported, NULL, 0 }, - { { ".debug_static_vars", ".zdebug_static_vars", NULL, NULL, 0, 0 }, + { { ".debug_static_vars", ".zdebug_static_vars", NULL, NULL, 0, 0 }, display_debug_not_supported, NULL, 0 }, - { { ".debug_types", ".zdebug_types", NULL, NULL, 0, 0 }, + { { ".debug_types", ".zdebug_types", NULL, NULL, 0, 0 }, display_debug_types, &do_debug_info, 1 }, - { { ".debug_weaknames", ".zdebug_weaknames", NULL, NULL, 0, 0 }, - display_debug_not_supported, NULL, 0 } + { { ".debug_weaknames", ".zdebug_weaknames", NULL, NULL, 0, 0 }, + display_debug_not_supported, NULL, 0 }, + { { ".trace_info", "", NULL, NULL, 0, 0 }, + display_trace_info, &do_trace_info, 1 }, + { { ".trace_abbrev", "", NULL, NULL, 0, 0 }, + display_debug_abbrev, &do_trace_abbrevs, 0 }, + { { ".trace_aranges", "", NULL, NULL, 0, 0 }, + display_debug_aranges, &do_trace_aranges, 0 } }; diff --git a/binutils/dwarf.h b/binutils/dwarf.h index 1ad96abd942..58ecc67b266 100644 --- a/binutils/dwarf.h +++ b/binutils/dwarf.h @@ -71,6 +71,9 @@ enum dwarf_section_display_enum static_vars, types, weaknames, + trace_info, + trace_abbrev, + trace_aranges, max }; @@ -113,6 +116,9 @@ extern int do_debug_frames_interp; extern int do_debug_macinfo; extern int do_debug_str; extern int do_debug_loc; +extern int do_trace_info; +extern int do_trace_abbrevs; +extern int do_trace_aranges; extern int do_wide; extern void init_dwarf_regnames (unsigned int); diff --git a/binutils/objdump.c b/binutils/objdump.c index 44d363bb025..2a419b7a1a0 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -205,7 +205,8 @@ usage (FILE *stream, int status) -G, --stabs Display (in raw form) any STABS info in the file\n\ -W[lLiaprmfFsoRt] or\n\ --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,\n\ - =frames-interp,=str,=loc,=Ranges,=pubtypes]\n\ + =frames-interp,=str,=loc,=Ranges,=pubtypes,\n\ + =trace_info,=trace_abbrev,=trace_aranges]\n\ Display DWARF info in the file\n\ -t, --syms Display the contents of the symbol table(s)\n\ -T, --dynamic-syms Display the contents of the dynamic symbol table\n\ diff --git a/binutils/readelf.c b/binutils/readelf.c index bcb24c2d00c..9c3e2dc5b79 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -3141,7 +3141,8 @@ usage (FILE * stream) Dump the contents of section as relocated bytes\n\ -w[lLiaprmfFsoRt] or\n\ --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,\n\ - =frames-interp,=str,=loc,=Ranges,=pubtypes]\n\ + =frames-interp,=str,=loc,=Ranges,=pubtypes,\n\ + =trace_info,=trace_abbrev,=trace_aranges]\n\ Display the contents of DWARF2 debug sections\n")); #ifdef SUPPORT_DISASSEMBLY fprintf (stream, _("\ @@ -4539,6 +4540,21 @@ process_section_headers (FILE * file) request_dump_bynumber (i, DEBUG_DUMP); else if (do_debug_frames && streq (name, ".eh_frame")) request_dump_bynumber (i, DEBUG_DUMP); + /* Trace sections for Itanium VMS. */ + else if ((do_debugging || do_trace_info || do_trace_abbrevs + || do_trace_aranges) + && const_strneq (name, ".trace_")) + { + name += sizeof (".trace_") - 1; + + if (do_debugging + || (do_trace_info && streq (name, "info")) + || (do_trace_abbrevs && streq (name, "abbrev")) + || (do_trace_aranges && streq (name, "aranges")) + ) + request_dump_bynumber (i, DEBUG_DUMP); + } + } if (! do_sections)