X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=binutils%2Fobjdump.c;h=231a66867a70c135823e6fae4ea384497e88f733;hb=fd2f003344354839663892f45f831a2dbfb71f17;hp=da68eebf9ab046447623653dd307a8133032a84e;hpb=3284fe0c5e852fb8a3a06630c161b9633b9f6682;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/objdump.c b/binutils/objdump.c index da68eebf9a..231a66867a 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -1,6 +1,6 @@ /* objdump.c -- dump information about an object file. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -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 */ @@ -207,7 +208,7 @@ usage (FILE *stream, int status) -W[lLiaprmfFsoRt] or\n\ --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,\n\ =frames-interp,=str,=loc,=Ranges,=pubtypes,\n\ - =trace_info,=trace_abbrev,=trace_aranges]\n\ + =gdb_index,=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\ @@ -242,12 +243,15 @@ usage (FILE *stream, int status) --stop-address=ADDR Only process data whose address is <= ADDR\n\ --prefix-addresses Print complete address alongside disassembly\n\ --[no-]show-raw-insn Display hex alongside symbolic disassembly\n\ - --insn-width=WIDTH Display WIDTH bytes on a signle line for -d\n\ + --insn-width=WIDTH Display WIDTH bytes on a single line for -d\n\ --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} }; @@ -1348,7 +1356,7 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset) unsigned l; for (pp = &print_files; *pp != NULL; pp = &(*pp)->next) - if (strcmp ((*pp)->filename, filename) == 0) + if (filename_cmp ((*pp)->filename, filename) == 0) break; p = *pp; @@ -2829,6 +2837,7 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) unsigned int linenumber; const char *sym_name; const char *section_name; + bfd_vma addend2 = 0; if (start_address != (bfd_vma) -1 && q->address < start_address) @@ -2856,7 +2865,7 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) && (linenumber != last_line || (filename != NULL && last_filename != NULL - && strcmp (filename, last_filename) != 0))) + && filename_cmp (filename, last_filename) != 0))) { printf ("%s:%u\n", filename == NULL ? "???" : filename, linenumber); last_line = linenumber; @@ -2884,7 +2893,37 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) if (q->howto == NULL) printf (" *unknown* "); else if (q->howto->name) - printf (" %-16s ", q->howto->name); + { + const char *name = q->howto->name; + + /* R_SPARC_OLO10 relocations contain two addends. + But because 'arelent' lacks enough storage to + store them both, the 64-bit ELF Sparc backend + records this as two relocations. One R_SPARC_LO10 + and one R_SPARC_13, both pointing to the same + address. This is merely so that we have some + place to store both addend fields. + + Undo this transformation, otherwise the output + will be confusing. */ + if (abfd->xvec->flavour == bfd_target_elf_flavour + && elf_tdata(abfd)->elf_header->e_machine == EM_SPARCV9 + && relcount > 1 + && !strcmp (q->howto->name, "R_SPARC_LO10")) + { + arelent *q2 = *(p + 1); + if (q2 != NULL + && q2->howto + && q->address == q2->address + && !strcmp (q2->howto->name, "R_SPARC_13")) + { + name = "R_SPARC_OLO10"; + addend2 = q2->addend; + p++; + } + } + printf (" %-16s ", name); + } else printf (" %-16d ", q->howto->type); @@ -2904,9 +2943,19 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) printf ("+0x"); bfd_printf_vma (abfd, q->addend); } + if (addend2) + { + printf ("+0x"); + bfd_printf_vma (abfd, addend2); + } printf ("\n"); } + + if (last_filename != NULL) + free (last_filename); + if (last_functionname != NULL) + free (last_functionname); } static void @@ -3038,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) @@ -3047,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); @@ -3435,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;