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]

RFA: readelf -n -vs- stapsdt notes

This patch changes `readelf -n' to recognize stapsdt notes.
These are created by programs using <sys/sdt.h>.

With this patch the output looks like:

Notes at offset 0x0001b748 with length 0x00000044:
  Owner		Data size	Description
  stapsdt   	0x0000002e	NT_STAPSDT (SystemTap probe descriptors)


I'd like to write a follow-on patch that pretty-prints the contents of
the note, since this is useful information, but I noticed that most
other notes don't have this... is there a particular reason for that?


2011-04-21  Tom Tromey  <>

	* readelf.c (get_stapsdt_note_type): New function.
	(process_note): Recognize "stapsdt" notes.

Index: readelf.c
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.540
diff -u -r1.540 readelf.c
--- readelf.c	7 Apr 2011 11:40:12 -0000	1.540
+++ readelf.c	21 Apr 2011 17:37:22 -0000
@@ -12294,6 +12294,24 @@
 static const char *
+get_stapsdt_note_type (unsigned e_type)
+  static char buff[64];
+  switch (e_type)
+    {
+    case NT_STAPSDT:
+      return _("NT_STAPSDT (SystemTap probe descriptors)");
+    default:
+      break;
+    }
+  snprintf (buff, sizeof (buff), _("Unknown note type: (0x%08x)"), e_type);
+  return buff;
+static const char *
 get_ia64_vms_note_type (unsigned e_type)
   static char buff[64];
@@ -12439,6 +12457,9 @@
     /* VMS/ia64-specific file notes.  */
     nt = get_ia64_vms_note_type (pnote->type);
+  else if (const_strneq (pnote->namedata, "stapsdt"))
+    nt = get_stapsdt_note_type (pnote->type);
     /* Don't recognize this note name; just use the default set of
        note type strings.  */

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