[xdebug-general] new patch for [0000172]

From: Xuefer <xuefer[@]gmail.com>
Date: Sun, 12 Mar 2006 15:23:19 +0800

http://bugs.xdebug.org/bug_view_advanced_page.php?bug_id=0000172
after days working with coverage->html tool, i found it's wrong to
make a "opcode coverage". the right one, instead, is "statement
coverage" (EXT_STMT) + some other coverage if needed (fcall_begin,
fcall_end). do not prefill all the opcodes.

the problem with current opcode coverage
function a()
{
1 if (1) {
1 } <- there is a ZEND_JMP here
1 $dummy = 1;
}

function a()
{
1 if (0) {
0 } <- there is a ZEND_JMP here
1 $dummy = 1;
}
looks like no problem but what if we pot a "return" statement there?
let's see the next 2 examples
function a()
{
1 if (1) {
1 return
0 } <- there is a ZEND_JMP here, NOT executed
0 $dummy = 1;
}

function a()
{
1 if (0) {
0 return
0 } <- there is a ZEND_JMP here, NOT executed again, it's impossible
to execute this opcode, and it's not a statement we care
1 $dummy = 1;
}

one of the example after the patch:
      <?php

 1 function a()
      {
 1 $dummy = 1;
              $dummy
              =
              1
 1 ;
              $dummy = "abc"
                      . "def"
 1 . "ghi" // <- this cov should be a ZE buggy, but still human readable
                      . $dummy
                      ;

              $dummy =
                      true
 1 ?
                      $dummy
                      :
                      $dummy
                      ;

              $dummy =
                      false
 1 ?
                      $dummy
                      :
                      $dummy
                      ;

              $dummy =
                      true
 1 ?
 1 max(
                      1,1
 1 )
                      :
 0 min(
                      1,1
 0 )
                      ;

 1 if (0) {
              }

 1 if (0) {
 0 $dummy = 1;
              }
 1 }

 1 a(
      "abc"
      , "def"
      , "def" . "def"
      , "ghi"
 1 );

      ?>

it's really acceptable

Received on Sun Mar 12 2006 - 08:26:13 GMT

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