6

I am attempting to debug a SIGSEGV on PHP on my Ubuntu 9.10.

I've installed php5-dbg to have the debug symbols available, however, when I start gdb, it shows the following output:

Reading symbols from /usr/bin/php...
Reading symbols from /usr/lib/debug/usr/bin/php5...done.
(no debugging symbols found)...done.

Any ideas are welcome.

4
  • Type, /usr/bin/php -v in terminal,does it say: (DEBUG) in the top version line (at the end).If there is no such line, that's the problem you didn't install php5-dbg correctly
    – karthick87
    Nov 14, 2010 at 15:03
  • It's not there, though I installed everything through Synaptic... I even reinstalled to no avail.... Kinda weird... any ideas for this behavior?
    – Johnco
    Nov 14, 2010 at 15:23
  • I tried to reproduce on my system, but got debug with php5-dbg. You might try apt-get purge of some packages?
    – belacqua
    Feb 2, 2011 at 19:43
  • Related: How to get current PHP function name in gdb?
    – kenorb
    Jun 16, 2019 at 21:52

1 Answer 1

4

Under certain situations, the -dbg packages don't work correctly. Instead, try the -dbgsym packages, available from the separate "debug symbols" repository:

https://wiki.ubuntu.com/DebuggingProgramCrash

However, when trying this locally with Ubuntu 9.10, I have no problem loading symbols using the existing php5-dbg package. Perhaps make sure you have the latest updates installed first, and then try it?

As an example:

$ 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
1
  • That did the trick. I don't know why it wouldn't work with the other package! Thanks!
    – Johnco
    Feb 10, 2011 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.