This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RFA: dump stapsdt notes
- From: Tom Tromey <tromey at redhat dot com>
- To: Binutils Development <binutils at sourceware dot org>
- Date: Thu, 21 Apr 2011 14:18:51 -0600
- Subject: RFA: dump stapsdt notes
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