MantisBT - Xdebug
View Issue Details
0000085XdebugUsage problems (Wrong Results)public2004-08-04 10:282004-08-05 13:12
emgie 
 
normalminoralways
closedopen 
 
 
Fedora Core 1
5.0.0-dev
0000085: Segmentation fault
Every time I run php with XDebug extension, it finishes with segmentation fault, having executed every script or just version request (-v) correctly.
PHP 5.0.0
XDebug from CVS, 2004-08-04
Fedora Core 1, glibc-2.3.2-101
No tags attached.
Issue History
2004-08-04 10:28emgieNew Issue
2004-08-04 10:30emgieNote Added: 0000171
2004-08-04 10:50derickNote Added: 0000172
2004-08-04 10:50derickStatusnew => confirmed
2004-08-04 11:41emgieNote Added: 0000173
2004-08-05 13:12derickStatusconfirmed => closed
2004-08-05 13:12derickNote Added: 0000174
2016-07-31 13:36derickCategoryUsage problems => Usage problems (Crashes)
2016-07-31 13:38derickCategoryUsage problems (Crashes) => Usage problems (Wrong Results)

Notes
(0000171)
emgie   
2004-08-04 10:30   
Here is the gdb log:

[root@floyd bin]# gdb php
GNU gdb Red Hat Linux (5.3.90-0.20030710.41rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run -v
Starting program: /usr/local/bin/php -v
[Thread debugging using libthread_db enabled]
[New Thread -1084790912 (LWP 16385)]
PHP 5.0.0 (cli) (built: Jul 20 2004 11:59:59)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.0, Copyright (c) 1998-2004 Zend Technologies
    with Xdebug v2.0.0dev, Copyright (c) 2002, 2003, 2004, by Derick Rethans

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1084790912 (LWP 16385)]
0x007612f2 in _int_free () from /lib/tls/libc.so.6
(gdb) bt
#0 0x007612f2 in _int_free () from /lib/tls/libc.so.6
#1 0x0076028b in free () from /lib/tls/libc.so.6
0000002 0x001e2005 in zm_post_zend_deactivate_xdebug ()
    at /home/maciek/nowe/xdebug2/xdebug/xdebug.c:566
0000003 0x08206796 in exec_done_cb (module=0x94f98)
    at /home/maciek/nowe/php-5.0.0/Zend/zend.c:834
0000004 0x0820c365 in zend_hash_apply (ht=0x1f1fad,
    apply_func=0x8206780 <exec_done_cb>)
    at /home/maciek/nowe/php-5.0.0/Zend/zend_hash.c:664
0000005 0x082067bd in zend_post_deactivate_modules ()
    at /home/maciek/nowe/php-5.0.0/Zend/zend.c:842
0000006 0x081d46be in php_request_shutdown (dummy=0x0)
    at /home/maciek/nowe/php-5.0.0/main/main.c:1215
0000007 0x08232c93 in main (argc=2, argv=0xbfe8db84)
    at /home/maciek/nowe/php-5.0.0/sapi/cli/php_cli.c:1046
(gdb)
(0000172)
derick   
2004-08-04 10:50   
Valgrind output:

==27885== Invalid free() / delete / delete[]
==27885== at 0x3C01F918: free (vg_replace_malloc.c:127)
==27885== by 0x3C88B4CB: zm_post_zend_deactivate_xdebug (xdebug.c:566)
==27885== by 0x82D7033: exec_done_cb (zend.c:834)
==27885== by 0x82DF86D: zend_hash_apply (zend_hash.c:664)
==27885== Address 0x3C89E67E is not stack'd, malloc'd or free'd

(If you want a workaround, just comment out that line 566 and it should work).
(0000173)
emgie   
2004-08-04 11:41   
Actually, setting "xdebug.idekey" to anything makes a better solution.
(this option is not documented)

Seems that there should be more care taken of "ide_key" variable in the code.
(0000174)
derick   
2004-08-05 13:12   
This is fixed in CVS now, we had a problem where we used two different styles of memory allocation functions.
The idekey setting is now also documented.