diff options
author | Tom Tromey <tromey@redhat.com> | 2011-04-28 17:23:17 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2011-04-28 17:23:17 +0000 |
commit | fd2f003344354839663892f45f831a2dbfb71f17 (patch) | |
tree | 437ab6acaf1927f35da633fa05bb0c55fef8e09d /binutils/objdump.c | |
parent | 82ae827f9b172b560568b814719b0cf0e56d0375 (diff) | |
download | gdb-fd2f003344354839663892f45f831a2dbfb71f17.zip gdb-fd2f003344354839663892f45f831a2dbfb71f17.tar.gz gdb-fd2f003344354839663892f45f831a2dbfb71f17.tar.bz2 |
* NEWS: Add note about --dwarf-depth, --dwarf-start, and
dwarf-mode.el.
* objdump.c (suppress_bfd_header): New global.
(usage): Update.
(OPTION_DWARF_DEPTH, OPTION_DWARF_START): New constants.
(options): Add dwarf-depth and dwarf-start entries.
(dump_bfd): Use suppress_bfd_header.
(main): Handle OPTION_DWARF_START, OPTION_DWARF_DEPTH.
* doc/binutils.texi (objcopy): Document --dwarf-depth and
--dwarf-start.
(readelf): Likewise.
* dwarf-mode.el: New file.
* dwarf.c (dwarf_cutoff_level, dwarf_start_die): New globals.
(read_and_display_attr_value): Also check debug_info_p.
(process_debug_info): Handle dwarf_start_die and
dwarf_cutoff_level.
* dwarf.h (dwarf_cutoff_level, dwarf_start_die): Declare.
* readelf.c (usage): Update.
(OPTION_DWARF_DEPTH): New macro.
(OPTION_DWARF_START): Likewise.
(options): Add dwarf-depth and dwarf-start entries.
(parse_args): Handle OPTION_DWARF_START and OPTION_DWARF_DEPTH.
testsuite
* binutils-all/objdump.W: Correct output.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r-- | binutils/objdump.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c index 8b6bc28..231a668 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -110,6 +110,7 @@ static bfd_vma start_address = (bfd_vma) -1; /* --start-address */ static bfd_vma stop_address = (bfd_vma) -1; /* --stop-address */ static int dump_debugging; /* --debugging */ static int dump_debugging_tags; /* --debugging-tags */ +static int suppress_bfd_header; static int dump_special_syms = 0; /* --special-syms */ static bfd_vma adjust_section_vma = 0; /* --adjust-vma */ static int file_start_context = 0; /* --file-start-context */ @@ -246,8 +247,11 @@ usage (FILE *stream, int status) --adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n\ --special-syms Include special symbols in symbol dumps\n\ --prefix=PREFIX Add PREFIX to absolute paths for -S\n\ - --prefix-strip=LEVEL Strip initial directory names for -S\n\ -\n")); + --prefix-strip=LEVEL Strip initial directory names for -S\n")); + fprintf (stream, _("\ + --dwarf-depth=N Do not display DIEs at depth N or greater\n\ + --dwarf-start=N Display DIEs starting with N, at the same depth\n\ + or deeper\n\n")); list_supported_targets (program_name, stream); list_supported_architectures (program_name, stream); @@ -268,7 +272,9 @@ enum option_values OPTION_PREFIX, OPTION_PREFIX_STRIP, OPTION_INSN_WIDTH, - OPTION_ADJUST_VMA + OPTION_ADJUST_VMA, + OPTION_DWARF_DEPTH, + OPTION_DWARF_START }; static struct option long_options[]= @@ -316,6 +322,8 @@ static struct option long_options[]= {"prefix", required_argument, NULL, OPTION_PREFIX}, {"prefix-strip", required_argument, NULL, OPTION_PREFIX_STRIP}, {"insn-width", required_argument, NULL, OPTION_INSN_WIDTH}, + {"dwarf-depth", required_argument, 0, OPTION_DWARF_DEPTH}, + {"dwarf-start", required_argument, 0, OPTION_DWARF_START}, {0, no_argument, 0, 0} }; @@ -3079,7 +3087,7 @@ dump_bfd (bfd *abfd) bfd_map_over_sections (abfd, adjust_addresses, &has_reloc); } - if (! dump_debugging_tags) + if (! dump_debugging_tags && ! suppress_bfd_header) printf (_("\n%s: file format %s\n"), bfd_get_filename (abfd), abfd->xvec->name); if (dump_ar_hdrs) @@ -3088,7 +3096,7 @@ dump_bfd (bfd *abfd) dump_bfd_header (abfd); if (dump_private_headers) dump_bfd_private_header (abfd); - if (! dump_debugging_tags) + if (! dump_debugging_tags && ! suppress_bfd_header) putchar ('\n'); if (dump_section_headers) dump_headers (abfd); @@ -3476,6 +3484,19 @@ main (int argc, char **argv) else dwarf_select_sections_all (); break; + case OPTION_DWARF_DEPTH: + { + char *cp; + dwarf_cutoff_level = strtoul (optarg, & cp, 0); + } + break; + case OPTION_DWARF_START: + { + char *cp; + dwarf_start_die = strtoul (optarg, & cp, 0); + suppress_bfd_header = 1; + } + break; case 'G': dump_stab_section_info = TRUE; seenflag = TRUE; |