X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=binutils%2Fobjdump.c;h=f94dee968e27ce452351de71cd50d4fbfa081050;hb=8ea5bce59057ef1906bf1180843c0900b191dcab;hp=b53d4ebe92c4ac1bd546c77ca19e07b884aa325b;hpb=70ecb3842d3c4b2836c8b007743d996a2d6bef16;p=binutils-gdb.git diff --git a/binutils/objdump.c b/binutils/objdump.c index b53d4ebe92c..f94dee968e2 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\ @@ -1457,7 +1458,6 @@ disassemble_bytes (struct disassemble_info * inf, struct objdump_disasm_info *aux; asection *section; int octets_per_line; - bfd_boolean done_dot; int skip_addr_chars; bfd_vma addr_offset; unsigned int opb = inf->octets_per_byte; @@ -1504,7 +1504,6 @@ disassemble_bytes (struct disassemble_info * inf, inf->insn_info_valid = 0; - done_dot = FALSE; addr_offset = start_offset; while (addr_offset < stop_offset) { @@ -1516,6 +1515,9 @@ disassemble_bytes (struct disassemble_info * inf, previous_octets = octets; octets = 0; + /* Make sure we don't use relocs from previous instructions. */ + aux->reloc = NULL; + /* If we see more than SKIP_ZEROES octets of zeroes, we just print `...'. */ for (z = addr_offset * opb; z < stop_offset * opb; z++) @@ -1554,8 +1556,6 @@ disassemble_bytes (struct disassemble_info * inf, int bpc = 0; int pb = 0; - done_dot = FALSE; - if (with_line_numbers || with_source_code) show_line (aux->abfd, section, addr_offset); @@ -1619,8 +1619,6 @@ disassemble_bytes (struct disassemble_info * inf, inf->flags |= INSN_HAS_RELOC; aux->reloc = **relppp; } - else - aux->reloc = NULL; } octets = (*disassemble_fn) (section->vma + addr_offset, inf); @@ -2207,14 +2205,8 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, section->size = bfd_get_section_size (sec); section->start = (unsigned char *) xmalloc (section->size); - if (is_relocatable && debug_displays [debug].relocate) - ret = bfd_simple_get_relocated_section_contents (abfd, - sec, - section->start, - syms) != NULL; - else - ret = bfd_get_section_contents (abfd, sec, section->start, 0, - section->size); + ret = bfd_get_section_contents (abfd, sec, section->start, 0, + section->size); if (! ret) { @@ -2236,6 +2228,30 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, section->size = size; } + if (is_relocatable && debug_displays [debug].relocate) + { + /* We want to relocate the data we've already read (and + decompressed), so we store a pointer to the data in + the bfd_section, and tell it that the contents are + already in memory. */ + sec->contents = section->start; + sec->flags |= SEC_IN_MEMORY; + sec->size = section->size; + + ret = bfd_simple_get_relocated_section_contents (abfd, + sec, + section->start, + syms) != NULL; + + if (! ret) + { + free_debug_section (debug); + printf (_("\nCan't get contents for section '%s'.\n"), + section->name); + return 0; + } + } + return 1; }