This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Commit: Improve readelf's display of unknown section types

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.

2011-06-29  Nick Clifton  <>

	* 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

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);
-	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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]