2012-07-13 202 views
1

我想要写哪个功能被使用的mmap系统调用一个小脚本:问题与SystemTap的脚本

#! /usr/bin/env stap 
probe syscall.mmap.return { 
     if (execname()=="java") 
       printf ("%s mmap caller\n", caller()) 
} 

但它返回:

[[email protected] stap]# stap -v mmap_caller.stp 
Pass 1: parsed user script and 85 library script(s) using 198360virt/26732res/2944shr kb, in 210usr/50sys/264real ms. 
Pass 2: analyzed script: 1 probe(s), 4 function(s), 4 embed(s), 0 global(s) using 355384virt/51680res/4048shr kb, in 650usr/350sys/1000real ms. 
Pass 3: translated to C into "/tmp/stapwIxSzq/stap_a1823a5a24071fdf3118f618597b4ab6_7801_src.c" using 352824virt/54320res/6828shr kb, in 190usr/80sys/283real ms. 
/tmp/stapwIxSzq/stap_a1823a5a24071fdf3118f618597b4ab6_7801_src.c: In function 'function_caller_addr': 
/tmp/stapwIxSzq/stap_a1823a5a24071fdf3118f618597b4ab6_7801_src.c:646: error: dereferencing pointer to incomplete type 
make[1]: *** [/tmp/stapwIxSzq/stap_a1823a5a24071fdf3118f618597b4ab6_7801_src.o] Error 1 
make: *** [_module_/tmp/stapwIxSzq] Error 2 
WARNING: make exited with status: 2 
Pass 4: compiled C into "stap_a1823a5a24071fdf3118f618597b4ab6_7801.ko" in 1170usr/1120sys/2207real ms. 
Pass 4: compilation failed. Try again with another '--vp 0001' option. 

我的系统是RHEL 6.3,Linux的XXXXXXXXX 2.6 .32-279.1.1.el6.x86_64#1 SMP Wed Jun 20 11:41:22 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

任何提示?

回答

1

这是http://sourceware.org/bugzilla/show_bug.cgi?id=14079,定格在1.8的SystemTap与

commit 4107dbc2c88536c3374a68948c7344af8c8e75aa 
Author: Mark Wielaard <[email protected]> 
Date: Tue May 8 19:59:07 2012 +0200 

PR14079 - caller() pass-4 error if no uretprobes in script 

caller() is odd in that it tries to do both kernel and user caller. 
There is no ucaller(). Move it into its own tapset and include the 
right uprobes related structures. 

* runtime/uprobes-inc.h: New include file to be included in ... 
* runtime/stack.c: here and ... 
* tapset/context-caller.stp: here. New tapset, with just the caller context 
    function, removed from ... 
* tapset/context-unwind.stp: here. 
* doc/SystemTap_Tapset_Reference/tapsets.tmpl: Also include context-caller.stp. 
+1

谢谢,好知道。我疯了。 – 2012-07-25 09:22:19