[xdebug-dev] Bug 0000237: xdebug_get_code_coverage() getting incorrect results

From: <noreply[@]lists.xdebug.org>
Date: Tue, 23 Jan 2007 10:58:06 +0100

The following bug has been RESOLVED.
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000237
======================================================================
Reporter: proofek
Handler: derick
======================================================================
Project: Xdebug
Bug ID: 237
Category: Usage problems
Reproducibility: always
Severity: tweak
Priority: normal
Status: resolved
Operating System: Linux, Debian Dapper
PHP Version: 5.1.6
Xdebug Version: 2.0.0rc1
Resolution: not fixable
======================================================================
Date Submitted: 2007-01-22 17:26 CET
Last Modified: 2007-01-23 10:58 CET
======================================================================
Summary: xdebug_get_code_coverage() getting incorrect results
Description:
It looks like that data gathered with xdebug_get_code_coverage() function
are not quite correct.

When executing the code above it is saying that only 3 last lines has been
executed, while it is obvious (I think) that assigning to a variable should
be executed as well.

$strQuery = 'SELECT
                    field1,
                    field2,
                    field3,
                    field4,
                    field5,
                    field6,
                    field7,
                    field8,
                    field9,
                    field10,
                    field11
        FROM
                    table
        WHERE
            field1 = "'.$strTransactionCode.'"
            AND field2 = "'.$strReference.'"
            AND field3 = '.$intVersion;

======================================================================

----------------------------------------------------------------------
 derick - 2007-01-22 20:06 CET
----------------------------------------------------------------------
I checked this with VLD, and it seems the Zend Engine sees the assignment
happening on the last line of the whole statement. As the engine doesn't
expose the correct data, Xdebug can not return the correct information.
However, it is possible to ask Xdebug to also tell which lines are
executable. You need to do this then:
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);

----------------------------------------------------------------------
 proofek - 2007-01-23 10:42 CET
----------------------------------------------------------------------
I hasn't helped. It it still reporting no execution at this point.
Additionally for some of my files (where there is lots of includes) id
dies trying to include one of the files and ends with segmentation fault.
It's not happening when I remove XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE.

----------------------------------------------------------------------
 derick - 2007-01-23 10:58 CET
----------------------------------------------------------------------
Of course it doesn't show it - as there is nothing to show for that point.
All those parameters to is tell you which lines *can* be executed
according to the engine. For the segmentation fault, upgrade to the CVS
version - that should be fixed.

Bug History
Date Modified Username Field Change
======================================================================
2007-01-22 17:26proofek New Bug
2007-01-22 17:26proofek Bug Monitored: proofek
2007-01-22 20:06derick Bugnote Added: 0000556
2007-01-22 20:06derick Assigned To => derick
2007-01-22 20:06derick Resolution open => not fixable
2007-01-22 20:06derick Status new => resolved
2007-01-23 10:42proofek Bugnote Added: 0000557
2007-01-23 10:42proofek Resolution not fixable => reopened
2007-01-23 10:42proofek Status resolved => feedback
2007-01-23 10:58derick Bugnote Added: 0000558
2007-01-23 10:58derick Resolution reopened => not fixable
2007-01-23 10:58derick Status feedback => resolved
======================================================================
Received on Tue Jan 23 2007 - 10:58:24 GMT

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST