View Issue Details

IDProjectCategoryView StatusLast Update
0000402XdebugCode Coveragepublic2020-03-12 17:13
Reportersebastian Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Summary0000402: Segfault with Code Coverage and exceptions
Description

<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);

function something_that_might_throw() {}

try {
something_that_might_throw();
return;
}

catch (Exception $e) {}

$codeCoverage = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
print_r($codeCoverage);

Additional Information

sb@ubuntu ~ % gdb /usr/local/php-5.3/bin/php
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) r test.php
Starting program: /usr/local/php-5.3/bin/php test.php
[Thread debugging using libthread_db enabled]
[New Thread 0xb77226b0 (LWP 31979)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb77226b0 (LWP 31979)]
0x00000001 in ?? ()
(gdb) bt
#0 0x00000001 in ?? ()
#1 0xb764d4f5 in xdebug_prefill_code_coverage () from /usr/local/php-5.3/lib/php/extensions/debug-zts-20071006/xdebug.so
0000002 0xb76464cb in xdebug_execute () from /usr/local/php-5.3/lib/php/extensions/debug-zts-20071006/xdebug.so
0000003 0x08563bd9 in zend_do_fcall_common_helper_SPEC (execute_data=0x8c16a9c, tsrm_ls=0x8a53070)
at /usr/local/src/php/php-5.3/Zend/zend_vm_execute.h:341
0000004 0x08569557 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0x8c16a9c, tsrm_ls=0x8a53070)
at /usr/local/src/php/php-5.3/Zend/zend_vm_execute.h:1569
0000005 0x085628ec in execute (op_array=0x8be759c, tsrm_ls=0x8a53070) at /usr/local/src/php/php-5.3/Zend/zend_vm_execute.h:104
0000006 0xb7646634 in xdebug_execute () from /usr/local/php-5.3/lib/php/extensions/debug-zts-20071006/xdebug.so
0000007 0x085347e4 in zend_execute_scripts (type=8, tsrm_ls=0x8a53070, retval=0x0, file_count=3)
at /usr/local/src/php/php-5.3/Zend/zend.c:1199
0000008 0x084ad611 in php_execute_script (primary_file=0xbfe51670, tsrm_ls=0x8a53070)
at /usr/local/src/php/php-5.3/main/main.c:2073
0000009 0x085d1a88 in main (argc=2, argv=0xbfe517e4) at /usr/local/src/php/php-5.3/sapi/cli/php_cli.c:1132

sb@ubuntu ~ % valgrind /usr/local/php-5.3/bin/php test.php
==32001== Memcheck, a memory error detector.
==32001== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==32001== Using LibVEX rev 1804, a library for dynamic binary translation.
==32001== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==32001== Using valgrind-3.3.0-Debian, a dynamic binary instrumentation framework.
==32001== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==32001== For more details, rerun with: -v
==32001==
==32001== Invalid read of size 4
==32001== at 0x40151F3: (within /lib/ld-2.7.so)
==32001== by 0x4005C69: (within /lib/ld-2.7.so)
==32001== by 0x4007A97: (within /lib/ld-2.7.so)
==32001== by 0x4011543: (within /lib/ld-2.7.so)
==32001== by 0x400D5D5: (within /lib/ld-2.7.so)
==32001== by 0x4010F5D: (within /lib/ld-2.7.so)
==32001== by 0x42FFC18: (within /lib/tls/i686/cmov/libdl-2.7.so)
==32001== by 0x400D5D5: (within /lib/ld-2.7.so)
==32001== by 0x43002BB: (within /lib/tls/i686/cmov/libdl-2.7.so)
==32001== by 0x42FFB50: dlopen (in /lib/tls/i686/cmov/libdl-2.7.so)
==32001== by 0x85412AF: zend_load_extension (zend_extensions.c:34)
==32001== by 0x84B56E6: php_load_zend_extension_cb (php_ini.c:333)
==32001== Address 0x48cdf50 is 64 bytes inside a block of size 67 alloc'd
==32001== at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==32001== by 0x4006FD4: (within /lib/ld-2.7.so)
==32001== by 0x40079D9: (within /lib/ld-2.7.so)
==32001== by 0x4011543: (within /lib/ld-2.7.so)
==32001== by 0x400D5D5: (within /lib/ld-2.7.so)
==32001== by 0x4010F5D: (within /lib/ld-2.7.so)
==32001== by 0x42FFC18: (within /lib/tls/i686/cmov/libdl-2.7.so)
==32001== by 0x400D5D5: (within /lib/ld-2.7.so)
==32001== by 0x43002BB: (within /lib/tls/i686/cmov/libdl-2.7.so)
==32001== by 0x42FFB50: dlopen (in /lib/tls/i686/cmov/libdl-2.7.so)
==32001== by 0x85412AF: zend_load_extension (zend_extensions.c:34)
==32001== by 0x84B56E6: php_load_zend_extension_cb (php_ini.c:333)
==32001==
==32001== Process terminating with default action of signal 11 (SIGSEGV)
==32001== Access not within mapped region at address 0x0
==32001== at 0x1: ???
==32001== by 0x4C484F4: xdebug_prefill_code_coverage (in /usr/local/php-5.3/lib/php/extensions/debug-zts-20071006/xdebug.so)
==32001== by 0x4C414CA: xdebug_execute (in /usr/local/php-5.3/lib/php/extensions/debug-zts-20071006/xdebug.so)
==32001== by 0x8563BD8: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:341)
==32001== by 0x8569556: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1569)
==32001== by 0x85628EB: execute (zend_vm_execute.h:104)
==32001== by 0x4C41633: xdebug_execute (in /usr/local/php-5.3/lib/php/extensions/debug-zts-20071006/xdebug.so)
==32001== by 0x85347E3: zend_execute_scripts (zend.c:1199)
==32001== by 0x84AD610: php_execute_script (main.c:2073)
==32001== by 0x85D1A87: main (php_cli.c:1132)
==32001==
==32001== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 67 from 1)
==32001== malloc/free: in use at exit: 2,121,301 bytes in 21,808 blocks.
==32001== malloc/free: 22,802 allocs, 994 frees, 2,464,371 bytes allocated.
==32001== For counts of detected errors, rerun with: -v
==32001== searching for pointers to 21,808 not-freed blocks.
==32001== checked 1,773,608 bytes.
==32001==
==32001== LEAK SUMMARY:
==32001== definitely lost: 0 bytes in 0 blocks.
==32001== possibly lost: 0 bytes in 0 blocks.
==32001== still reachable: 2,121,301 bytes in 21,808 blocks.
==32001== suppressed: 0 bytes in 0 blocks.
==32001== Rerun with --leak-check=full to see details of leaked memory.
zsh: segmentation fault valgrind /usr/local/php-5.3/bin/php test.php

TagsNo tags attached.
Operating System
PHP Version5.2-dev

Activities

XulChris

2008-10-09 19:14

reporter   ~0000883

Hi, can you try this patch:
https://rpm.silfreed.net:8002/file/fde6c1fac8b5/php-pecl-xdebug/segfault-codecoverage-xdebug-2.0.3.patch

derick

2009-03-28 20:32

administrator   ~0000942

I can't reproduce this with Xdebug 2.0.5-dev. Could you try again?

derick

2009-10-17 18:07

administrator   ~0001106

No feedback, and likely fixed -> closing issue.

Issue History

Date Modified Username Field Change
2008-08-22 09:07 sebastian New Issue
2008-10-09 19:14 XulChris Note Added: 0000883
2009-03-28 20:32 derick Note Added: 0000942
2009-03-28 20:32 derick Status new => feedback
2009-10-17 18:07 derick Note Added: 0001106
2009-10-17 18:07 derick Status feedback => closed
2009-10-17 18:07 derick Resolution open => fixed
2020-03-12 16:55 derick Severity crash => feature
2020-03-12 17:13 derick Category Feature/Change request => Code Coverage