I'm trying to debug some code in the kernel using systemtap. I need to print the value of local variables in that function but it looks like systemtap can only see the function arguments and not the local variables defined in that function. Here is my probe script.
probe kernel.function("tcp_write_xmit") {
if( execname() == "bw_client"){
printf(
"tcp_write_xmit skb len %d\n",
$skb
);
}
}
When I run this, I get the following error
semantic error: failed to retrieve location attribute for 'skb'
[man error::dwarf] (dieoffset: 0x5bd30b4): identifier
'$skb' at /home/cca-user/systaptest/txprobe.stp:37:6
source: $skb
^
Pass 2: analysis failed. [man error::pass2]
However the function tcp_write_xmit
clearly has skb
Using the -L
option to print available variables gives me 5 variables which are the function arguments but none of the local variables are seen.
root@i-sahmed-node2: /mnt/linux-3.13.0 # stap -L
'kernel.function("tcp_write_xmit")'
kernel.function("tcp_write_xmit@/build/buildd/linux-3.13.0/net/ipv4
/tcp_output.c:1832") $sk:struct sock* $mss_now:unsigned int $nonagle:int
$push_one:int $gfp:gfp_t
Here is the kernel and the systemtap version that I am running
root@i-sahmed-node2: /mnt/linux-3.13.0 # stap --version
Systemtap translator/driver (version 2.3/0.158, Debian version 2.3-1ubuntu1 (trusty))
Copyright (C) 2005-2013 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: AVAHI LIBSQLITE3 NSS TR1_UNORDERED_MAP NLS
root@i-sahmed-node2: /mnt/linux-3.13.0 # uname -a
Linux i-sahmed-node2 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Any Ideas?
You are using .function probe. In this probe only parameters passed to the functions are visible. If you need to examine a local variable then you need to use .statement probe.
More info about probing