public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* RFA: readelf -n -vs- stapsdt notes
@ 2011-04-21 17:49 Tom Tromey
  2011-04-25 23:01 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2011-04-21 17:49 UTC (permalink / raw)
  To: Binutils Development

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)

Ok?

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?

Tom

2011-04-21  Tom Tromey  <tromey@redhat.com>

	* 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);
+
   else
     /* Don't recognize this note name; just use the default set of
        note type strings.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFA: readelf -n -vs- stapsdt notes
  2011-04-21 17:49 RFA: readelf -n -vs- stapsdt notes Tom Tromey
@ 2011-04-25 23:01 ` Alan Modra
  2011-04-26 13:19   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2011-04-25 23:01 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Binutils Development

On Thu, Apr 21, 2011 at 11:49:29AM -0600, Tom Tromey wrote:
> 	* readelf.c (get_stapsdt_note_type): New function.
> 	(process_note): Recognize "stapsdt" notes.

OK.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFA: readelf -n -vs- stapsdt notes
  2011-04-25 23:01 ` Alan Modra
@ 2011-04-26 13:19   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2011-04-26 13:19 UTC (permalink / raw)
  To: Binutils Development

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

Alan> OK.

Committed.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-26 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-21 17:49 RFA: readelf -n -vs- stapsdt notes Tom Tromey
2011-04-25 23:01 ` Alan Modra
2011-04-26 13:19   ` Tom Tromey

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