* objdump.c (objdump_print_addr): If displaying file offsets, show
the offset even if there are no symbols available. (dump_section): Display nothing if none of the section is going to be dumped. Display the file offset, if requested, of the location from where the dump starts. * doc/binutils.texi (objdump): Mention that dumping via the -s switch is also affected by the -F option.
This commit is contained in:
parent
625af618e7
commit
3276085244
3 changed files with 32 additions and 11 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
2008-02-26 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
* objdump.c (objdump_print_addr): If displaying file offsets, show
|
||||||
|
the offset even if there are no symbols available.
|
||||||
|
(dump_section): Display nothing if none of the section is going to
|
||||||
|
be dumped. Display the file offset, if requested, of the location
|
||||||
|
from where the dump starts.
|
||||||
|
* doc/binutils.texi (objdump): Mention that dumping via the -s
|
||||||
|
switch is also affected by the -F option.
|
||||||
|
|
||||||
2008-02-26 Nick Clifton <nickc@redhat.com>
|
2008-02-26 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
Re-apply this patch which was accidentally deleted:
|
Re-apply this patch which was accidentally deleted:
|
||||||
|
|
|
@ -1723,7 +1723,8 @@ When disassembling sections, whenever a symbol is displayed, also
|
||||||
display the file offset of the region of data that is about to be
|
display the file offset of the region of data that is about to be
|
||||||
dumped. If zeroes are being skipped, then when disassembly resumes,
|
dumped. If zeroes are being skipped, then when disassembly resumes,
|
||||||
tell the user how many zeroes were skipped and the file offset of the
|
tell the user how many zeroes were skipped and the file offset of the
|
||||||
location from where the disassembly resumes.
|
location from where the disassembly resumes. When dumping sections,
|
||||||
|
display the file offset of the location from where the dump starts.
|
||||||
|
|
||||||
@item --file-start-context
|
@item --file-start-context
|
||||||
@cindex source code context
|
@cindex source code context
|
||||||
|
|
|
@ -864,7 +864,7 @@ objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (display_file_offsets)
|
if (display_file_offsets)
|
||||||
info->fprintf_func (info->stream, " (File Offset: 0x%lx)",
|
info->fprintf_func (info->stream, _(" (File Offset: 0x%lx)"),
|
||||||
(long int)(sec->filepos + (vma - sec->vma)));
|
(long int)(sec->filepos + (vma - sec->vma)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,18 +877,22 @@ objdump_print_addr (bfd_vma vma,
|
||||||
bfd_boolean skip_zeroes)
|
bfd_boolean skip_zeroes)
|
||||||
{
|
{
|
||||||
struct objdump_disasm_info *aux;
|
struct objdump_disasm_info *aux;
|
||||||
asymbol *sym = NULL; /* Initialize to avoid compiler warning. */
|
asymbol *sym;
|
||||||
bfd_boolean skip_find = FALSE;
|
bfd_boolean skip_find = FALSE;
|
||||||
|
|
||||||
|
aux = (struct objdump_disasm_info *) info->application_data;
|
||||||
|
|
||||||
if (sorted_symcount < 1)
|
if (sorted_symcount < 1)
|
||||||
{
|
{
|
||||||
(*info->fprintf_func) (info->stream, "0x");
|
(*info->fprintf_func) (info->stream, "0x");
|
||||||
objdump_print_value (vma, info, skip_zeroes);
|
objdump_print_value (vma, info, skip_zeroes);
|
||||||
|
|
||||||
|
if (display_file_offsets)
|
||||||
|
info->fprintf_func (info->stream, _(" (File Offset: 0x%lx)"),
|
||||||
|
(long int)(aux->sec->filepos + (vma - aux->sec->vma)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aux = (struct objdump_disasm_info *) info->application_data;
|
|
||||||
|
|
||||||
if (aux->reloc != NULL
|
if (aux->reloc != NULL
|
||||||
&& aux->reloc->sym_ptr_ptr != NULL
|
&& aux->reloc->sym_ptr_ptr != NULL
|
||||||
&& * aux->reloc->sym_ptr_ptr != NULL)
|
&& * aux->reloc->sym_ptr_ptr != NULL)
|
||||||
|
@ -2464,12 +2468,6 @@ dump_section (bfd *abfd, asection *section, void *dummy ATTRIBUTE_UNUSED)
|
||||||
if ((datasize = bfd_section_size (abfd, section)) == 0)
|
if ((datasize = bfd_section_size (abfd, section)) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf (_("Contents of section %s:\n"), section->name);
|
|
||||||
|
|
||||||
data = xmalloc (datasize);
|
|
||||||
|
|
||||||
bfd_get_section_contents (abfd, section, data, 0, datasize);
|
|
||||||
|
|
||||||
/* Compute the address range to display. */
|
/* Compute the address range to display. */
|
||||||
if (start_address == (bfd_vma) -1
|
if (start_address == (bfd_vma) -1
|
||||||
|| start_address < section->vma)
|
|| start_address < section->vma)
|
||||||
|
@ -2490,6 +2488,18 @@ dump_section (bfd *abfd, asection *section, void *dummy ATTRIBUTE_UNUSED)
|
||||||
stop_offset = datasize / opb;
|
stop_offset = datasize / opb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (start_offset >= stop_offset)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printf (_("Contents of section %s:"), section->name);
|
||||||
|
if (display_file_offsets)
|
||||||
|
printf (_(" (Starting at file offset: 0x%lx)"), (long int)(section->filepos + start_offset));
|
||||||
|
printf ("\n");
|
||||||
|
|
||||||
|
data = xmalloc (datasize);
|
||||||
|
|
||||||
|
bfd_get_section_contents (abfd, section, data, 0, datasize);
|
||||||
|
|
||||||
width = 4;
|
width = 4;
|
||||||
|
|
||||||
bfd_sprintf_vma (abfd, buf, start_offset + section->vma);
|
bfd_sprintf_vma (abfd, buf, start_offset + section->vma);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue