1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 16:38:25 +02:00

fix interference while quitting

This commit is contained in:
krakjoe
2013-11-10 16:30:36 +00:00
parent 5971ab299b
commit 5cca4190f4
3 changed files with 11 additions and 4 deletions
+1
View File
@@ -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) /* {{{ */
+2 -1
View File
@@ -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"
+8 -3
View File
@@ -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') {