Giter Club home page Giter Club logo

phptrace's Introduction

phptrace

We have a new trace tool Molten, It's an OpenTracing supported tracer, for Distributed Tracing System.

我们开发了新的Trace工具 Molten, 它支持OpenTracing,用于分布式追踪系统。

Build Status

Readme in Chinese 中文

phptrace is a low-overhead tracing tool for PHP.

It can trace all PHP executing, function calls, request information during run-time. And provides features like Filter, Statistics, Current Status and so on.

It is very useful to locate blocking, heavy-load problems and debug in all environments, especially in production environments.

Features:

  • low-overhead, when extension loaded and trace is off
  • stable, running on Qihoo 360 and tested on mainstream frameworks
  • ease of use, view PHP run-time status without extension installation

Misc:

News We have build another interesting project pika. It's a NoSQL compatible with Redis protocol with huge storage space.

Install from source

  1. Extracting tarball

    tar -xf phptrace-{version}.tar.gz
    cd phptrace-{version}/extension
    
  2. Build

    PHP Extension

    {php_bin_dir}/phpize
    ./configure --with-php-config={php_bin_dir}/php-config
    make
    

    CLI Binary

    make cli
    
  3. Install & Configure

    Install PHP Extension, CLI Binary into PHP path

    make install-all
    

    Edit php.ini, add the following line. A reload is needed if PHP running on php-fpm mode.

    extension=trace.so
    
  4. Verify

    php -r 'for ($i = 0; $i < 20; $i++) usleep(50000);' &
    phptrace -p $!
    

    You should see something below if it works fine

    process attached
    [pid 3600]> cli php -
    [pid 3600]> {main}() called at [Command line code:1]
    [pid 3600]    > usleep(50000) called at [Command line code:1]
    [pid 3600]    < usleep(50000) = NULL called at [Command line code:1] ~ 0.051s 0.051s
    [pid 3600]    > usleep(50000) called at [Command line code:1]
    [pid 3600]    < usleep(50000) = NULL called at [Command line code:1] ~ 0.051s 0.051s
    [pid 3600]    > usleep(50000) called at [Command line code:1]
    [pid 3600]    < usleep(50000) = NULL called at [Command line code:1] ~ 0.051s 0.051s
    [pid 3600]    > usleep(50000) called at [Command line code:1]
    ...
    

Usage

Just try php example.php.

Command line options

  • trace trace running php process(default)
  • status display php process status
  • version show version
  • -p specify php process id ('all' to trace all processes)
  • -h show helper
  • -v same as version
  • -f filter data by type(url,function,class) and content
  • -l limit output count
  • --ptrace in status mode fetch data using ptrace

Trace executing

$ phptrace -p 3600

[pid 3600]    > Me->run() called at [example.php:57]
[pid 3600]        > Me->say("good night") called at [example.php:33]
[pid 3600]        < Me->say("good night") = NULL called at [example.php:33] ~ 0.000s 0.000s
[pid 3600]        > Me->sleep() called at [example.php:34]
[pid 3600]            > Me->say("sleeping...") called at [example.php:27]
[pid 3600]            < Me->say("sleeping...") = NULL called at [example.php:27] ~ 0.000s 0.000s
[pid 3600]            > sleep(2) called at [example.php:28]
[pid 3600]            < sleep(2) = 0 called at [example.php:28] ~ 2.000s 2.000s
[pid 3600]        < Me->sleep() = NULL called at [example.php:34] ~ 2.000s 0.000s
[pid 3600]        > Me->say("wake up") called at [example.php:35]
[pid 3600]        < Me->say("wake up") = NULL called at [example.php:35] ~ 0.000s 0.000s
[pid 3600]    < Me->run() = NULL called at [example.php:57] ~ 2.000s 0.000s

Print current status

$ phptrace status -p 3600

------------------------------- Status --------------------------------
PHP Version:       7.0.16
SAPI:              cli
script:            example.php
elapse:            26.958s
------------------------------ Arguments ------------------------------
$0
------------------------------ Backtrace ------------------------------
#0  fgets() called at [example.php:53]
#1  {main}() called at [example.php:53]

Tracing with filter of url/class/function

$ phptrace -p 3600 -f type=class,content=Me

[pid 3600]> Me->run() called at [example.php:57]
[pid 3600]> Me->say("good night") called at [example.php:33]
[pid 3600]< Me->say("good night") = NULL called at [example.php:33] ~ 0.000s 0.000s
[pid 3600]> Me->sleep() called at [example.php:34]
[pid 3600]> Me->say("sleeping...") called at [example.php:27]
[pid 3600]< Me->say("sleeping...") = NULL called at [example.php:27] ~ 0.000s 0.000s
[pid 3600]< Me->sleep() = NULL called at [example.php:34] ~ 2.000s 2.000s
[pid 3600]> Me->say("wake up") called at [example.php:35]
[pid 3600]< Me->say("wake up") = NULL called at [example.php:35] ~ 0.000s 0.000s
[pid 3600]< Me->run() = NULL called at [example.php:57] ~ 2.001s 0.000s

Limit frame/URL display times

$ phptrace -p 3600 -l 2

[pid 3600]    > Me->run() called at [example.php:57]
[pid 3600]        > Me->say("good night") called at [example.php:33]
[pid 3600]        < Me->say("good night") = NULL called at [example.php:33] ~ 0.000s 0.000s
[pid 3600]        > Me->sleep() called at [example.php:34]
[pid 3600]            > Me->say("sleeping...") called at [example.php:27]
[pid 3600]            < Me->say("sleeping...") = NULL called at [example.php:27] ~ 0.000s 0.000s

Contributing

Welcome developers who willing to make PHP environment better.

If you are interested but have no idea about how to starting, please try these below:

License

This project is released under the Apache 2.0 License.

phptrace's People

Contributors

baotiao avatar chancey avatar flabby avatar gasol avatar martyix avatar monque avatar philsturgeon avatar remicollet avatar shafreeck avatar silkcutks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phptrace's Issues

线程安全下编译通过,但是加载报错“undefined symbol: executor_globals”

#4

在线程安全下编译通过,但是加载报错。

环境信息:

系统版本:CentOS 6.5 64位
[root@~/software/phptrace/phpext]# uname -a
Linux AY140321223706700af3Z 2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

PHP版本: PHP 5.3.29 (cli) (built: Oct 20 2014 23:14:00) (DEBUG) 开启线程安全

[root@~/software/phptrace/phpext]# /usr/local/php/bin/php -m|grep phptrace
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php-5.3.29/lib/php/extensions/debug-zts-20090626/phptrace.so' - /usr/local/php-5.3.29/lib/php/extensions/debug-zts-20090626/phptrace.so: undefined symbol: executor_globals in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/php-5.3.29/lib/php/extensions/debug-zts-20090626/phptrace.so' - /usr/local/php-5.3.29/lib/php/extensions/debug-zts-20090626/phptrace.so: undefined symbol: executor_globals in Unknown on line 0
[root@~/software/phptrace/phpext]# /usr/local/php/bin/php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php-5.3.29/lib/php/extensions/debug-zts-20090626/phptrace.so' - /usr/local/php-5.3.29/lib/php/extensions/debug-zts-20090626/phptrace.so: undefined symbol: executor_globals in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/php-5.3.29/lib/php/extensions/debug-zts-20090626/phptrace.so' - /usr/local/php-5.3.29/lib/php/extensions/debug-zts-20090626/phptrace.so: undefined symbol: executor_globals in Unknown on line 0
PHP 5.3.29 (cli) (built: Oct 20 2014 23:14:00) (DEBUG)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies

关于参数选项

-o outfile -- write the trace data to file in specified format
--format format -- specify the format when -o option is set. Legal values is json for now
当我选择用格式化输出到文件 这个json格文件该如何书写、需要官方给出一个简单的demo

还有就是我用-w这个选项数据是写ok的 但是都是一些乱码 不知为何? 望解答 谢谢!

在php7环境安装好之后无法调试输出

问题描述:
根据文档github文档正常安装,成功加载扩展,成功编译生成phpstrace命令
执行phptrace -p php-fpm进程pid 没有任何输出
phptrace-nightly 版本

备注:
php7环境下是否需要对php打一些补丁之类的?

STACK ERROR

dump status failed. maybe the process is not executing a php script

当启动时候报错
php版本PHP 5.5.28

mac

gcc -g -Wall -O2 -fno-strict-aliasing -D_GNU_SOURCE -I/usr/local/src/phptrace-master/cmdtool/../common -I/usr/local/src/phptrace-master/cmdtool/../common/sds -c sys_trace.c -o sys_trace.o
sys_trace.c:7:20: error: use of undeclared identifier 'PTRACE_ATTACH'
if (0 > ptrace(PTRACE_ATTACH, pid, 0, 0)) {
^
sys_trace.c:16:20: error: use of undeclared identifier 'PTRACE_DETACH'
if (0 > ptrace(PTRACE_DETACH, pid, (void ) 1, 0)) {
^
sys_trace.c:38:20: error: use of undeclared identifier 'PTRACE_PEEKDATA'
*data = ptrace(PTRACE_PEEKDATA, pid, (void *) addr, 0);
^
sys_trace.c:83:20: warning: implicit declaration of function 'kill' is invalid
in C99 [-Wimplicit-function-declaration]
return kill(pid, sig);
^
1 warning and 3 errors generated.
make: *
* [sys_trace.o] Error 1

Invalid process id: 'xxxxxxx'

大家好,

sysctl -a |grep pid_max

kernel.pid_max = 245760

我通过top查看占用cpu 99%的pid 这个pid当时侯为php-cli执行中

[phptrace/cmdtool]# ./phptrace -p 104459
Invalid process id: '104459'

如何修复这个bug?

谢谢。

Other examples of how to use phptrace?

The canonical example works fine:

$ php -r 'for ($i = 0; $i < 100; $i++) usleep(10000);' & ./phptrace -p $!

After the following small modification, the tracing program does not output anything:

$ php -r 'for ($i = 0; $i < 100; $i++) echo "$i\n";' & ./phptrace -p $!

By the time phptrace gets called, in my impression, the program has terminated already. Any example of how to make it work anyway?

failed to ptrace(PEEKDATA) pid

[root@simon cmdtool]# ./phptrace -p 5435 -s
phptrace 0.1 demo, published by infra webcore team
[5494] 30 Dec 15:52:14.016 # failed to ptrace(PEEKDATA) pid 5435
[5494] 30 Dec 15:52:15.017 # failed to ptrace(PEEKDATA) pid 5435
[5494] 30 Dec 15:52:16.017 # failed to ptrace(PEEKDATA) pid 5435
dump stack failed!

这是什么问题引起的

Not Working

I have installed the tool and tried the sample check its not working.
Not Working : By not working i mean there are no trace i can see.
I have added the extension and php.ini parsing and execution where susccessfull

php 5.5.14 环境下yii2会导致php进程crash

php 5.5.14 环境下yii2会导致php进程crash

(gdb) bt
#0  0x00000000007d0f79 in gc_zval_possible_root (zv=0x316cf48) at /data/software/php-5.5.14/Zend/zend_gc.c:143
#1  0x00000000007d3f27 in zend_object_std_dtor (object=0x316b358) at /data/software/php-5.5.14/Zend/zend_objects.c:54
#2  0x00000000007d3f59 in zend_objects_free_object_storage (object=0x316b358) at /data/software/php-5.5.14/Zend/zend_objects.c:137
#3  0x00000000007da047 in zend_objects_store_del_ref_by_handle_ex (handle=10, handlers=<optimized out>) at /data/software/php-5.5.14/Zend/zend_objects_API.c:226
#4  0x00000000007da063 in zend_objects_store_del_ref (zobject=0x316b5d8) at /data/software/php-5.5.14/Zend/zend_objects_API.c:178
#5  0x00000000007a1318 in _zval_dtor (zvalue=0x316b5d8) at /data/software/php-5.5.14/Zend/zend_variables.h:35
#6  i_zval_ptr_dtor (zval_ptr=0x316b5d8) at /data/software/php-5.5.14/Zend/zend_execute.h:81
#7  _zval_ptr_dtor (zval_ptr=<optimized out>) at /data/software/php-5.5.14/Zend/zend_execute_API.c:426
#8  0x00000000007d3f27 in zend_object_std_dtor (object=0x316cd48) at /data/software/php-5.5.14/Zend/zend_objects.c:54
#9  0x00000000007d3f59 in zend_objects_free_object_storage (object=0x316cd48) at /data/software/php-5.5.14/Zend/zend_objects.c:137
#10 0x00000000007da047 in zend_objects_store_del_ref_by_handle_ex (handle=12, handlers=<optimized out>) at /data/software/php-5.5.14/Zend/zend_objects_API.c:226
#11 0x00000000007da063 in zend_objects_store_del_ref (zobject=0x3057978) at /data/software/php-5.5.14/Zend/zend_objects_API.c:178
#12 0x00000000007a1318 in _zval_dtor (zvalue=0x3057978) at /data/software/php-5.5.14/Zend/zend_variables.h:35
#13 i_zval_ptr_dtor (zval_ptr=0x3057978) at /data/software/php-5.5.14/Zend/zend_execute.h:81
#14 _zval_ptr_dtor (zval_ptr=<optimized out>) at /data/software/php-5.5.14/Zend/zend_execute_API.c:426
#15 0x00000000007a5e59 in cleanup_user_class_data (ce=0x3056bb0) at /data/software/php-5.5.14/Zend/zend_opcode.c:171
#16 zend_cleanup_user_class_data (pce=<optimized out>) at /data/software/php-5.5.14/Zend/zend_opcode.c:203
#17 0x00000000007bfa6c in zend_hash_reverse_apply (ht=0x2dfece0, apply_func=0x7a5dd0 <zend_cleanup_user_class_data>) at /data/software/php-5.5.14/Zend/zend_hash.c:799
#18 0x00000000007a18af in shutdown_executor () at /data/software/php-5.5.14/Zend/zend_execute_API.c:287
#19 0x00000000007b1215 in zend_deactivate () at /data/software/php-5.5.14/Zend/zend.c:935
#20 0x000000000074f777 in php_request_shutdown (dummy=<optimized out>) at /data/software/php-5.5.14/main/main.c:1808
#21 0x00000000004372c6 in main (argc=<optimized out>, argv=<optimized out>) at /data/software/php-5.5.14/sapi/fpm/fpm/fpm_main.c:1961

STACK ERROR: fetch PHP globals address failed

  • `root@nood:/tmp/phptrace/cmdtool# ps -aux | grep php-fpm
  • root 1963 0.0 0.3 344984 26076 ? Ss 08:16 0:00 php-fpm: master process
  • www-data 1966 0.0 0.1 344984 8648 ? S 08:16 0:00 php-fpm: pool www
  • www-data 1967 0.0 0.1 344984 8648 ? S 08:16 0:00 php-fpm: pool www
  • root 9327 0.0 0.0 12884 968 pts/0 S+ 12:18 0:00 grep php-fpm
  • `

当我执行 phptrace的时候显示
root@nood:/tmp/phptrace/cmdtool# phptrace -p 1963 -s STACK ERROR: fetch PHP globals address failed
看了下phpinfo()加载的trace没有问题阿;
trace.data_dir /tmp /tmp
trace.dotrace 1 1
trace.enable 1 1

系统:debian7 PHP 5.6.9-0+deb8u1 (cli) 同时运行的还有xdebug不知道会不会影响;

trace error

error msg :
[15173] 09 Jan 09:34:08.736 . [error] phptrace_mmap '/tmp/phptrace.trace.10676' failed!

[15173] 09 Jan 09:34:08.737 . open data mmap sleep 200 ms.

[15173] 09 Jan 09:34:08.938 . [error] phptrace_mmap '/tmp/phptrace.trace.10676' failed!

already install phptrace.so
root@ubuntu:/opt/phptrace/cmdtool# ls /usr/lib/php5/20121212/phptrace.so
/usr/lib/php5/20121212/phptrace.so

and config it in /etc/php5/fpm/php.ini

[phptrace]
extension=phptrace.so
phptrace.enabled = 1

What is I missed. Thanks in advance.

not work

OS debian 8.1
PHP VERSION PHP 5.6.13-0+deb8u1 (cli)

➜ ~ php -r 'for ($i = 0; $i < 100; $i++) usleep(100000);' &
[1] 4362
➜ ~ phptrace -s -p 4362
Memory
usage: 114180
peak_usage: 116336
real_usage: 262144
real_peak_usage: 262144

Request
request_script: -
request_time: 1445305080.264987

Stack
#1 usleep(100000) at [:1]

*** Error in `/usr/bin/trace-php': free(): invalid pointer: 0x091640f0 ***
/usr/bin/phptrace: line 146: 4371 Aborted "$SCRIPT_PATH/trace-php" $@
STACK ERROR: Can not fetch PHP status from extension, fallback to get stack by ptrace
can not print php stack

扩展名称不是phptrace.so 而是 trace.so

配置后发现没起作用
phptrace -p 9059
CONTROL ERROR: cannot open control mmap file /tmp/phptrace.ctrl (No such file or directory)

检查后发现 .so文件名称为 trace.so

提供的例子是
[phptrace]
extension=phptrace.so
phptrace.enabled = 1
实际上 这里应该改为
extension=trace.so

php5-fpm

Can I use phptrace to trace scripts that were run by php5-fpm service?

Thank you

mac 编译cmdtool 报错

机器:mac air
php: 5.6.3
cd 到 cmdtool 目录
make
报如下错误
gcc -g -Wall -O2 -fno-strict-aliasing -D_GNU_SOURCE -I/Users/xxx/work/study/php/phptrace-master/cmdtool/../common -I/Users/xxx/work/study/php/phptrace-master/cmdtool/../common/sds -c sys_trace.c -o sys_trace.o
sys_trace.c:7:20: error: use of undeclared identifier 'PTRACE_ATTACH'
if (0 > ptrace(PTRACE_ATTACH, pid, 0, 0)) {
^
sys_trace.c:16:20: error: use of undeclared identifier 'PTRACE_DETACH'
if (0 > ptrace(PTRACE_DETACH, pid, (void ) 1, 0)) {
^
sys_trace.c:38:20: error: use of undeclared identifier 'PTRACE_PEEKDATA'
*data = ptrace(PTRACE_PEEKDATA, pid, (void *) addr, 0);
^
sys_trace.c:83:20: warning: implicit declaration of function 'kill' is invalid in C99 [-Wimplicit-function-declaration]
return kill(pid, sig);
^
1 warning and 3 errors generated.
make: *
* [sys_trace.o] Error 1

segfault when enable xdebug

It will cause segfault when use with xdebug

#0  0x00000035ee679a33 in _int_malloc () from /lib64/libc.so.6
#1  0x00000035ee67a991 in malloc () from /lib64/libc.so.6
#2  0x00007ff7408a9c34 in sdsnewlen (init=0x7fff4481c5f0, initlen=1) at /home/renyongquan/Codes/phptrace/phpext/common/sds/sds.c:55
#3  0x00007ff7408a790a in phptrace_repr_zval (val=0x7ff746c17e18, tsrm_ls=0x3132090) at /home/renyongquan/Codes/phptrace/phpext/phptrace.c:306
#4  0x00007ff7408a7bfc in phptrace_get_parameters (ex=0x7ff746bdb0f8, tsrm_ls=0x3132090) at /home/renyongquan/Codes/phptrace/phpext/phptrace.c:396
#5  0x00007ff7408a8501 in phptrace_get_php_status (tsrm_ls=0x3132090) at /home/renyongquan/Codes/phptrace/phpext/phptrace.c:551
#6  0x00007ff7408a8697 in phptrace_execute_core (ex=0x7ff746bdba78, px=0x7fff4481cbb0, tsrm_ls=0x3132090) at /home/renyongquan/Codes/phptrace/phpext/phptrace.c:583
#7  0x00007ff7408a920a in phptrace_execute_internal (current_execute_data=0x7ff746bdba78, return_value_used=1, tsrm_ls=0x3132090) at /home/renyongquan/Codes/phptrace/phpext/phptrace.c:849
#8  0x00007ff740abf59c in xdebug_execute_internal (current_execute_data=0x7ff746bdba78, return_value_used=1, tsrm_ls=0x3132090) at /home/renyongquan/Tools/xdebug-2.2.6/xdebug.c:1547
#9  0x0000000000989290 in zend_do_fcall_common_helper_SPEC (execute_data=0x7ff746bdba78, tsrm_ls=0x3132090) at /home/renyongquan/Tools/php-5.4.35/Zend/zend_vm_execute.h:645
#10 0x000000000098e668 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0x7ff746bdba78, tsrm_ls=0x3132090) at /home/renyongquan/Tools/php-5.4.35/Zend/zend_vm_execute.h:2233

关于php cli模式使用phptrace问题

扩展已安装ok 环境在mac下 用命令行启动php命令启动的web server 为什么用phptrace去监听pid什么都没有 ? phptrace不支持php命令启动的server吗?

[make error] phptrace_execute_core

cc -I. -I/root/source/phptrace-master/phpext -DPHP_ATOM_INC -I/root/source/phptrace-master/phpext/include -I/root/source/phptrace-master/phpext/main -I/root/source/phptrace-master/phpext -I/data/local/php/include/php -I/data/local/php/include/php/main -I/data/local/php/include/php/TSRM -I/data/local/php/include/php/Zend -I/data/local/php/include/php/ext -I/data/local/php/include/php/ext/date/lib -I/root/source/phptrace-master/common -DHAVE_CONFIG_H -g -O2 -c /root/source/phptrace-master/phpext/phptrace.c -fPIC -DPIC -o .libs/phptrace.o
/root/source/phptrace-master/phpext/phptrace.c: 在函数‘phptrace_execute_core’中:
/root/source/phptrace-master/phpext/phptrace.c:508: 警告:对‘long’类型而言整数常量太大
/root/source/phptrace-master/phpext/phptrace.c:509: 警告:对‘long’类型而言整数常量太大
make: *** 没有规则可以创建“common/phptrace_mmap.lo”需要的目标“/root/source/phptrace-master/phpext/common/phptrace_mmap.c”。 停止。

my sys info:
Linux localhost 2.6.32-279.el6.i686 #1 SMP Fri Jun 22 10:59:55 UTC 2012 i686 i686 i386 GNU/Linux
php 5.3.27

统计输出的结果需要改进

统计的时候按完整的method统计就是带命名空间类名, 同样的function name在不同的类里面, 肯定是不同的method。 都统计到一个function_name下不合理

_004

php7 support?

Does phptrace support php7 or not? I'm trying compile it under PHP 7.0.0-dev (cli) (built: Aug 27 2015 00:25:27) and failed. Here is the log (CentOS7 x64)

Configuring for:
PHP Api Version:         20131218
Zend Module Api No:      20141001
Zend Extension Api No:   320140815
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /root/.phpbrew/php/php-master
checking for PHP includes... -I/root/.phpbrew/php/php-master/include/php -I/root/.phpbrew/php/php-master/include/php/main -I/root/.phpbrew/php/php-master/include/php/TSRM -I/root/.phpbrew/php/php-master/include/php/Zend -I/root/.phpbrew/php/php-master/include/php/ext -I/root/.phpbrew/php/php-master/include/php/ext/date/lib
checking for PHP extension directory... /root/.phpbrew/php/php-master/lib/php/extensions/no-debug-non-zts-20141001
checking for PHP installed headers prefix... /root/.phpbrew/php/php-master/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable trace support... yes, shared
checking for mmap... yes
checking for munmap... yes
checking for ld used by cc... /bin/ld
checking if the linker (/bin/ld) is GNU ld... yes
checking for /bin/ld option to reload object files... -r
checking for BSD-compatible nm... /bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
make: Entering directory `/root/.phpbrew/build/php-master/ext/trace/extension'
/bin/sh /root/.phpbrew/build/php-master/ext/trace/extension/libtool --mode=compile cc  -I. -I/root/.phpbrew/build/php-master/ext/trace/extension -DPHP_ATOM_INC -I/root/.phpbrew/build/php-master/ext/trace/extension/include -I/root/.phpbrew/build/php-master/ext/trace/extension/main -I/root/.phpbrew/build/php-master/ext/trace/extension -I/root/.phpbrew/php/php-master/include/php -I/root/.phpbrew/php/php-master/include/php/main -I/root/.phpbrew/php/php-master/include/php/TSRM -I/root/.phpbrew/php/php-master/include/php/Zend -I/root/.phpbrew/php/php-master/include/php/ext -I/root/.phpbrew/php/php-master/include/php/ext/date/lib -I/root/.phpbrew/build/php-master/ext/trace/extension/common  -DHAVE_CONFIG_H  -g -O2   -c /root/.phpbrew/build/php-master/ext/trace/extension/trace.c -o trace.lo 
mkdir .libs
 cc -I. -I/root/.phpbrew/build/php-master/ext/trace/extension -DPHP_ATOM_INC -I/root/.phpbrew/build/php-master/ext/trace/extension/include -I/root/.phpbrew/build/php-master/ext/trace/extension/main -I/root/.phpbrew/build/php-master/ext/trace/extension -I/root/.phpbrew/php/php-master/include/php -I/root/.phpbrew/php/php-master/include/php/main -I/root/.phpbrew/php/php-master/include/php/TSRM -I/root/.phpbrew/php/php-master/include/php/Zend -I/root/.phpbrew/php/php-master/include/php/ext -I/root/.phpbrew/php/php-master/include/php/ext/date/lib -I/root/.phpbrew/build/php-master/ext/trace/extension/common -DHAVE_CONFIG_H -g -O2 -c /root/.phpbrew/build/php-master/ext/trace/extension/trace.c  -fPIC -DPIC -o .libs/trace.o
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c: In function ‘zm_startup_trace’:
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:208:29: warning: assignment from incompatible pointer type [enabled by default]
     pt_ori_execute_internal = zend_execute_internal;
                             ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:209:27: warning: assignment from incompatible pointer type [enabled by default]
     zend_execute_internal = pt_execute_internal;
                           ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c: In function ‘zm_shutdown_trace’:
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:248:27: warning: assignment from incompatible pointer type [enabled by default]
     zend_execute_internal = pt_ori_execute_internal;
                           ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c: In function ‘pt_frame_build’:
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:330:12: error: ‘zend_execute_data’ has no member named ‘function_state’
     zf = ex->function_state.function;
            ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:345:21: error: ‘zend_execute_data’ has no member named ‘object’
         if (ex && ex->object) {
                     ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:352:17: warning: passing argument 1 of ‘sdsnew’ from incompatible pointer type [enabled by default]
                 frame->class = sdsnew(zf->common.scope->name);
                 ^
In file included from /root/.phpbrew/build/php-master/ext/trace/extension/common/trace_type.h:21:0,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/common/trace_comm.h:22,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/php_trace.h:37,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:24:
/root/.phpbrew/build/php-master/ext/trace/extension/common/sds/sds.h:58:5: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
 sds sdsnew(const char *init);
     ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:360:13: warning: passing argument 1 of ‘sdsnew’ from incompatible pointer type [enabled by default]
             frame->class = sdsnew(zf->common.scope->name);
             ^
In file included from /root/.phpbrew/build/php-master/ext/trace/extension/common/trace_type.h:21:0,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/common/trace_comm.h:22,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/php_trace.h:37,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:24:
/root/.phpbrew/build/php-master/ext/trace/extension/common/sds/sds.h:58:5: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
 sds sdsnew(const char *init);
     ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:366:9: warning: passing argument 1 of ‘strlen’ from incompatible pointer type [enabled by default]
         if (strcmp(zf->common.function_name, "{closure}") == 0) {
         ^
In file included from /root/.phpbrew/php/php-master/include/php/main/../main/php_config.h:2483:0,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_config.h:1,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_portability.h:48,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_types.h:26,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend.h:31,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:35,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/usr/include/string.h:395:15: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
 extern size_t strlen (const char *__s)
               ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:366:9: warning: passing argument 1 of ‘__builtin_strcmp’ from incompatible pointer type [enabled by default]
         if (strcmp(zf->common.function_name, "{closure}") == 0) {
         ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:366:9: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:366:9: warning: passing argument 1 of ‘strlen’ from incompatible pointer type [enabled by default]
In file included from /root/.phpbrew/php/php-master/include/php/main/../main/php_config.h:2483:0,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_config.h:1,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_portability.h:48,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_types.h:26,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend.h:31,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:35,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/usr/include/string.h:395:15: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
 extern size_t strlen (const char *__s)
               ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:366:9: warning: passing argument 1 of ‘__builtin_strcmp’ from incompatible pointer type [enabled by default]
         if (strcmp(zf->common.function_name, "{closure}") == 0) {
         ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:366:9: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:366:9: warning: passing argument 1 of ‘__builtin_strcmp’ from incompatible pointer type [enabled by default]
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:366:9: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:366:9: warning: passing argument 1 of ‘__builtin_strcmp’ from incompatible pointer type [enabled by default]
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:366:9: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:368:9: warning: passing argument 1 of ‘strlen’ from incompatible pointer type [enabled by default]
         } else if (strcmp(zf->common.function_name, "__lambda_func") == 0) {
         ^
In file included from /root/.phpbrew/php/php-master/include/php/main/../main/php_config.h:2483:0,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_config.h:1,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_portability.h:48,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_types.h:26,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend.h:31,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:35,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/usr/include/string.h:395:15: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
 extern size_t strlen (const char *__s)
               ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:368:9: warning: passing argument 1 of ‘__builtin_strcmp’ from incompatible pointer type [enabled by default]
         } else if (strcmp(zf->common.function_name, "__lambda_func") == 0) {
         ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:368:9: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:368:9: warning: passing argument 1 of ‘strlen’ from incompatible pointer type [enabled by default]
In file included from /root/.phpbrew/php/php-master/include/php/main/../main/php_config.h:2483:0,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_config.h:1,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_portability.h:48,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_types.h:26,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend.h:31,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:35,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/usr/include/string.h:395:15: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
 extern size_t strlen (const char *__s)
               ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:368:9: warning: passing argument 1 of ‘__builtin_strcmp’ from incompatible pointer type [enabled by default]
         } else if (strcmp(zf->common.function_name, "__lambda_func") == 0) {
         ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:368:9: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:368:9: warning: passing argument 1 of ‘__builtin_strcmp’ from incompatible pointer type [enabled by default]
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:368:9: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:368:9: warning: passing argument 1 of ‘__builtin_strcmp’ from incompatible pointer type [enabled by default]
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:368:9: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:376:65: error: ‘zend_execute_data’ has no member named ‘object’
             frame->function = sdsnew(zend_resolve_method_name(ex->object ? Z_OBJCE_P(ex->object) : zf->common.scope, zf));
                                                                 ^
In file included from /root/.phpbrew/php/php-master/include/php/Zend/zend.h:31:0,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:35,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:376:88: error: ‘zend_execute_data’ has no member named ‘object’
             frame->function = sdsnew(zend_resolve_method_name(ex->object ? Z_OBJCE_P(ex->object) : zf->common.scope, zf));
                                                                                        ^
/root/.phpbrew/php/php-master/include/php/Zend/zend_types.h:529:26: note: in definition of macro ‘Z_OBJ’
 #define Z_OBJ(zval)     (zval).value.obj
                          ^
/root/.phpbrew/php/php-master/include/php/Zend/zend_types.h:542:29: note: in expansion of macro ‘Z_OBJCE’
 #define Z_OBJCE_P(zval_p)   Z_OBJCE(*(zval_p))
                             ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:376:76: note: in expansion of macro ‘Z_OBJCE_P’
             frame->function = sdsnew(zend_resolve_method_name(ex->object ? Z_OBJCE_P(ex->object) : zf->common.scope, zf));
                                                                            ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:379:13: warning: passing argument 1 of ‘sdsnew’ from incompatible pointer type [enabled by default]
             frame->function = sdsnew(zf->common.function_name);
             ^
In file included from /root/.phpbrew/build/php-master/ext/trace/extension/common/trace_type.h:21:0,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/common/trace_comm.h:22,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/php_trace.h:37,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:24:
/root/.phpbrew/build/php-master/ext/trace/extension/common/sds/sds.h:58:5: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
 sds sdsnew(const char *init);
     ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:390:21: error: ‘zend_execute_data’ has no member named ‘function_state’
         if (ex && ex->function_state.arguments) {
                     ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:391:58: error: ‘zend_execute_data’ has no member named ‘function_state’
             frame->arg_count = (int)(zend_uintptr_t) *(ex->function_state.arguments);
                                                          ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:392:32: error: ‘zend_execute_data’ has no member named ‘function_state’
             args = (zval **)(ex->function_state.arguments - frame->arg_count);
                                ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:453:13: warning: passing argument 1 of ‘strlen’ from incompatible pointer type [enabled by default]
             frame->args[0] = sdscatrepr(sdsempty(), zf->op_array.filename, strlen(zf->op_array.filename));
             ^
In file included from /root/.phpbrew/php/php-master/include/php/main/../main/php_config.h:2483:0,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_config.h:1,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_portability.h:48,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_types.h:26,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend.h:31,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:35,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/usr/include/string.h:395:15: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
 extern size_t strlen (const char *__s)
               ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:453:13: warning: passing argument 2 of ‘sdscatrepr’ from incompatible pointer type [enabled by default]
             frame->args[0] = sdscatrepr(sdsempty(), zf->op_array.filename, strlen(zf->op_array.filename));
             ^
In file included from /root/.phpbrew/build/php-master/ext/trace/extension/common/trace_type.h:21:0,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/common/trace_comm.h:22,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/php_trace.h:37,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:24:
/root/.phpbrew/build/php-master/ext/trace/extension/common/sds/sds.h:89:5: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
 sds sdscatrepr(sds s, const char *p, size_t len);
     ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:474:17: error: ‘zend_execute_data’ has no member named ‘op_array’
     if (ex && ex->op_array) {
                 ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:475:36: error: ‘zend_execute_data’ has no member named ‘op_array’
         frame->filename = sdsnew(ex->op_array->filename);
                                    ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:476:68: error: ‘zend_execute_data’ has no member named ‘op_array’
     } else if (ex && ex->prev_execute_data && ex->prev_execute_data->op_array) {
                                                                    ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:477:55: error: ‘zend_execute_data’ has no member named ‘op_array’
         frame->filename = sdsnew(ex->prev_execute_data->op_array->filename); /* try using prev */
                                                       ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:479:9: warning: passing argument 1 of ‘sdsnew’ from incompatible pointer type [enabled by default]
         frame->filename = sdsnew(op_array->filename);
         ^
In file included from /root/.phpbrew/build/php-master/ext/trace/extension/common/trace_type.h:21:0,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/common/trace_comm.h:22,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/php_trace.h:37,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:24:
/root/.phpbrew/build/php-master/ext/trace/extension/common/sds/sds.h:58:5: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
 sds sdsnew(const char *init);
     ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c: In function ‘pt_frame_set_retval’:
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:517:26: error: ‘zend_fcall_info’ has no member named ‘retval_ptr_ptr’
             retval = *fci->retval_ptr_ptr;
                          ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:519:60: error: invalid type argument of ‘->’ (have ‘int’)
             retval = EX_TMP_VAR(ex, ex->opline->result.var)->var.ptr;
                                                            ^
In file included from /root/.phpbrew/php/php-master/include/php/Zend/zend_globals.h:28:0,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_compile.h:656,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_modules.h:26,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_API.h:26,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:39,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/root/.phpbrew/php/php-master/include/php/Zend/zend_globals_macros.h:46:33: error: ‘zend_executor_globals’ has no member named ‘return_value_ptr_ptr’
 # define EG(v) (executor_globals.v)
                                 ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:530:17: note: in expansion of macro ‘EG’
     } else if (*EG(return_value_ptr_ptr)) {
                 ^
/root/.phpbrew/php/php-master/include/php/Zend/zend_globals_macros.h:46:33: error: ‘zend_executor_globals’ has no member named ‘return_value_ptr_ptr’
 # define EG(v) (executor_globals.v)
                                 ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:531:19: note: in expansion of macro ‘EG’
         retval = *EG(return_value_ptr_ptr);
                   ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c: In function ‘pt_repr_zval’:
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:755:14: error: ‘IS_BOOL’ undeclared (first use in this function)
         case IS_BOOL:
              ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:755:14: note: each undeclared identifier is reported only once for each function it appears in
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:781:80: error: ‘zend_uint’ undeclared (first use in this function)
                 Z_OBJ_HANDLER(*zv, get_class_name)(zv, (const char **) &tstr, (zend_uint *) &tlen, 0 TSRMLS_CC);
                                                                                ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:781:91: error: expected expression before ‘)’ token
                 Z_OBJ_HANDLER(*zv, get_class_name)(zv, (const char **) &tstr, (zend_uint *) &tlen, 0 TSRMLS_CC);
                                                                                           ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:781:91: warning: passing argument 1 of ‘zv->value.obj->handlers->get_class_name’ from incompatible pointer type [enabled by default]
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:781:91: note: expected ‘const struct zend_object *’ but argument is of type ‘struct zval *’
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:781:91: error: too many arguments to function ‘zv->value.obj->handlers->get_class_name’
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:789:13: warning: passing argument 1 of ‘zend_rsrc_list_get_rsrc_type’ makes pointer from integer without a cast [enabled by default]
             tstr = (char *) zend_rsrc_list_get_rsrc_type(Z_LVAL_P(zv) TSRMLS_CC);
             ^
In file included from /root/.phpbrew/php/php-master/include/php/Zend/zend_API.h:27:0,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:39,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/root/.phpbrew/php/php-master/include/php/Zend/zend_list.h:68:22: note: expected ‘struct zend_resource *’ but argument is of type ‘zend_long’
 ZEND_API const char *zend_rsrc_list_get_rsrc_type(zend_resource *res);
                      ^
In file included from /root/.phpbrew/php/php-master/include/php/Zend/zend_globals.h:28:0,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_compile.h:656,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_modules.h:26,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_API.h:26,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:39,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c: In function ‘pt_execute_core’:
/root/.phpbrew/php/php-master/include/php/Zend/zend_globals_macros.h:46:33: error: ‘zend_executor_globals’ has no member named ‘return_value_ptr_ptr’
 # define EG(v) (executor_globals.v)
                                 ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:909:26: note: in expansion of macro ‘EG’
         if (!internal && EG(return_value_ptr_ptr) == NULL) {
                          ^
/root/.phpbrew/php/php-master/include/php/Zend/zend_globals_macros.h:46:33: error: ‘zend_executor_globals’ has no member named ‘return_value_ptr_ptr’
 # define EG(v) (executor_globals.v)
                                 ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:910:13: note: in expansion of macro ‘EG’
             EG(return_value_ptr_ptr) = &retval;
             ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:943:17: warning: passing argument 2 of ‘execute_internal’ from incompatible pointer type [enabled by default]
                 execute_internal(execute_data, fci, rvu TSRMLS_CC);
                 ^
In file included from /root/.phpbrew/php/php-master/include/php/Zend/zend_API.h:30:0,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:39,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/root/.phpbrew/php/php-master/include/php/Zend/zend_execute.h:42:15: note: expected ‘struct zval *’ but argument is of type ‘struct zend_fcall_info *’
 ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value);
               ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:943:17: error: too many arguments to function ‘execute_internal’
                 execute_internal(execute_data, fci, rvu TSRMLS_CC);
                 ^
In file included from /root/.phpbrew/php/php-master/include/php/Zend/zend_API.h:30:0,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:39,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/root/.phpbrew/php/php-master/include/php/Zend/zend_execute.h:42:15: note: declared here
 ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value);
               ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:973:13: warning: passing argument 1 of ‘_zval_ptr_dtor’ from incompatible pointer type [enabled by default]
             zval_ptr_dtor(&retval);
             ^
In file included from /root/.phpbrew/php/php-master/include/php/Zend/zend.h:39:0,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:35,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/root/.phpbrew/php/php-master/include/php/Zend/zend_variables.h:111:15: note: expected ‘struct zval *’ but argument is of type ‘struct zval **’
 ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
               ^
In file included from /root/.phpbrew/php/php-master/include/php/Zend/zend_globals.h:28:0,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_compile.h:656,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_modules.h:26,
                 from /root/.phpbrew/php/php-master/include/php/Zend/zend_API.h:26,
                 from /root/.phpbrew/php/php-master/include/php/main/php.h:39,
                 from /root/.phpbrew/build/php-master/ext/trace/extension/trace.c:21:
/root/.phpbrew/php/php-master/include/php/Zend/zend_globals_macros.h:46:33: error: ‘zend_executor_globals’ has no member named ‘return_value_ptr_ptr’
 # define EG(v) (executor_globals.v)
                                 ^
/root/.phpbrew/build/php-master/ext/trace/extension/trace.c:974:13: note: in expansion of macro ‘EG’
             EG(return_value_ptr_ptr) = NULL;
             ^
make: *** [trace.lo] Error 1
make: Leaving directory `/root/.phpbrew/build/php-master/ext/trace/extension'

如何控制for循环下的重复抓取

对于下面的代码, 它会打印 strpos栈 200次,显然对性能影响极大,有没有办法控制打印的次数呢

function test() {
        for ($idx = 0; $idx < 200; $idx++) {
                strpos("You love php, I love php too!","php");
        }
}

[make test failed]

FAIL Trace various handlers [tests/trace_004.phpt]
PHP版本是 5.6.12

PHP : /home/service/php/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.6.12
ZEND_VERSION: 2.6.0
PHP_OS : Linux - Linux 2.6.32-888.el6.x86_64 #1 SMP Fri Feb 13 12:14:55 CST 2015 x86_64
INI actual : /home/work/trace-0.3.0/extension/tmp-php.ini
More .INIs :
CWD : /home/work/trace-0.3.0/extension
Extra dirs :

VALGRIND : Not used

TIME START 2016-03-15 11:07:01

PASS Trace simple call with various types of argument [tests/trace_001.phpt]
PASS Trace include, require, lambda, eval [tests/trace_002.phpt]
PASS Trace Class and Object [tests/trace_003.phpt]
FAIL Trace various handlers [tests/trace_004.phpt]
SKIP Trace signal handler [tests/trace_005.phpt] reason: trace_start() not exists
SKIP Trace call under namespace [tests/trace_006.phpt] reason: trace_start() not exists
SKIP Trace Closure [tests/trace_007.phpt] reason: trace_start() not exists
SKIP Trace magic method __callStatic, __invoke [tests/trace_008.phpt] reason: trace_start() not exists
PASS Trace call recursive [tests/trace_009.phpt]
SKIP Trace call trigger by autoload < 5.5 [tests/trace_010.phpt] reason: trace_start() not exists
SKIP Trace call trigger by autoload >= 5.5 [tests/trace_011.phpt] reason: trace_start() not exists

SKIP Trace Trait [tests/trace_012.phpt] reason: trace_start() not exists

TIME END 2016-03-15 11:07:01

TEST RESULT SUMMARY

Exts skipped : 0

Exts tested : 47

Number of tests : 12 5
Tests skipped : 7 ( 58.3%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 1 ( 8.3%) ( 20.0%)
Expected fail : 0 ( 0.0%) ( 0.0%)
Tests passed : 4 ( 33.3%) ( 80.0%)

能帮忙看下是环境的问题么?

开启线程安全的情况下编译不通过

在--enable-maintainer-zts的情况下编译不通过:

/root/software/phptrace/phpext/phptrace.c: In function ‘phptrace_repr_zval’:
/root/software/phptrace/phpext/phptrace.c:289: error: too few arguments to function ‘zend_rsrc_list_get_rsrc_type’

// ./Zend/zend_list.h
 85 ZEND_API char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC);

Ubuntu版本下面,运行./phptrace脚本语法错误

ubuntu下的/bin/sh 都是链到dash的,dash函数不需要function关键字

解决方法:
1.vim ./phptrace

!/bin/sh => #!/bin/bash

2.vim ./phptrace
去掉function关键词,还会有语法报错,127行($lines)不支持这种写法,改成$(lines)

daemon 环境下不输出东西

我用php扩展实现了一个daemon,然后用phptrace进行检测确没有任何输出,但是用trace命令可以输出
image

image

image

how i solve it?

make: *** No rule to make target `/usr/local/src/phptrace-0.2.2/phpext/common/phptrace_mmap.c',

Darwin 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64

/usr/local/src/phptrace-0.2.2/phpext$ sudo ./configure --with-php-config=/usr/local/opt/php55/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin14.1.0
checking host system type... x86_64-apple-darwin14.1.0
checking target system type... x86_64-apple-darwin14.1.0
checking for PHP prefix... /usr/local/Cellar/php55/5.5.19
checking for PHP includes... -I/usr/local/Cellar/php55/5.5.19/include/php -I/usr/local/Cellar/php55/5.5.19/include/php/main -I/usr/local/Cellar/php55/5.5.19/include/php/TSRM -I/usr/local/Cellar/php55/5.5.19/include/php/Zend -I/usr/local/Cellar/php55/5.5.19/include/php/ext -I/usr/local/Cellar/php55/5.5.19/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212
checking for PHP installed headers prefix... /usr/local/Cellar/php55/5.5.19/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable phptrace support... yes, shared
checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin14.1.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
joewong /usr/local/src/phptrace-0.2.2/phpext$ sudo make
/bin/sh /usr/local/src/phptrace-0.2.2/phpext/libtool --mode=compile cc -I. -I/usr/local/src/phptrace-0.2.2/phpext -DPHP_ATOM_INC -I/usr/local/src/phptrace-0.2.2/phpext/include -I/usr/local/src/phptrace-0.2.2/phpext/main -I/usr/local/src/phptrace-0.2.2/phpext -I/usr/local/Cellar/php55/5.5.19/include/php -I/usr/local/Cellar/php55/5.5.19/include/php/main -I/usr/local/Cellar/php55/5.5.19/include/php/TSRM -I/usr/local/Cellar/php55/5.5.19/include/php/Zend -I/usr/local/Cellar/php55/5.5.19/include/php/ext -I/usr/local/Cellar/php55/5.5.19/include/php/ext/date/lib -I/usr/local/src/phptrace-0.2.2/common -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phptrace-0.2.2/phpext/phptrace.c -o phptrace.lo
mkdir .libs
cc -I. -I/usr/local/src/phptrace-0.2.2/phpext -DPHP_ATOM_INC -I/usr/local/src/phptrace-0.2.2/phpext/include -I/usr/local/src/phptrace-0.2.2/phpext/main -I/usr/local/src/phptrace-0.2.2/phpext -I/usr/local/Cellar/php55/5.5.19/include/php -I/usr/local/Cellar/php55/5.5.19/include/php/main -I/usr/local/Cellar/php55/5.5.19/include/php/TSRM -I/usr/local/Cellar/php55/5.5.19/include/php/Zend -I/usr/local/Cellar/php55/5.5.19/include/php/ext -I/usr/local/Cellar/php55/5.5.19/include/php/ext/date/lib -I/usr/local/src/phptrace-0.2.2/common -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phptrace-0.2.2/phpext/phptrace.c -fno-common -DPIC -o .libs/phptrace.o
/usr/local/src/phptrace-0.2.2/phpext/phptrace.c:491:25: warning: format
specifies type 'unsigned long' but the argument has type 'uint64_t' (aka
'unsigned long long') [-Wformat]
printf("%lu %d %f ",record->seq, record->level, record->start_time/1...
~~~ ^~~~~~~~~~~
%llu
1 warning generated.
make: *** No rule to make target /usr/local/src/phptrace-0.2.2/phpext/common/phptrace_mmap.c', needed bycommon/phptrace_mmap.lo'. Stop.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.