![Linux 上的 Dtrace](https://linux22.com/image/64480/Linux%20%E4%B8%8A%E7%9A%84%20Dtrace.png)
我尝试在 Cent OS 6.4 内核 2.6.32-358.el6.x86_64 上安装 dtrace,出现以下错误
[root@mscserver dtrace-20150306]# make all
BUILD_DIR=build-2.6.32-358.el6.x86_64 tools/build.pl build-2.6.32-358.el6.x86_64 `uname -m`
gcc -o build-2.6.32-358.el6.x86_64/kcore tools/kcore.c
tools/check_dep.pl
tools/mkport.pl
insmod: can't read 'build/driver-kmem/dtrace_kmem.ko': No such file or directory
ERROR: Module dtrace_kmem does not exist in /proc/modules
Failed to find offset
old_rsp=
cannot find old_rsp
tools/libgcc.pl
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/32
tools/mksyscall.pl
Processing (32): /lib/modules/2.6.32-358.el6.x86_64/build/arch/x86/include/asm/unistd_32.h
Creating: build-2.6.32-358.el6.x86_64/driver/syscalls-x86.tbl - 340 entries
Processing (64): /lib/modules/2.6.32-358.el6.x86_64/build/arch/x86/include/asm/unistd_64.h
Creating: build-2.6.32-358.el6.x86_64/driver/syscalls-x86-64.tbl - 312 entries
make all0
cd tests ; make --no-print-directory
case `uname -m` in \
x86_64) \
cc -m64 -g -o ../build-2.6.32-358.el6.x86_64/sys64 syscalls.c ; \
cc -m32 -g -o ../build-2.6.32-358.el6.x86_64/sys32 syscalls.c || true ; \
;; \
i686) \
cc -m32 -g -o ../build-2.6.32-358.el6.x86_64/sys32 syscalls.c ; \
;; \
arm*) \
cc -g -o ../build-2.6.32-358.el6.x86_64/sys32 syscalls.c ; \
;; \
esac
cd libctf ; make --no-print-directory
gcc -g -I../common -I../common/ctf -I../uts/common/ -I../common/ctf -I. -I../linux -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -c -o ctf_lib.o ctf_lib.c
ar rv ../build-2.6.32-358.el6.x86_64/libctf.a ctf_lib.o
ar: creating ../build-2.6.32-358.el6.x86_64/libctf.a
a - ctf_lib.o
gcc -g -I../common -I../common/ctf -I../uts/common/ -I../common/ctf -I. -I../linux -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -c -o ctf_subr.o ctf_subr.c
ar rv ../build-2.6.32-358.el6.x86_64/libctf.a ctf_subr.o
a - ctf_subr.o
gcc -g -I../common -I../common/ctf -I../uts/common/ -I../common/ctf -I. -I../linux -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -c ../common/ctf/ctf_create.c
ar rv ../build-2.6.32-358.el6.x86_64/libctf.a ctf_create.o
a - ctf_create.o
rm -f ctf_create.o
gcc -g -I../common -I../common/ctf -I../uts/common/ -I../common/ctf -I. -I../linux -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -c ../common/ctf/ctf_error.c
ar rv ../build-2.6.32-358.el6.x86_64/libctf.a ctf_error.o
a - ctf_error.o
rm -f ctf_error.o
gcc -g -I../common -I../common/ctf -I../uts/common/ -I../common/ctf -I. -I../linux -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -c ../common/ctf/ctf_hash.c
ar rv ../build-2.6.32-358.el6.x86_64/libctf.a ctf_hash.o
a - ctf_hash.o
rm -f ctf_hash.o
gcc -g -I../common -I../common/ctf -I../uts/common/ -I../common/ctf -I. -I../linux -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -c ../common/ctf/ctf_labels.c
ar rv ../build-2.6.32-358.el6.x86_64/libctf.a ctf_labels.o
a - ctf_labels.o
rm -f ctf_labels.o
gcc -g -I../common -I../common/ctf -I../uts/common/ -I../common/ctf -I. -I../linux -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -c ../common/ctf/ctf_lookup.c
ar rv ../build-2.6.32-358.el6.x86_64/libctf.a ctf_lookup.o
a - ctf_lookup.o
rm -f ctf_lookup.o
gcc -g -I../common -I../common/ctf -I../uts/common/ -I../common/ctf -I. -I../linux -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -c ../common/ctf/ctf_open.c
ar rv ../build-2.6.32-358.el6.x86_64/libctf.a ctf_open.o
a - ctf_open.o
rm -f ctf_open.o
gcc -g -I../common -I../common/ctf -I../uts/common/ -I../common/ctf -I. -I../linux -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -c ../common/ctf/ctf_types.c
ar rv ../build-2.6.32-358.el6.x86_64/libctf.a ctf_types.o
a - ctf_types.o
rm -f ctf_types.o
gcc -g -I../common -I../common/ctf -I../uts/common/ -I../common/ctf -I. -I../linux -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -c uncompress.c
uncompress.c: In function 'ctf_uncompress':
uncompress.c:26: warning: incompatible implicit declaration of built-in function 'memset'
ar rv ../build-2.6.32-358.el6.x86_64/libctf.a uncompress.o
a - uncompress.o
rm -f uncompress.o
gcc -g -I../common -I../common/ctf -I../uts/common/ -I../common/ctf -I. -I../linux -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -c ../common/ctf/ctf_util.c
ar rv ../build-2.6.32-358.el6.x86_64/libctf.a ctf_util.o
a - ctf_util.o
rm -f ctf_util.o
rm ctf_subr.o ctf_lib.o
cd libdtrace ; make --no-print-directory
gcc -g -I. -I../../common/ctf -I../uts/common -I../linux -I../libproc/common -I../libctf/ -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -I../build-2.6.32-358.el6.x86_64 -Ii386 -I../driver -c ../driver/dis_tables.c
ar rv ../build-2.6.32-358.el6.x86_64/libdtrace.a dis_tables.o
ar: creating ../build-2.6.32-358.el6.x86_64/libdtrace.a
a - dis_tables.o
rm -f dis_tables.o
../tools/yacc.pl -d dt_grammar.y
/usr/bin/bison -d dt_grammar.y
mv y.tab.h ../build-2.6.32-358.el6.x86_64/dt_grammar.h
mv y.tab.c dt_grammar.c
gcc -g -DYYDEBUG=1 -DYYERROR_VERBOSE -I. -I../../common/ctf -I../uts/common -I../linux -I../libproc/common -I../libctf/ -DCTF_OLD_VERSIONS -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -I../build-2.6.32-358.el6.x86_64 -c dt_grammar.c
dt_grammar.y:29:1: warning: "YYERROR_VERBOSE" redefined
<command-line>: warning: this is the location of the previous definition
dt_grammar.y:30:18: error: port.h: No such file or directory
dt_grammar.y: In function 'yyparse':
dt_grammar.y:613: warning: assignment from incompatible pointer type
dt_grammar.y:614: warning: assignment from incompatible pointer type
dt_grammar.y:615: warning: assignment from incompatible pointer type
dt_grammar.y:616: warning: assignment from incompatible pointer type
dt_grammar.y:617: warning: assignment from incompatible pointer type
dt_grammar.y:618: warning: assignment from incompatible pointer type
make[2]: *** [../build-2.6.32-358.el6.x86_64/dt_grammar.h] Error 1
make[1]: *** [do_cmds] Error 2
tools/bug.sh
make: *** [all] Error 1
答案1
ERROR: Module dtrace_kmem does not exist in /proc/modules
您的内核未使用 dtrace 编译,因此会失败。
您应该确保该模块存在并且已加载。检查它是否存在modprobe dtrace_kmem
。
此外,dtrace 适用于 Sun OpenSolaris,尽管他们已将其移植到 Linux 发行版中。
如果你真的想要的话,你可以找到官方文档这里。
您可能想使用strace
orltrace
代替。