[xdebug-general] [patch attach] Bug 0000172: coverage produce wrong coverage

From: Xuefer <xuefer[@]gmail.com>
Date: Sat, 11 Mar 2006 10:04:36 +0800

the patch isn't fixing all problem in this bug report.
what this patch do:
move xdebug_prefil_code_coverage to compile from execute.
wrap all opcode for code coverage for ZE2, and #if the coverage code
out from statement_handler. either the statement ext opcodes is buggy
in zendengine2 or it's EXT_STMT, "extension statement handler, not
extension pre-every-opcode handler"

---------- Forwarded message ----------
From: xdebug-dev[@]lists.xdebug.org <xdebug-dev[@]lists.xdebug.org>
Date: Mar 10, 2006 8:05 PM
Subject: Bug 0000172: coverage produce wrong coverage
To: xdebug-dev[@]lists.xdebug.org

The following NEW bug has been ADDED.
======================================================================
http://bugs.xdebug.org/bug_view_advanced_page.php?bug_id=0000172
======================================================================
Reporter: Xuefer
Handler:
======================================================================
Project: Xdebug
Bug ID: 172
Category: Usage problems
Reproducibility: always
Severity: major
Priority: normal
Status: new
Operating System:
PHP Version: 4.3.11
Xdebug Version: 2.0.0beta4
======================================================================
Date Submitted: 2006-03-10 13:05 CET
Last Modified: 2006-03-10 13:05 CET
======================================================================
Summary: coverage produce wrong coverage
Description:
1. not all opcode is catched by coverage at runtime
a.php
<?php

xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
include("b.php");
?>

b.php
<?php

$a = "";
$a =
""
. "abc{$a}abc"
. "abc"
;
$cov = xdebug_get_code_coverage();
print_r($cov);

?>
result:
Array
(
   [/home/xuefer/htdocs/skydotnet_php5/matrix/debug/test/a.php] => Array
       (
           [4] => 1
       )

   [/home/xuefer/htdocs/skydotnet_php5/matrix/debug/test/abc.php] =>
Array
       (
           [3] => 1
           [6] => 1
           [7] => -1
           [8] => -1
           [9] => 1
           [10] => -1
           [13] => -1
       )

)

at least
           [7] => -1
           [8] => -1
should be both 1

2. i'd suggest -1 to be 0
3. very slow with XDEBUG_CC_UNUSED, xdebug_prefil_code_coverage() is
executed no matter if the op_array is done before.
suggested fix:
a. move it to xdebug_compile_file()
b. add a hash (by pointer) that avoid re-fill the same op_array, but the
file included before xdebug_start_code_coverage is will not be prefilled
c. when xdebug_get_code_coverage(XDEBUG_CC_UNUSED), loop though all the
op_array(file/function/class method) for xdebug_prefil_code_coverage(), it
could be a bit hard to get the file op_array
======================================================================

Bug History
Date Modified Username Field Change
======================================================================
2006-03-10 13:05Xuefer New Bug
2006-03-10 13:05Xuefer Bug Monitored: Xuefer
======================================================================

Received on Sat Mar 11 2006 - 03:07:33 GMT

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST