This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Why 'stap -L' shows no variables in some modules?
- From: David Smith <dsmith at redhat dot com>
- To: Freeman Zhang <freeman dot zhang1992 at gmail dot com>
- Cc: systemtap at sourceware dot org
- Date: Thu, 14 Sep 2017 11:05:19 -0500
- Subject: Re: Why 'stap -L' shows no variables in some modules?
- Authentication-results: sourceware.org; auth=none
- References: <d5201a5b-393f-1dd1-c40a-915b2d8332df@gmail.com>
On Thu, Sep 14, 2017 at 10:11 AM, Freeman Zhang
<freeman.zhang1992@gmail.com> wrote:
> Hello list!
>
> I'm learning to use systemtap these days. However I find something
> stang: I can access local variables and parameters in some modules while
> I can't do that in some others. For example:
>
> --1--
> stap -e 'probe kernel.function("sys_*") { printf("%s\n", $$parms$) }'
>
> can print a lot but when I try in module nvme:
>
> stap -e 'probe module("nvme").function("*") { printf("%s\n", $$parms$) }'
>
> will print nothing but empty lines.
>
>
> --2--
> When I try to check probe points in module ext4:
>
> stap -L 'module("ext4").function("*")'
>
> This will print available probe points and variables (to be more
> accurate, I think they are parms instead of local vars):
>
> module("ext4").function("try_to_extend_transaction@fs/ext4/indirect.c:703") $handle:handle_t* $inode:struct inode*
>
> however when I try it in module nvme:
>
> stap -L 'module("nvme").function("*")'
>
> it only prints probe points, no variables:
>
> module("nvme").function("nvme_resume")
> module("nvme").function("nvme_setup_io_queues")
> module("nvme").function("nvme_shutdown")
> module("nvme").function("nvme_slot_reset")
> ----
>
> #I wonder why they print differently? What determines whether 'stap -L'
> shows local vars or not?
There are several factors that determine whether stap can find
parameters and local variables. The compiler you use, the quality of
its debuginfo, and the level of optimization are the biggest issues.
In the case of local variables, with a sufficiently high optimization
level, the compiler may have completely optimized the variable away so
it never existed.
In the case of the nvme module itself, on my distro kernel I certainly
see parameters with 'stap -L' (and perhaps local variables too, I
didn't check).
I'd make sure the nvme module has debuginfo. There are probably
several ways of doing this, the easiest might be using 'eu-readelf
-w'.
> # how can I access the local vars when 'stap -L' gives no local vars?
>
> FYI: The kernel I use is 4.11.3 and is built by myself. I think it's
> with debuginfo because I turned on the CONFIG_DEBUG_INFO stuff and got a
> 159MB vmlinux. GDB also gave me positive response loading symbols from
> vmlinux and ko files. And the systemtap was built from the updated git
> repo.
You might show us the output of:
$ grep DEBUG_INFO .config
Make sure CONFIG_DEBUG_INFO_SPLIT isn't on.
--
David Smith
Principal Software Engineer
Red Hat