[Patch] Add support for printing SDT elf notes.

Mark Wielaard mjw at redhat.com
Tue Apr 26 10:36:52 UTC 2011


Hi,

Another small addition to make it possible to print the new sdt elf
notes that are appearing in more and more binaries these days. The
format is fairly simple to parse and has been added to the appropriate
libebl functions. ebl_object_note_type_name () has been changed to also
take the name of the note as argument, to facilitate printing the type
depending on name.

libebl/
    * libebl.h (ebl_object_note_type_name): Add const char *name arg.
    * eblhooks.h (object_note_type_name): Likewise.
    * eblopenbackend.c (default_object_note_type_name): Likewise.
    * eblobjnotetypename.c (ebl_object_note_type_name): Likewise.
    And print version if name is "stapsdt".
    * eblobjnote.c (ebl_object_note): Add output for "stapsdt" notes.
src/
    * readelf.c (handle_notes_data): Call ebl_object_note_type_name
    with note name.

Sample output of readelf -n:

Note section [35] '.note.stapsdt' of 708 bytes at offset 0x1c0:
  Owner          Data size  Type
  stapsdt               51  Version: 3
    PC: 0x2f690, Base: 0x158368, Semaphore: 0
    Provider: libc, Name: setjmp, Args: '4@%eax -4 at 4+4(%esp) 4@%ecx'
  stapsdt               44  Version: 3
    PC: 0x2f730, Base: 0x158368, Semaphore: 0
    Provider: libc, Name: setjmp, Args: '4@%eax -4@$1 4@%ecx'
  stapsdt               44  Version: 3
    PC: 0x2f772, Base: 0x158368, Semaphore: 0
    Provider: libc, Name: setjmp, Args: '4@%edx -4@$0 4@%ecx'
  stapsdt               50  Version: 3
    PC: 0x2f80e, Base: 0x158368, Semaphore: 0
    Provider: libc, Name: longjmp, Args: '4@%eax -4 at 8(%esp) 4@%edx'
  stapsdt               57  Version: 3
    PC: 0x2f81a, Base: 0x158368, Semaphore: 0
    Provider: libc, Name: longjmp_target, Args: '4@%eax -4 at 8(%esp) 4@%edx'
  stapsdt               51  Version: 3
[...]

Please let me know if you see any issues with the implementation before
I commit it. Patch attached and on the mjw/sdt git branch.

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sdt.patch
Type: text/x-patch
Size: 6796 bytes
Desc: not available
Url : https://fedorahosted.org/pipermail/elfutils-devel/attachments/20110426/d49b6106/attachment.bin 


More information about the elfutils-devel mailing list