* RFA: dump stapsdt notes
@ 2011-04-21 20:19 Tom Tromey
2011-04-25 12:58 ` Alan Modra
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2011-04-21 20:19 UTC (permalink / raw)
To: Binutils Development
Here's a patch to dump stapsdt notes from `readelf -n'.
I followed the existing `print_ia64_vms_note' approach.
Here's what it looks like:
Notes at offset 0x0001b748 with length 0x00000044:
Owner Data size Description
stapsdt 0x0000002e NT_STAPSDT (SystemTap probe descriptors)
Provider: libgcc
Name: unwind
Location: 0x00016250, Base: 0x000195c0, Semaphore: 0x00000000
Arguments: 4@4(%esp) 4@8(%esp)
These all mean something if you're familiar with the probes.
Ok?
Tom
2011-04-21 Tom Tromey <tromey@redhat.com>
* readelf.c (print_stapsdt_note): New function.
(process_note): Use it.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index cc952ab..67dfc9c 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12311,6 +12311,43 @@ get_stapsdt_note_type (unsigned e_type)
return buff;
}
+static int
+print_stapsdt_note (Elf_Internal_Note *pnote)
+{
+ int addr_size = is_32bit_elf ? 4 : 8;
+ char *data = pnote->descdata;
+ char *data_end = pnote->descdata + pnote->descsz;
+ bfd_vma pc, base_addr, semaphore;
+ char *provider, *probe, *arg_fmt;
+
+ pc = byte_get ((unsigned char *) data, addr_size);
+ data += addr_size;
+ base_addr = byte_get ((unsigned char *) data, addr_size);
+ data += addr_size;
+ semaphore = byte_get ((unsigned char *) data, addr_size);
+ data += addr_size;
+
+ provider = data;
+ data += strlen (data) + 1;
+ probe = data;
+ data += strlen (data) + 1;
+ arg_fmt = data;
+ data += strlen (data) + 1;
+
+ printf (_(" Provider: %s\n"), provider);
+ printf (_(" Name: %s\n"), probe);
+ printf (_(" Location: "));
+ print_vma (pc, FULL_HEX);
+ printf (_(", Base: "));
+ print_vma (base_addr, FULL_HEX);
+ printf (_(", Semaphore: "));
+ print_vma (semaphore, FULL_HEX);
+ printf (_("\n"));
+ printf (_(" Arguments: %s\n"), arg_fmt);
+
+ return data == data_end;
+}
+
static const char *
get_ia64_vms_note_type (unsigned e_type)
{
@@ -12469,6 +12506,8 @@ process_note (Elf_Internal_Note * pnote)
if (const_strneq (pnote->namedata, "IPF/VMS"))
return print_ia64_vms_note (pnote);
+ else if (const_strneq (pnote->namedata, "stapsdt"))
+ return print_stapsdt_note (pnote);
else
return 1;
}
--
1.7.3.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RFA: dump stapsdt notes
2011-04-21 20:19 RFA: dump stapsdt notes Tom Tromey
@ 2011-04-25 12:58 ` Alan Modra
2011-04-25 14:54 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2011-04-25 12:58 UTC (permalink / raw)
To: Tom Tromey; +Cc: Binutils Development
On Thu, Apr 21, 2011 at 02:18:51PM -0600, Tom Tromey wrote:
> * readelf.c (print_stapsdt_note): New function.
> (process_note): Use it.
OK.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RFA: dump stapsdt notes
2011-04-25 12:58 ` Alan Modra
@ 2011-04-25 14:54 ` Tom Tromey
2011-04-26 13:19 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2011-04-25 14:54 UTC (permalink / raw)
To: Binutils Development
>>>>> "Alan" == Alan Modra <amodra@gmail.com> writes:
>> * readelf.c (print_stapsdt_note): New function.
>> (process_note): Use it.
Alan> OK.
This one at least somewhat relies on "readelf -n -vs- stapsdt notes".
Without that patch, the output from this one will look a bit strange.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RFA: dump stapsdt notes
2011-04-25 14:54 ` Tom Tromey
@ 2011-04-26 13:19 ` Tom Tromey
0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2011-04-26 13:19 UTC (permalink / raw)
To: Binutils Development
>>> * readelf.c (print_stapsdt_note): New function.
>>> (process_note): Use it.
Alan> OK.
Tom> This one at least somewhat relies on "readelf -n -vs- stapsdt notes".
Tom> Without that patch, the output from this one will look a bit strange.
I've committed this now.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-26 13:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-21 20:19 RFA: dump stapsdt notes Tom Tromey
2011-04-25 12:58 ` Alan Modra
2011-04-25 14:54 ` Tom Tromey
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).