public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Commit: Improve readelf's display of unknown section types
@ 2011-06-29 16:51 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2011-06-29 16:51 UTC (permalink / raw)
  To: binutils

Hi Guys,

  I am checking in the patch below to make a slight improvement to the
  way that readelf displays unknown section types.  Prior to this patch
  its default output would look like this:

     [ 4] aeabi             <unknown>: 80a8 00000000 000038 000016 00      0   0  1

  After applying the patch the output becomes:
  
     [ 4] aeabi             080a8010: <unkn 00000000 000038 000016 00      0   0  1

  Which makes identifying the actual unknown value a lot easier.
  
Cheers
  Nick

binutils/ChangeLog
2011-06-29  Nick Clifton  <nickc@redhat.com>

	* readelf.c (get_section_type_name): When displaying an unknown
	section type display the hex value first on the assumption that
	the full message will probably be truncated into a 15 character
	field.

Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.548
diff -u -3 -p -r1.548 readelf.c
--- binutils/readelf.c	15 Jun 2011 16:36:57 -0000	1.548
+++ binutils/readelf.c	29 Jun 2011 16:45:54 -0000
@@ -3084,7 +3084,9 @@ get_section_type_name (unsigned int sh_t
       else if ((sh_type >= SHT_LOUSER) && (sh_type <= SHT_HIUSER))
 	sprintf (buff, "LOUSER+%x", sh_type - SHT_LOUSER);
       else
-	snprintf (buff, sizeof (buff), _("<unknown>: %x"), sh_type);
+	/* This message is probably going to be displayed in a 15
+	   character wide field, so put the hex value first.  */
+	snprintf (buff, sizeof (buff), _("%08x: <unknown>"), sh_type);
 
       return buff;
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-29 16:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-29 16:51 Commit: Improve readelf's display of unknown section types Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).