From: krakjoe Date: Sun, 10 Nov 2013 16:30:36 +0000 (+0000) Subject: fix interference while quitting X-Git-Tag: php-5.6.0alpha1~110^2~529 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5cca4190f42e5ba41927e66645ff6902188dc2d7;p=php fix interference while quitting --- diff --git a/phpdbg.c b/phpdbg.c index a0419f313e..fc780bfed9 100644 --- a/phpdbg.c +++ b/phpdbg.c @@ -29,6 +29,7 @@ static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */ pg->ops = NULL; pg->stepping = 0; pg->vmret = 0; + pg->quitting = 0; } /* }}} */ static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */ diff --git a/phpdbg.h b/phpdbg.h index f34fa4c84e..5721ff5fd5 100644 --- a/phpdbg.h +++ b/phpdbg.h @@ -46,9 +46,10 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg) size_t exec_len; /* size of exec */ zend_op_array *ops; /* op_array */ zval *retval; /* return value */ - zend_bool stepping; /* stepping */ + int stepping; /* stepping */ int vmret; /* return from last opcode handler execution */ zend_bool has_file_bp; /* file-based breakpoint has been set */ + zend_bool quitting; /* quitting flag */ ZEND_END_MODULE_GLOBALS(phpdbg) #include "phpdbg_prompt.h" diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 4a145ac78a..e5c3142eda 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -120,8 +120,10 @@ static PHPDBG_COMMAND(run) { /* {{{ */ zend_try { zend_execute(EG(active_op_array) TSRMLS_CC); } zend_catch { - printf("Caught excetion in VM\n"); - return FAILURE; + if (!PHPDBG_G(quitting)) { + printf("Caught excetion in VM\n"); + return FAILURE; + } else return SUCCESS; } zend_end_try(); return SUCCESS; @@ -245,6 +247,8 @@ static PHPDBG_COMMAND(break) /* {{{ */ static PHPDBG_COMMAND(quit) /* {{{ */ { + PHPDBG_G(quitting)=1; + zend_bailout(); return SUCCESS; @@ -344,7 +348,8 @@ int phpdbg_interactive(int argc, char **argv TSRMLS_DC) /* {{{ */ printf("phpdbg> "); - while (fgets(cmd, PHPDBG_MAX_CMD, stdin) != NULL) { + while (!PHPDBG_G(quitting) && + fgets(cmd, PHPDBG_MAX_CMD, stdin) != NULL) { size_t cmd_len = strlen(cmd) - 1; while (cmd[cmd_len] == '\n') {