【发布时间】:2020-11-01 18:06:38
【问题描述】:
我正在尝试使用 begin 探测来探测用户空间进程,但它似乎没有任何作用
开始.stp:
probe process("a.out").begin {
printf("%s %d\n", execname(), pid())
}
stp 输出:
[root@RHEL8 ~]# stap --bpf -v ~/begin.stp
Pass 1: parsed user script and 56 library scripts using 203356virt/48420res/12256shr/36024data kb, in 100usr/10sys/114real ms.
Pass 2: analyzed script: 2 probes, 3 functions, 0 embeds, 1 global using 204676virt/50128res/12392shr/37344data kb, in 10usr/10sys/11real ms.
Pass 3: pass skipped for stapbpf runtime in 0usr/0sys/0real ms.
Pass 4: compiled BPF into "stap_30984.bo" in 0usr/0sys/2real ms.
Pass 5: starting run.
将探针更改为main() 函数时,它似乎可以工作:
函数.stp
probe process("a.out").function("main") {
printf("%s %d\n", execname(), pid())
}
步骤输出:
[root@RHEL8 ~]# stap --bpf -v ~/222.stp
Pass 1: parsed user script and 56 library scripts using 203356virt/48364res/12200shr/36024data kb, in 290usr/50sys/404real ms.
Pass 2: analyzed script: 2 probes, 3 functions, 0 embeds, 1 global using 204676virt/50996res/13068shr/37344data kb, in 20usr/0sys/25real ms.
Pass 3: pass skipped for stapbpf runtime in 0usr/0sys/0real ms.
Pass 4: compiled BPF into "stap_31782.bo" in 0usr/0sys/3real ms.
Pass 5: starting run.
a.out 31806
a.out 31821
a.out 31827
a.out 31831
正式版
[root@RHEL8 ~]# stap --version
Systemtap translator/driver (version 4.2/0.178, rpm 4.2-6.el8)
Copyright (C) 2005-2019 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
tested kernel versions: 2.6.32 ... 5.4-rc6
enabled features: AVAHI BOOST_STRING_REF DYNINST BPF JAVA PYTHON3 LIBRPM LIBSQLITE3 LIBVIRT LIBXML2 NLS NSS READLINE
【问题讨论】:
-
看到您已经有了解决方法,这里有什么问题?如果您希望它可以与
.begin一起使用,但它没有,也许尝试调试它(我会在两个版本上以strace -e bpf开始,看看是否有任何区别)或提交错误报告以进行调试? -
实际上,一位 systemtap 开发人员告诉我,这似乎是与 bpf 的差距支持,他们至少应该发出某种警告。