From b19aac67f88b9d48ac9b91f89afbab18ce6b2f77 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 19 Jun 2003 10:23:39 +0000 Subject: When printing DEC_5 values, if the number is bigger than 99999 switch to using hexadecimal notation. --- binutils/ChangeLog | 6 ++++++ binutils/readelf.c | 48 +++++++++++++++++++++++++++++++++++++----------- 2 files changed, 43 insertions(+), 11 deletions(-) (limited to 'binutils') diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 7008bf9..cf78bb2 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2003-06-19 Nick Clifton + + * readelf.c (print_vma): When printing DEC_5 values, if the + number is bigger than 99999 switch to using hexadecimal + notation. + 2003-06-11 Nick Clifton * objcopy.c (gnu_debuglink_filename): New variable. 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; -- cgit v1.1