[xdebug-dev] xdebug xdebug/xdebug_code_coverage.c - Fixed dead code analysis for THROW.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Thu, 19 Oct 2006 22:45:48 +0200

Date: Thu Oct 19 22:45:48 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[1.00]
- Fixed dead code analysis for THROW.

Modified files:
           xdebug/xdebug_code_coverage.c (version: 1.29)

[FILE: /xdebug/xdebug_code_coverage.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- xdebug/xdebug_code_coverage.c:1.28 Wed Oct 18 16:46:44 2006 GMT
+++ xdebug/xdebug_code_coverage.c Thu Oct 19 18:45:48 2006 GMT
@@ -162,7 +162,7 @@
         /* Loop over the opcodes until the end of the array, or until a jump point has been found */
         xdebug_set_add(set, position);
         /*(fprintf(stderr, "XDEBUG Adding %d\n", position);)*/
- while (position < opa->size) {
+ while (position < opa->size - 1) {
 
                 /* See if we have a jump instruction */
                 if (xdebug_find_jump(opa, position, &jump_pos1, &jump_pos2)) {
@@ -178,31 +178,34 @@
                         }
                         break;
                 }
- /* See if we have an exit instruction */
- if (opa->opcodes[position].opcode == ZEND_EXIT) {
- /* fprintf(stderr, "X* Return found\n"); */
- break;
- }
- /* See if we have a return instruction */
- if (opa->opcodes[position].opcode == ZEND_RETURN) {
- /*(fprintf(stderr, "XDEBUG Return found\n");)*/
- break;
- }
 #ifdef ZEND_ENGINE_2
                 /* See if we have a throw instruction */
                 if (opa->opcodes[position].opcode == ZEND_THROW) {
- /* fprintf(stderr, "X* Throw found\n"); */
+ /* fprintf(stderr, "Throw found at %d\n", position); */
                         /* Now we need to go forward to the first
                          * zend_fetch_class/zend_catch combo */
- while (position < opa->size) {
- position++;
+ while (position < opa->size - 1) {
                                 if (opa->opcodes[position].opcode == ZEND_CATCH) {
- position -= 2;
+ /* fprintf(stderr, "Found catch at %d\n", position); */
+ position--;
                                         break;
                                 }
+ position++;
+ /* fprintf(stderr, "Skipping %d\n", position); */
                         }
+ position--;
                 }
 #endif
+ /* See if we have an exit instruction */
+ if (opa->opcodes[position].opcode == ZEND_EXIT) {
+ /* fprintf(stderr, "X* Return found\n"); */
+ break;
+ }
+ /* See if we have a return instruction */
+ if (opa->opcodes[position].opcode == ZEND_RETURN) {
+ /*(fprintf(stderr, "XDEBUG Return found\n");)*/
+ break;
+ }
 
                 position++;
                 /*(fprintf(stderr, "XDEBUG Adding %d\n", position);)*/
Received on Thu Oct 19 2006 - 22:45:50 BST

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