This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: How to track the functions in self-written module using SystemTap?
- From: Nan Xiao <xiaonan830818 at gmail dot com>
- To: David Smith <dsmith at redhat dot com>
- Cc: systemtap at sourceware dot org
- Date: Wed, 18 Nov 2015 11:38:58 +0800
- Subject: Re: How to track the functions in self-written module using SystemTap?
- Authentication-results: sourceware.org; auth=none
- References: <CA+MhoaPMSTgpHCDjNhwcDkMaLryLy+F6tH6HNcrvDDF9bEbBbg at mail dot gmail dot com> <564B5A4C dot 1080302 at redhat dot com>
Hi David,
Yes, the "FULL_PATH_TO_KEX" works:
~/Downloads/kernel/105.ops # stap -l
'module("/root/Downloads/kernel/105.ops/kex.ko").function("*")'
module("/root/Downloads/kernel/105.ops/kex.ko").function("_open@/root/Downloads/kernel/105.ops/kex.c:21")
module("/root/Downloads/kernel/105.ops/kex.ko").function("_read@/root/Downloads/kernel/105.ops/kex.c:45")
module("/root/Downloads/kernel/105.ops/kex.ko").function("_release@/root/Downloads/kernel/105.ops/kex.c:33")
module("/root/Downloads/kernel/105.ops/kex.ko").function("copy_to_user@/usr/src/linux-3.12.49-3/arch/x86/include/asm/uaccess_64.h:72")
module("/root/Downloads/kernel/105.ops/kex.ko").function("kex_cleanup@/root/Downloads/kernel/105.ops/kex.c:90")
module("/root/Downloads/kernel/105.ops/kex.ko").function("kex_init@/root/Downloads/kernel/105.ops/kex.c:61")
But the "RELATIVE_PATH_TO_KEX" doesn't work:
~/Downloads/kernel/105.ops # stap -l 'module("./kex.ko").function("*")'
~/Downloads/kernel/105.ops #
Is it the expected behavior of SystemTap? Thanks!
Best Regards
Nan Xiao
On Wed, Nov 18, 2015 at 12:48 AM, David Smith <dsmith@redhat.com> wrote:
> On 11/17/2015 01:14 AM, Nan Xiao wrote:
>> Hi all,
>>
>> I build a simple Linux module
>> (https://github.com/troydhanson/kernel/blob/master/105.ops/kex.c),
>> and want to use SystemTap to track it.
>>
>> But I find there is no available probes:
>> # stap -l 'module("kex").function("*")'
>> #
>>
>> How can I track the functions in module written by myself? Is there
>> any tutorial about this? I try to
>> search on https://sourceware.org/systemtap/documentation.html, but
>> can't find wanted content.
>
> If your 'kex' module isn't the same directory as the other kernel
> modules (/lib/modules/`uname -r`/), systemtap won't be able to find it.
> So, you have to tell systemtap where the module is, like this:
>
> # stap -l 'module("FULL_PATH_TO_KEX").function("*")'
>
> If that doesn't work, please let me know.
>
> --
> David Smith
> dsmith@redhat.com
> Red Hat
> http://www.redhat.com
> 256.217.0141 (direct)
> 256.837.0057 (fax)