com php-src: fix interference while quitting: phpdbg.c phpdbg.h phpdbg_prompt.c
| From: | Bob Weinand | Date: | Sun, 10 Nov 2013 16:30:36 +0000 |
| Subject: | com php-src: fix interference while quitting: phpdbg.c phpdbg.h phpdbg_prompt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75202@lists.php.net to get a copy of this message | ||
Commit: 5cca4190f42e5ba41927e66645ff6902188dc2d7
Author: krakjoe <joe.watkins@live.co.uk> Sun, 10 Nov 2013 16:30:36 +0000
Parents: 5971ab299be15c57367d3ab642969a07e609483d
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5cca4190f42e5ba41927e66645ff6902188dc2d7
Log:
fix interference while quitting
Changed paths:
M phpdbg.c
M phpdbg.h
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index a0419f3..fc780bf 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 f34fa4c..5721ff5 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 4a145ac..e5c3142 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') {