This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
SystemTap Translator Questions
- From: Kevin Stafford <kevinrs at us dot ibm dot com>
- To: systemtap at sources dot redhat dot com
- Date: Wed, 17 Aug 2005 15:29:19 -0700
- Subject: SystemTap Translator Questions
I am familiarizing myself with latest SystemTap snapshot on FC4 and have
some questions about probe scripts I hope can be clarified.
1. This short script fails to compile.
#! stap -p4
global ct
function print_proc()%{
_stp_printf("proc: %s\n", current->comm);
_stp_print_flush();
%}
probe kernel.syscall.read =
kernel.function("sys_read")
{
mfd = $fd;
buf = $buf;
cta = $count;
}
probe kernel.syscall.read {
ct++;
log(string(mfd));
print_proc();
}
probe end {
log("num sys_read calls: " . string(ct));
}
Here is the shell output:
[root@dyn src]# ./stap -vg testsuite/my_stp.stp
Created temporary directory "/tmp/stapViaRZ8"
Searched '/usr/local/share/systemtap/tapset/2.6.13-rc5/*.stp', match
count 0
Searched '/usr/local/share/systemtap/tapset/2.6.13/*.stp', match count 0
Searched '/usr/local/share/systemtap/tapset/2.6/*.stp', match count 0
Searched '/usr/local/share/systemtap/tapset/*.stp', match count 3
Pass 1: parsed user script and 3 library script(s).
registering probe alias kernel.syscall.read
parsed 'sys_read' -> func 'sys_read'
pattern 'kernel' matches module 'kernel'
focused on module 'kernel' = [c0100000-c04db718, bias 0]
pattern 'sys_read' matches function 'sys_read'
focused on function 'sys_read', in CU 'fs/read_write.c', module 'kernel'
function sys_read entrypc: c016c590 prologue-end: c016c591
finding location for local 'fd' near address 0xc016c591, module bias 0x0
finding location for local 'buf' near address 0xc016c591, module
bias 0x0
finding location for local 'count' near address 0xc016c591, module
bias 0x0
./stap: cannot get byte_size attribute for type size_t: no error
When I comment out the references to $count in the probe alias I can
compile, however there is no output until I also comment the reference
to $buf.
2. ./stap testsuite/buildok/five.stp causes my system to hang, resulting
in a force-shutdown/reboot.
#! stap -p4
probe kernel.function("schedule") { log ("arrival") }
probe kernel.function("schedule").return { log ("departure") }
The probe script places a kprobe and a kretprobe on the kernel function
"schedule". I verified that the probe address does correspond to the
definition of "schedule" in my kernel image.
3. ./stap testsuite/buildok/six.stp does not compile:
#! stap -p4
probe kernel.function("context_switch") {
log ("switch from=" . hexstring($prev) . " to=" .
hexstring($next))
}
[root@dyn src]# ./stap -v testsuite/buildok/six.stp
Created temporary directory "/tmp/stap6Hzsuh"
Searched '/usr/local/share/systemtap/tapset/2.6.13-rc5/*.stp', match
count 0
Searched '/usr/local/share/systemtap/tapset/2.6.13/*.stp', match count 0
Searched '/usr/local/share/systemtap/tapset/2.6/*.stp', match count 0
Searched '/usr/local/share/systemtap/tapset/*.stp', match count 3
Pass 1: parsed user script and 3 library script(s).
parsed 'context_switch' -> func 'context_switch'
pattern 'kernel' matches module 'kernel'
focused on module 'kernel' = [c0100000-c04db718, bias 0]
pattern 'context_switch' matches function 'context_switch'
focused on function 'context_switch', in CU 'kernel/sched.c', module
'kernel'
WARNING: cannot find prologue-end PC for function context_switch
pattern 'kernel' matches module 'kernel'
semantic error: no match for probe point
while: resolving probe point kernel.function("context_switch")
Pass 2: analyzed user script. 0 probe(s), 0 function(s), 0 global(s).
Pass 2: analysis failed. Try again with '-v' (verbose) option.
Running /bin/rm -rf /tmp/stap6Hzsuh
Is this happening because "context_switch" is inlined?
4. ./stap testsuite/semok/seventeen.stp does not compile because it
fails to resolve $nr_segs.
#! stap -p2
global foo
probe kernel.function("pipe_writev")
{
a = $nr_segs
foo [a] = 1
# $nr_segs is not an lvalue here /* why is this? */
foo [$nr_segs] ++
}
[root@dyn src]# ./stap testsuite/semok/seventeen.stp
...
focused on function 'pipe_writev', in CU 'fs/pipe.c', module 'kernel'
function pipe_writev entrypc: c0178eb0 prologue-end: c0178eb7
finding location for local 'nr_segs' near address 0xc0178eb7, module
bias 0x0
semantic error: failed to retrieve location attribute for local
'nr_segs'
pattern 'kernel' matches module 'kernel'
semantic error: no match for probe point
while: resolving probe point kernel.function("pipe_writev")
...
The comment '# $nr_segs is not an lvalue here' indicates that script
should fail to compile. What I don't understand is why the translator
cannot resolve nr_segs, which is a parameter to pipe_writev.
Thanks,
--
Kevin Stafford
DES 2 | MS 2M3
Beaverton - OR
Linux Technology Center
IBM Systems & Technology
Phone: 1-503-578-3039
Email: kevinrs@us.ibm.com