[xdebug-dev] xdebug xdebug/xdebug_code_coverage.c xdebug/tests/bug00334.phpt - MFH: Fixed code coverage dead-code detection.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Wed, 13 Feb 2008 14:59:48 +0100

Date: Wed Feb 13 14:59:48 CET 2008
User: Derick Rethans
Directory: xdebug

Log Message:
[0.05]
- MFH: Fixed code coverage dead-code detection.

Modified files:
           xdebug/xdebug_code_coverage.c (version: 1.32.2.8)
           xdebug/tests/bug00334.phpt (version: 1.1.2.3)

[FILE: /xdebug/xdebug_code_coverage.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.32.2.7
retrieving revision 1.32.2.8
diff -u -r1.32.2.7 -r1.32.2.8
--- xdebug/xdebug_code_coverage.c:1.32.2.7 Wed Feb 13 12:38:21 2008 GMT
+++ xdebug/xdebug_code_coverage.c Wed Feb 13 12:59:48 2008 GMT
@@ -112,14 +112,14 @@
         return jmp_to;
 }
 
-static int xdebug_find_jump(zend_op_array *opa, unsigned int position, int *jmp1, int *jmp2)
+static int xdebug_find_jump(zend_op_array *opa, unsigned int position, long *jmp1, long *jmp2)
 {
         zend_op *base_address = &(opa->opcodes[0]);
 
         zend_op opcode = opa->opcodes[position];
         if (opcode.opcode == ZEND_JMP) {
 #ifdef ZEND_ENGINE_2
- *jmp1 = (opcode.op1.u.jmp_addr - base_address) / sizeof(zend_op);
+ *jmp1 = ((long) opcode.op1.u.jmp_addr - (long) base_address) / sizeof(zend_op);
 #else
                 *jmp1 = opcode.op1.u.opline_num;
 #endif
@@ -132,7 +132,7 @@
         ) {
                 *jmp1 = position + 1;
 #ifdef ZEND_ENGINE_2
- *jmp2 = (opcode.op2.u.jmp_addr - base_address) / sizeof(zend_op);
+ *jmp2 = ((long) opcode.op2.u.jmp_addr - (long) base_address) / sizeof(zend_op);
 #else
                 *jmp2 = opcode.op1.u.opline_num;
 #endif
@@ -159,8 +159,8 @@
 
 static void xdebug_analyse_branch(zend_op_array *opa, unsigned int position, xdebug_set *set)
 {
- int jump_pos1 = -1;
- int jump_pos2 = -1;
+ long jump_pos1 = -1;
+ long jump_pos2 = -1;
 
         /*(fprintf(stderr, "Branch analysis from position: %d\n", position);)*/
         /* First we see if the branch has been visited, if so we bail out. */

[FILE: /xdebug/tests/bug00334.phpt]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- xdebug/tests/bug00334.phpt:1.1.2.2 Mon Nov 12 21:27:50 2007 GMT
+++ xdebug/tests/bug00334.phpt Wed Feb 13 12:59:48 2008 GMT
@@ -31,7 +31,7 @@
     [5]=>
     int(1)
     [7]=>
- int(-2)
+ int(-1)
     [9]=>
     int(1)
   }
Received on Wed Feb 13 2008 - 14:59:52 GMT

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