aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-06-19 10:23:39 +0000
committerNick Clifton <nickc@redhat.com>2003-06-19 10:23:39 +0000
commitb19aac67f88b9d48ac9b91f89afbab18ce6b2f77 (patch)
treee912bb4cae76a3dc25309f18dcac350ab89d2993 /binutils/readelf.c
parent4add8633611b5b873029a4b736aeb4bf72aef5ea (diff)
downloadgdb-b19aac67f88b9d48ac9b91f89afbab18ce6b2f77.zip
gdb-b19aac67f88b9d48ac9b91f89afbab18ce6b2f77.tar.gz
gdb-b19aac67f88b9d48ac9b91f89afbab18ce6b2f77.tar.bz2
When printing DEC_5 values, if the number is bigger than 99999 switch to using
hexadecimal notation.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 8e8d39e..16bc44e 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -624,13 +624,34 @@ print_vma (vma, mode)
{
switch (mode)
{
- case FULL_HEX: printf ("0x"); /* drop through */
- case LONG_HEX: printf ("%8.8lx", (unsigned long) vma); break;
- case PREFIX_HEX: printf ("0x"); /* drop through */
- case HEX: printf ("%lx", (unsigned long) vma); break;
- case DEC: printf ("%ld", (unsigned long) vma); break;
- case DEC_5: printf ("%5ld", (long) vma); break;
- case UNSIGNED: printf ("%lu", (unsigned long) vma); break;
+ case FULL_HEX:
+ printf ("0x");
+ /* Drop through. */
+ case LONG_HEX:
+ printf ("%8.8lx", (unsigned long) vma);
+ break;
+
+ case DEC_5:
+ if (vma <= 99999)
+ {
+ printf ("** %5ld", (long) vma);
+ break;
+ }
+ /* Drop through. */
+ case PREFIX_HEX:
+ printf ("0x");
+ /* Drop through. */
+ case HEX:
+ printf ("%lx", (unsigned long) vma);
+ break;
+
+ case DEC:
+ printf ("%ld", (unsigned long) vma);
+ break;
+
+ case UNSIGNED:
+ printf ("%lu", (unsigned long) vma);
+ break;
}
}
#ifdef BFD64
@@ -640,7 +661,7 @@ print_vma (vma, mode)
{
case FULL_HEX:
printf ("0x");
- /* drop through */
+ /* Drop through. */
case LONG_HEX:
printf_vma (vma);
@@ -648,7 +669,7 @@ print_vma (vma, mode)
case PREFIX_HEX:
printf ("0x");
- /* drop through */
+ /* Drop through. */
case HEX:
#if BFD_HOST_64BIT_LONG
@@ -675,13 +696,18 @@ print_vma (vma, mode)
case DEC_5:
#if BFD_HOST_64BIT_LONG
- printf ("%5ld", vma);
+ if (vma <= 99999)
+ printf ("%5ld", vma);
+ else
+ printf ("%#lx", vma);
#else
if (_bfd_int64_high (vma))
/* ugg */
printf ("++%ld", _bfd_int64_low (vma));
- else
+ else if (vma <= 99999)
printf ("%5ld", _bfd_int64_low (vma));
+ else
+ printf ("%#lx", _bfd_int64_low (vma));
#endif
break;