[ktap] Re: [PATCH] add new symbol module to search symbols in DSO (for uprobes)

  • From: Jovi Zhangwei <jovi.zhangwei@xxxxxxxxx>
  • To: ktap@xxxxxxxxxxxxx
  • Date: Thu, 7 Nov 2013 13:06:00 +0800

On Thu, Nov 7, 2013 at 11:55 AM, Azat Khuzhin <a3at.mail@xxxxxxxxx> wrote:
>
> On 7 Nov 2013 07:29, "Jovi Zhangwei" <jovi.zhangwei@xxxxxxxxx> wrote:
>>
>> On Wed, Nov 6, 2013 at 5:51 PM, Azat Khuzhin <a3at.mail@xxxxxxxxx> wrote:
>> > This will allow to don't hardcoding addresses of functions in ktap
>> > scripts, that use uprobes, but instead, use normal function names.
>> >
>> > Before this patch:
>> > $ ktap -e 'trace probe:/path/to/bin:0xDEADBEAF' # instead some real
>> > address
>> >
>> > After this path:
>> > $ ktap -e 'trace probe:/path/to/bin:foo'
>> >
>> > Works also for ret probes (%return)
>> > Requires libelf.
>> >
>> > Have NO_LIBELF option for makefile, for cross-builds.
>> >
>> > Signed-off-by: Azat Khuzhin <a3at.mail@xxxxxxxxx>
>> > ---
>> > v2: make it more pretty
>> > v3: make it faster (thanks to Yicheng)
>> > v4: add NO_LIBELF option into Makefile, and more common parsing
>> > v5: fix leaking of "tail"
>> > v6: coding styles fixes
>> >
>> Applied, thank you.
>>
>> Now we can use symbol(like malloc and free) in ktap uprobe scripts, a big
>> step.
>
> Nice!
> I see you also changed examples, thanks.
>
Btw, you have opened the gate for elf debugging info resolving, actually there
still have a big feature missed in ktap uprobe: SDT markers

In my machine, there have many built-in sdt in glibc, see below:

# readelf -n /lib64/libc.so.6
setjmp, longjmp, longjmp_target, lll_futex_wake, lll_lock_wait_private

There also have many other program with compiled sdt, like JVM, Erlang, MySQL,
NodeJS, etc. so SDT marker parsing would be a useful feature for dynamic tracing
tool (already supported in Systemtap/Dtrace).

They also plan to support SDT markers in perf. (ongoing work)
(https://lkml.org/lkml/2013/10/23/10)

How about SDT markers support in ktap? I thought about this a little before.

    trace sdt:libc:setjmp {
        print(execname(), argevent)
    }

So, if anyone interest on implement this, that's would be great.
(the implementation wouldn't be hard to start because we have some minimal elf
reading code in there now, and there also have perf-sdt patch demo.)

Jovi

Other related posts: