$gdb php
(gdb) run index.php
Starting program: /usr/local/bin/php index.php
Unable to find Mach task port for process-id 96064: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
$sudo gdb php
Password:
GNU gdb (GDB) 8.0
(gdb) run index.php
Starting program: /usr/local/bin/php index.php
t open to read symbols: No such file or directory.
[Inferior 1 (process 96513) exited normally]
(gdb) b yaf.c 541
Function “yaf.c 541” not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (yaf.c 541) pending.
(gdb) b main
Breakpoint 2 at 0x10049f977: main. (13 locations)
(gdb) run index.php
Starting program: /usr/local/bin/php index.php
Breakpoint 2, main (argc=2, argv=0x7fff5fbff7e0) at sapi/cli/php_cli.c:1217
1217 char *php_optarg = NULL;
(gdb) list
1212 #endif
1213
1214 int c;
(gdb) b yaf_application_new
Function “yaf_application_new” not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 3 (yaf_application_new) pending.
(gdb) break zif_confirm_mydebug_compiled
Function “zif_confirm_mydebug_compiled” not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 4 (zif_confirm_mydebug_compiled) pending.
Breakpoint 3, 0x0000000101078c44 in yaf_application_new () from /usr/local/lib/php/extensions/no-debug-non-zts-20170718/yaf.so
(gdb) l
1212 #endif
1213
1214 int c;
1215 int exit_status = SUCCESS;
(gdb) bt
#0 0x0000000101078c44 in yaf_application_new () from /usr/local/lib/php/extensions/no-debug-non-zts-20170718/yaf.so
#1 0x00000001003c8c4e in _object_and_properties_init (arg=0x1016200b0, class_type=0x101150090, properties=0x0) at Zend/zend_API.c:1332
#2 0x000000010044db16 in ZEND_NEW_SPEC_CONST_HANDLER (execute_data=0x1016200b0) at Zend/zend_vm_execute.h:3239
#3 0x000000010040c8c8 in execute_ex (ex=
#4 0x000000010040ca73 in zend_execute (op_array=0x10166e0e0, return_value=
#5 0x00000001003c4dfb in zend_execute_scripts (type=
#6 0x0000000100359685 in php_execute_script (primary_file=
#7 0x00000001004a0ec4 in do_cli (argc=
#8 0x000000010049fdd6 in main (argc=
对于动态链接库breakpoint 会先pending ,运行到的时候会名字
我们可以看到yaf的加载顺序
yaf_application_new () from /usr/local/lib/php/extensions/no-debug-non-zts-20170718/yaf.so
_object_and_properties_init (arg=0x1016200b0, class_type=0x101150090, properties=0x0) at Zend/zend_API.c:1332
ZEND_NEW_SPEC_CONST_HANDLER (execute_data=0x1016200b0) at Zend/zend_vm_execute.h:3239
execute_ex (ex=
zend_execute (op_array=0x10166e0e0, return_value=
zend_execute_scripts (type=
php_execute_script (primary_file=
do_cli (argc=
main (argc=
https://segmentfault.com/a/1190000004136351
https://www.cnblogs.com/yishuiliunian/archive/2013/01/13/2858836.html
https://blog.csdn.net/ULi_cloud/article/details/73291325
https://blog.csdn.net/luolaifa000/article/details/100518718
https://blog.csdn.net/xiaolei1982/article/details/20584291
https://blog.it2048.cn/article-php-ext/
https://blog.csdn.net/gb4215287/article/details/78756797
https://www.laruence.com/2020/03/09/5395.html
https://www.laruence.com/2012/07/06/2649.html
https://github.com/laruence/php-yaf-doc
https://github.com/akDeveloper/yaf_base_application
https://github.com/warmans/Yaf-PHP-Example