![使用 gdb 调试 php](https://linux22.com/image/1033438/%E4%BD%BF%E7%94%A8%20gdb%20%E8%B0%83%E8%AF%95%20php.png)
我正在尝试在 Ubuntu 9.10 上调试 PHP 上的 SIGSEGV。
我已经安装了php5-dbg
可用的调试符号,但是,当我启动 gdb 时,它会显示以下输出:
Reading symbols from /usr/bin/php...
Reading symbols from /usr/lib/debug/usr/bin/php5...done.
(no debugging symbols found)...done.
欢迎任何想法。
答案1
在某些情况下,这些-dbg
软件包无法正常工作。相反,请尝试-dbgsym
从单独的“调试符号”存储库获取的软件包:
https://wiki.ubuntu.com/DebuggingProgramCrash
但是,当我在 Ubuntu 9.10 上本地尝试此操作时,使用现有包加载符号没有任何问题php5-dbg
。也许先确保安装了最新更新,然后再尝试?
举个例子:
$ cat /tmp/test.php
<?php sleep(10); ?>
$ gdb php
...
(gdb) run /tmp/test.php
...
^C
Program received signal SIGINT, Interrupt.
0xf7fe0430 in __kernel_vsyscall ()
(gdb) bt
#0 0xf7fe0430 in __kernel_vsyscall ()
#1 0xf7a13b50 in nanosleep () from /lib/tls/i686/cmov/libc.so.6
#2 0xf7a13991 in sleep () from /lib/tls/i686/cmov/libc.so.6
#3 0x081fbfc1 in zif_sleep (ht=1, return_value=0x866d204,
return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
at /build/buildd/php5-5.2.10.dfsg.1/ext/standard/basic_functions.c:4787
#4 0x082f9616 in zend_do_fcall_common_helper_SPEC (execute_data=0xffffafbc)
at /build/buildd/php5-5.2.10.dfsg.1/Zend/zend_vm_execute.h:200
#5 0x082f511b in execute (op_array=0x866d7f0)
at /build/buildd/php5-5.2.10.dfsg.1/Zend/zend_vm_execute.h:92
#6 0x082cf414 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /build/buildd/php5-5.2.10.dfsg.1/Zend/zend.c:1215
#7 0x08284166 in php_execute_script (primary_file=0xffffd454)
at /build/buildd/php5-5.2.10.dfsg.1/main/main.c:2046
#8 0x08352c38 in main (argc=2, argv=0xffffd554)
at /build/buildd/php5-5.2.10.dfsg.1/sapi/cli/php_cli.c:1170