[PATCH v3 0/2] perf probe: add sdt probes arguments into the uprobe cmd string

From: Alexis Berlemont
Date: Thu Nov 24 2016 - 18:18:58 EST


Hi Hemant,

Once more thank you for your answer.

Sorry for this bug: I tested the patches only on small sample
binaries. Now it is tested against the systemtap-enabled libraries
libc and libpthread. There were 2 problems:

* The one you disclosed: in indirect addressing mode, positive offsets
not prefixed with a '+' character;
* Another one still in indirect addressing mode: offsets which were
not constants but symbols;

The following patches solves them both.

# cat /sys/kernel/tracing/uprobe_events
p:sdt_libpthread/pthread_start /lib/libpthread-2.23.so:0x0000000000007448 arg0=%ax:u64 arg1=+1600(%ax):u64 arg2=+1608(%ax):u64
p:sdt_libpthread/pthread_create /lib/libpthread-2.23.so:0x0000000000007be9 arg0=%ax:u64 arg1=-184(%bp):u64 arg2=-160(%bp):u64 arg3=-168(%bp):u64
p:sdt_libpthread/pthread_join /lib/libpthread-2.23.so:0x000000000000864d arg0=%di:u64
p:sdt_libpthread/pthread_join_ret /lib/libpthread-2.23.so:0x00000000000086fe arg0=%bx:u64 arg1=%ax:s32 arg2=+1584(%bx):u64
p:sdt_libpthread/mutex_init /lib/libpthread-2.23.so:0x000000000000938b arg0=%di:u64
p:sdt_libpthread/mutex_destroy /lib/libpthread-2.23.so:0x0000000000009410 arg0=%di:u64
p:sdt_libpthread/mutex_acquired /lib/libpthread-2.23.so:0x0000000000009685 arg0=%bx:u64
p:sdt_libpthread/mutex_acquired_1 /lib/libpthread-2.23.so:0x0000000000009b31 arg0=%r8:u64
...

# cat /sys/kernel/tracing/uprobe_events
p:sdt_libc/setjmp /lib/libc-2.23.so:0x0000000000033181 arg0=%di:u64 arg1=%si:s32 arg2=%ax:u64
p:sdt_libc/longjmp /lib/libc-2.23.so:0x0000000000033263 arg0=%di:u64 arg1=%si:s32 arg2=%dx:u64
p:sdt_libc/longjmp_1 /lib/libc-2.23.so:0x00000000000f7fc3 arg0=%di:u64 arg1=%si:s32 arg2=%dx:u64
p:sdt_libc/longjmp_target /lib/libc-2.23.so:0x000000000003327f arg0=%di:u64 arg1=%ax:s32 arg2=%dx:u64
p:sdt_libc/longjmp_target_1 /lib/libc-2.23.so:0x00000000000f7fdf arg0=%di:u64 arg1=%ax:s32 arg2=%dx:u64
...

Thanks,

Alexis.


Alexis Berlemont (2):
perf sdt: add scanning of sdt probles arguments
perf probe: add sdt probes arguments into the uprobe cmd string

tools/perf/arch/x86/util/perf_regs.c | 18 ++++
tools/perf/util/perf_regs.c | 4 +
tools/perf/util/perf_regs.h | 13 +++
tools/perf/util/probe-file.c | 169 ++++++++++++++++++++++++++++++++++-
tools/perf/util/symbol-elf.c | 16 +++-
tools/perf/util/symbol.h | 1 +
6 files changed, 216 insertions(+), 5 deletions(-)

--
2.10.2