* objdump.c (dump_data): Don't truncate the address to long; make
the width large enough, and uniform for all entries in a section.
This commit is contained in:
parent
6e84a90684
commit
335a186916
2 changed files with 44 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2003-03-31 Alexandre Oliva <aoliva@redhat.com>
|
||||||
|
|
||||||
|
* objdump.c (dump_data): Don't truncate the address to long; make
|
||||||
|
the width large enough, and uniform for all entries in a section.
|
||||||
|
|
||||||
2003-03-31 H.J. Lu <hjl@gnu.org>
|
2003-03-31 H.J. Lu <hjl@gnu.org>
|
||||||
|
|
||||||
* readelf.c: Include "libiberty.h".
|
* readelf.c: Include "libiberty.h".
|
||||||
|
|
|
@ -2227,6 +2227,9 @@ dump_data (abfd)
|
||||||
{
|
{
|
||||||
if (section->flags & SEC_HAS_CONTENTS)
|
if (section->flags & SEC_HAS_CONTENTS)
|
||||||
{
|
{
|
||||||
|
char buf[64];
|
||||||
|
int count, width;
|
||||||
|
|
||||||
printf (_("Contents of section %s:\n"), section->name);
|
printf (_("Contents of section %s:\n"), section->name);
|
||||||
|
|
||||||
if (bfd_section_size (abfd, section) == 0)
|
if (bfd_section_size (abfd, section) == 0)
|
||||||
|
@ -2253,13 +2256,47 @@ dump_data (abfd)
|
||||||
if (stop_offset > bfd_section_size (abfd, section) / opb)
|
if (stop_offset > bfd_section_size (abfd, section) / opb)
|
||||||
stop_offset = bfd_section_size (abfd, section) / opb;
|
stop_offset = bfd_section_size (abfd, section) / opb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
width = 4;
|
||||||
|
|
||||||
|
bfd_sprintf_vma (abfd, buf, start_offset + section->vma);
|
||||||
|
if (strlen (buf) >= sizeof (buf))
|
||||||
|
abort ();
|
||||||
|
count = 0;
|
||||||
|
while (buf[count] == '0' && buf[count+1] != '\0')
|
||||||
|
count++;
|
||||||
|
count = strlen (buf) - count;
|
||||||
|
if (count > width)
|
||||||
|
width = count;
|
||||||
|
|
||||||
|
bfd_sprintf_vma (abfd, buf, stop_offset + section->vma - 1);
|
||||||
|
if (strlen (buf) >= sizeof (buf))
|
||||||
|
abort ();
|
||||||
|
count = 0;
|
||||||
|
while (buf[count] == '0' && buf[count+1] != '\0')
|
||||||
|
count++;
|
||||||
|
count = strlen (buf) - count;
|
||||||
|
if (count > width)
|
||||||
|
width = count;
|
||||||
|
|
||||||
for (addr_offset = start_offset;
|
for (addr_offset = start_offset;
|
||||||
addr_offset < stop_offset; addr_offset += onaline / opb)
|
addr_offset < stop_offset; addr_offset += onaline / opb)
|
||||||
{
|
{
|
||||||
bfd_size_type j;
|
bfd_size_type j;
|
||||||
|
|
||||||
printf (" %04lx ", (unsigned long int)
|
bfd_sprintf_vma (abfd, buf, (addr_offset + section->vma));
|
||||||
(addr_offset + section->vma));
|
count = strlen (buf);
|
||||||
|
if (count >= sizeof (buf))
|
||||||
|
abort ();
|
||||||
|
putchar (' ');
|
||||||
|
while (count < width)
|
||||||
|
{
|
||||||
|
putchar ('0');
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
fputs (buf + count - width, stdout);
|
||||||
|
putchar (' ');
|
||||||
|
|
||||||
for (j = addr_offset * opb;
|
for (j = addr_offset * opb;
|
||||||
j < addr_offset * opb + onaline; j++)
|
j < addr_offset * opb + onaline; j++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue