问一个使用 Systemtap 调试 PHP 的问题 关于函数对探针似乎没有效果?

2018-03-06 17:45:17 +08:00
 yangbin9317

用的http://php.net/manual/en/features.dtrace.systemtap.php最下面探针代码

request__startup 和 request__shutdown 有效果

stap -c 'php test2.php' all_probes.stp -vv

输出为

Pass 1: parsed user script and 470 library scripts using 129380virt/42348res/3340shr/39452data kb, in 310usr/30sys/333real ms.
focused on module '/usr/local/bin/php' = [0x400000-0x1114b68, bias 0 file /usr/local/bin/php ELF machine |x86_64 (code 62)
focused on module '/usr/local/bin/php' = [0x400000-0x1114b68, bias 0 file /usr/local/bin/php ELF machine |x86_64 (code 62)
focused on module '/usr/local/bin/php' = [0x400000-0x1114b68, bias 0 file /usr/local/bin/php ELF machine |x86_64 (code 62)
focused on module '/usr/local/bin/php' = [0x400000-0x1114b68, bias 0 file /usr/local/bin/php ELF machine |x86_64 (code 62)
focused on module '/usr/local/bin/php' = [0x400000-0x1114b68, bias 0 file /usr/local/bin/php ELF machine |x86_64 (code 62)
focused on module '/usr/local/bin/php' = [0x400000-0x1114b68, bias 0 file /usr/local/bin/php ELF machine |x86_64 (code 62)
focused on module '/usr/local/bin/php' = [0x400000-0x1114b68, bias 0 file /usr/local/bin/php ELF machine |x86_64 (code 62)
focused on module '/usr/local/bin/php' = [0x400000-0x1114b68, bias 0 file /usr/local/bin/php ELF machine |x86_64 (code 62)
focused on module '/usr/local/bin/php' = [0x400000-0x1114b68, bias 0 file /usr/local/bin/php ELF machine |x86_64 (code 62)
focused on module '/usr/local/bin/php' = [0x400000-0x1114b68, bias 0 file /usr/local/bin/php ELF machine |x86_64 (code 62)
focused on module '/usr/local/bin/php' = [0x400000-0x1114b68, bias 0 file /usr/local/bin/php ELF machine |x86_64 (code 62)
Pass 2: analyzed script: 14 probes, 4 functions, 1 embed, 0 globals using 130964virt/44884res/4068shr/41036data kb, in 10usr/0sys/12real ms.
Pass 3: using cached /root/.systemtap/cache/0b/stap_0bce6eae8275f6d1c2bd99436f6a4daf_9524.c
Pass 4: using cached /root/.systemtap/cache/0b/stap_0bce6eae8275f6d1c2bd99436f6a4daf_9524.ko
Pass 5: starting run.
Running /usr/bin/staprun -v -c php test2.php -R /tmp/stap5H9eS2/stap_0bce6eae8275f6d1c2bd99436f6a4daf_9524.ko
staprun:insert_module:191 Module stap_0bce6eae8275f6d1c2bd99436f6a4daf_4195 inserted from file /tmp/stap5H9eS2/stap_0bce6eae8275f6d1c2bd99436f6a4daf_9524.ko
stapio:start_cmd:263 blocking briefly
stapio:stp_main_loop:848 detaching pid 4197
stapio:start_cmd:285 execing target_cmd php test2.php
Probe request__startup
  file /home/test2.php
  request_uri -
  request_method -
Probe request__shutdown
  file /home/test2.php
  request_uri -
  request_method -
stapio:cleanup_and_exit:510 detach=0
stapio:cleanup_and_exit:527 closing control channel
staprun:remove_module:284 Module stap_0bce6eae8275f6d1c2bd99436f6a4daf_4195 removed.
Spawn waitpid result (0x0): 0
Pass 5: run completed in 10usr/30sys/299real ms.

php 代码为

<?php
function test() {
        return 1;
}
test();
704 次点击
所在节点    问与答
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/435449

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX