This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: no access to local variables in function


David wrote:
>
> On 05/28/2015 07:06 AM, Lentes, Bernd wrote:
> > Hi,
> >
> > i'm new to systemtap. I try to check some local variables of kernel
> functions. I have a SLES 10 SP4, kernel 2.6.16.60-0.103.1-smp. I'm using
> systemtap 0.8.
> > I'm following the instructions from
> https://sourceware.org/systemtap/SystemTap_Beginners_Guide/target
> variables.html .
> >
> > If I try to use the example from this page I get:
> > idcc-devel:~/systemtap # stap -L 'kernel.function("vfs_read")'
> > kernel.function("vfs_read@fs/read_write.c:248")
> >
> > Checking other functions with local variables also does not work:
> > idcc-devel:~/systemtap # stap -L 'kernel.function("local_bh_enable")'
> > kernel.function("local_bh_enable@kernel/softirq.c:139")
> >
> > idcc-devel:~/systemtap # stap -L
> 'kernel.function("__tasklet_schedule")'
> > kernel.function("__tasklet_schedule@kernel/softirq.c:224")
> >
> > idcc-devel:~/systemtap # stap -L
> 'kernel.function("tasklet_kill_immediate")'
> > kernel.function("tasklet_kill_immediate@kernel/softirq.c:439")
> >
> > I don't see any local variable. What can I do ?
>
> On my fedora 21 system, I see this:
>
> # stap -L 'kernel.function("vfs_read")'
> kernel.function("vfs_read@fs/read_write.c:478") $file:struct file*
> $buf:char* $count:size_t $pos:loff_t*
>
> The first thing I'd do is make sure you've got kernel debuginfo installed
> that *exactly* matches that kernel.
>

idcc-devel:~/systemtap # rpm -qa|grep -i kernel
kernel-syms-2.6.16.60-0.103.1
kernel-smp-2.6.16.60-0.103.1
kernel-debug-2.6.16.60-0.103.1
kernel-smp-debuginfo-2.6.16.60-0.103.1
kernel-source-2.6.16.60-0.103.1

> Wow, you are using an old kernel (2.6.16) and a *really* old version of
> systemtap (0.8). Systemtap 0.8 was released in 2008-11-13. We've had 23
> releases since then. Is there any chance you can upgrade to a newer
> version?
>

I managed to install 2.7 without any error.
But running my scripts now create errors I did note have before:
E.g.:

Script:
probe kernel.function("irq_exit") {printf("$$vars: %s\t$$parms: %s\t$$locals: %s \n",$$vars,$$parms,$$locals)}
probe kernel.function("tasklet_kill_immediate") {printf("$$vars: %s\t$$parms: %s\t$$locals: %s \n",$$vars,$$parms,$$locals)}
probe kernel.function("dump_clear_tasklet") {printf("$$vars: %s\t$$parms: %s\t$$locals: %s \n",$$vars,$$parms,$$locals)}

errors:
/usr/local/share/systemtap/runtime/transport/transport.c: In function â_stp_handle_startâ:
/usr/local/share/systemtap/runtime/transport/transport.c:175: error: implicit declaration of function âatomic_notifier_chain_registerâ
/usr/local/share/systemtap/runtime/transport/transport.c: In function â_stp_cleanup_and_exitâ:
/usr/local/share/systemtap/runtime/transport/transport.c:235: error: implicit declaration of function âatomic_notifier_chain_unregisterâ
make[3]: *** [/tmp/stapnWl1Uo/stap_206249b60ef8ac28da63674b8ffc8443_3123_src.o] Error 1
make[2]: *** [_module_/tmp/stapnWl1Uo] Error 2
make[1]: *** [modules] Error 2
make: *** [modules] Error 2
Spawn waitpid result (0x200): 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_206249b60ef8ac28da63674b8ffc8443_3123.ko" in 1470usr/520sys/2978real ms.
Pass 4: compilation failed.  [man error::pass4]
Running rm -rf /tmp/stapnWl1Uo
Spawn waitpid result (0x0): 0
Removed temporary directory "/tmp/stapnWl1Uo"


script:

// Softirq based probes.
/**
 * probe softirq.entry - Execution of handler for a pending softirq starting
 * @h: struct softirq_action* for current pending softirq
 * @vec: softirq_action vector
 * @action: pointer to softirq handler just about to execute
 * @vec_nr:  softirq vector number
 */
probe softirq.entry = kernel.trace("irq_softirq_entry") !,
                      kernel.trace("softirq_entry") ?
{
        # kernels < 2.6.37
        h = (@defined($h) ? $h : 0)
        vec = (@defined($vec) ? $vec : 0)
        action = (@defined($h) ? @cast($h,"softirq_action","kernel<linux/interrupt.h>")->action : 0)
        # kernels >= 2.6.37
        # vec_nr = (@defined($vec_nr) ? $vec_nr : 0)
}

I found that script on the internet and did copy/paste.

errors:

Pass 1: parsed user script and 106 library script(s) using 45984virt/30588res/2068shr/29320data kb, in 200usr/200sys/2059real ms.
semantic error: no probes found
   thrown from: elaborate.cxx:2004
Pass 2: analyzed script: 0 probe(s), 0 function(s), 0 embed(s), 0 global(s) using 46512virt/31432res/2268shr/29848data kb, in 10usr/10sys/116real ms.
Pass 2: analysis failed.  [man error::pass2]
Running rm -rf /tmp/stapdzKK7Y
Spawn waitpid result (0x0): 0
Removed temporary directory "/tmp/stapdzKK7Y"

Maybe version 2.7 is now to recent ? What version would you recommend for my system ?



> > Btw: is there a chance to monitor the variables of a blacklisted function
> ?
>
> If you use guru mode ('stap -g'), you can probe blacklisted functions.
> However, functions are usually blacklisted for a good reason...
>

I understand.

> --

Helmholtz Zentrum MÃnchen
Deutsches Forschungszentrum fÃr Gesundheit und Umwelt (GmbH)
IngolstÃdter Landstr. 1
85764 Neuherberg
www.helmholtz-muenchen.de
Aufsichtsratsvorsitzende: MinDirÂin BÃrbel Brumme-Bothe
GeschÃftsfÃhrer: Prof. Dr. GÃnther Wess, Dr. Nikolaus Blum, Dr. Alfons Enhsen
Registergericht: Amtsgericht MÃnchen HRB 6466
USt-IdNr: DE 129521671

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]