V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
yangbin9317
V2EX  ›  问与答

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

  •  
  •   yangbin9317 · 2018-03-06 17:45:17 +08:00 · 703 次点击
    这是一个创建于 2259 天前的主题,其中的信息可能已经有所发展或是发生改变。

    用的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();
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1113 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 22:59 · PVG 06:59 · LAX 15:59 · JFK 18:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.