1

systemtap を使用してカーネル内のコードをデバッグしようとしています。その関数のローカル変数の値を出力する必要がありますが、systemtap は関数の引数しか認識できず、その関数で定義されたローカル変数は認識できないようです。これが私のプローブスクリプトです。

probe kernel.function("tcp_write_xmit") {
    if( execname() == "bw_client"){
            printf(
               "tcp_write_xmit skb len %d\n",
               $skb
            );
    }
}

これを実行すると、次のエラーが表示されます

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]

ただし、関数tcp_write_xmitには明らかにskb

使用-L可能な変数を出力するオプションを使用すると、関数の引数である 5 つの変数が表示されますが、ローカル変数は表示されません。

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

これが私が実行しているカーネルとsystemtapのバージョンです

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

何か案は?

4

3 に答える 3

3

.functionプローブを使用しています。このプローブでは、関数に渡されたパラメーターのみが表示されます。ローカル変数を調べる必要がある場合は、.statementプローブを使用する必要があります。

プロービングの詳細

于 2015-06-25T10:39:10.173 に答える