2016-11-15 48 views
0

我有一個cron腳本掛在每晚(在分段環境中),但我不能像以前那樣使用dgb。dbg瞭解爲什麼PHP腳本掛起

下面的過程是:PS auxf | grep的PHP

www-data 10187 0.0 0.0 4336 684 ?  Ss 02:00 0:00  \_ /bin/sh -c /usr/bin/php -c /etc/php5/cli/php-zend.ini $BASE/resources/cron/cli.php mtd=generateTSAlarms 
www-data 10194 0.8 1.0 303612 43984 ?  t 02:00 3:29   \_ /usr/bin/php -c /etc/php5/cli/php-zend.ini $BASE/resources/cron/cli.php mtd=generateAlarms 

PHP -v:

PHP 5.6.27-0+deb8u1 (cli) (built: Oct 15 2016 15:53:28) 
Copyright (c) 1997-2016 The PHP Group 
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies 
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies 

我搶gdbinit從https://raw.githubusercontent.com/php/php-src/PHP-5.6.27/.gdbinit,並運行GBD -p 10194.我加載gdbinit文件並嘗試

(gdb) source /home/cedric/php_5.6.27_gdbinit 
(gdb) zbacktrace 
Attempt to extract a component of a value that is not a structure. 
(gdb) bt 
#0 0x00007f532b0eef2d in nanosleep() at ../sysdeps/unix/syscall-template.S:81 
#1 0x00007f532b0eedc4 in __sleep (seconds=0) at ../sysdeps/unix/sysv/linux/sleep.c:137 
#2 0x00000000006107ba in zif_sleep() 
#3 0x00000000006e5eaa in dtrace_execute_internal() 
#4 0x00000000007a6860 in ??() 
#5 0x0000000000734bb0 in execute_ex() 
#6 0x00000000006e5d48 in dtrace_execute_ex() 
#7 0x00000000007a6da3 in ??() 
#8 0x0000000000734bb0 in execute_ex() 
#9 0x00000000006e5d48 in dtrace_execute_ex() 
#10 0x00000000007a6da3 in ??() 
#11 0x0000000000734bb0 in execute_ex() 
#12 0x00000000006e5d48 in dtrace_execute_ex() 
#13 0x00000000007a6da3 in ??() 
#14 0x0000000000734bb0 in execute_ex() 
#15 0x00000000006e5d48 in dtrace_execute_ex() 
#16 0x00000000006f8910 in zend_execute_scripts() 
#17 0x0000000000693cbb in php_execute_script() 
#18 0x00000000007a881b in ??() 
#19 0x0000000000462bdd in main() 

爲什麼zbacktrace不能正常工作?

回答

0

你可能會缺少debugsymbols(在你的情況下,php-cli-dbgsym或類似的,取決於版本)。如果您使用的是Ubuntu,請確保在sources.list(https://wiki.ubuntu.com/DebuggingProgramCrash)中擁有-dbgsym軟件包的存儲庫。

啓動gdb時,應該在提示符前說: Reading symbols from php...Reading symbols from /usr/lib/debug/.build-id/8e/6ac5059e812667e453294f1f58e105435d82e8.debug...done. (gdb)