remove goto from zend_try/zend_end_try/zend_catch blocks

This commit is contained in:
krakjoe 2014-01-17 21:08:35 +00:00
parent 837bd24dea
commit 54fa2883f0
2 changed files with 19 additions and 21 deletions

View file

@ -1202,17 +1202,17 @@ phpdbg_main:
} zend_end_try(); } zend_end_try();
/* initialize from file */ /* initialize from file */
PHPDBG_G(flags) |= PHPDBG_IS_INITIALIZING;
zend_try { zend_try {
PHPDBG_G(flags) |= PHPDBG_IS_INITIALIZING;
phpdbg_init(init_file, init_file_len, init_file_default TSRMLS_CC); phpdbg_init(init_file, init_file_len, init_file_default TSRMLS_CC);
phpdbg_try_file_init(bp_tmp_file, strlen(bp_tmp_file), 0 TSRMLS_CC); phpdbg_try_file_init(bp_tmp_file, strlen(bp_tmp_file), 0 TSRMLS_CC);
PHPDBG_G(flags) &= ~PHPDBG_IS_INITIALIZING;
} zend_catch {
PHPDBG_G(flags) &= ~PHPDBG_IS_INITIALIZING;
if (PHPDBG_G(flags) & PHPDBG_IS_QUITTING) {
goto phpdbg_out;
}
} zend_end_try(); } zend_end_try();
PHPDBG_G(flags) &= ~PHPDBG_IS_INITIALIZING;
/* quit if init says so */
if (PHPDBG_G(flags) & PHPDBG_IS_QUITTING) {
goto phpdbg_out;
}
/* step from here, not through init */ /* step from here, not through init */
if (step) { if (step) {
@ -1239,7 +1239,6 @@ phpdbg_interact:
phpdbg_export_breakpoints(bp_tmp_fp TSRMLS_CC); phpdbg_export_breakpoints(bp_tmp_fp TSRMLS_CC);
fclose(bp_tmp_fp); fclose(bp_tmp_fp);
cleaning = 1; cleaning = 1;
goto phpdbg_out;
} else { } else {
cleaning = 0; cleaning = 0;
} }
@ -1265,11 +1264,8 @@ phpdbg_interact:
} }
} }
#endif #endif
if (PHPDBG_G(flags) & PHPDBG_IS_QUITTING) {
goto phpdbg_out;
}
} zend_end_try(); } zend_end_try();
} while(!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)); } while(!cleaning && !(PHPDBG_G(flags) & PHPDBG_IS_QUITTING));
/* this must be forced */ /* this must be forced */
CG(unclean_shutdown) = 0; CG(unclean_shutdown) = 0;

View file

@ -551,7 +551,8 @@ PHPDBG_COMMAND(run) /* {{{ */
zend_op **orig_opline = EG(opline_ptr); zend_op **orig_opline = EG(opline_ptr);
zend_op_array *orig_op_array = EG(active_op_array); zend_op_array *orig_op_array = EG(active_op_array);
zval **orig_retval_ptr = EG(return_value_ptr_ptr); zval **orig_retval_ptr = EG(return_value_ptr_ptr);
zend_bool restore = 1;
if (!PHPDBG_G(ops)) { if (!PHPDBG_G(ops)) {
if (phpdbg_compile(TSRMLS_C) == FAILURE) { if (phpdbg_compile(TSRMLS_C) == FAILURE) {
phpdbg_error("Failed to compile %s, cannot run", PHPDBG_G(exec)); phpdbg_error("Failed to compile %s, cannot run", PHPDBG_G(exec));
@ -586,18 +587,19 @@ PHPDBG_COMMAND(run) /* {{{ */
if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) { if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
phpdbg_error("Caught exit/error from VM"); phpdbg_error("Caught exit/error from VM");
goto out; restore = 0;
} }
} zend_end_try(); } zend_end_try();
if (EG(exception)) { if (restore) {
phpdbg_handle_exception(TSRMLS_C); if (EG(exception)) {
phpdbg_handle_exception(TSRMLS_C);
}
EG(active_op_array) = orig_op_array;
EG(opline_ptr) = orig_opline;
EG(return_value_ptr_ptr) = orig_retval_ptr;
} }
EG(active_op_array) = orig_op_array;
EG(opline_ptr) = orig_opline;
EG(return_value_ptr_ptr) = orig_retval_ptr;
} else { } else {
phpdbg_error("Nothing to execute!"); phpdbg_error("Nothing to execute!");
} }