]> granicus.if.org Git - php/commitdiff
fix interference while quitting
authorkrakjoe <joe.watkins@live.co.uk>
Sun, 10 Nov 2013 16:30:36 +0000 (16:30 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Sun, 10 Nov 2013 16:30:36 +0000 (16:30 +0000)
phpdbg.c
phpdbg.h
phpdbg_prompt.c

index a0419f313eabcb3f837973ada9f8aa98dc942ac3..fc780bfed924b0589cac68046521ee0754944f6a 100644 (file)
--- 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) /* {{{ */
index f34fa4c84e008ca2ae53e58a9d73d53b1db2000f..5721ff5fd52b4271fcf0a1c706c37b03b1a44f4b 100644 (file)
--- 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"
index 4a145ac78a2a38ec10db32dc08d52be3f4cc9223..e5c3142eda8809103ad853cea8c6a45fb7dd7fed 100644 (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') {