]> granicus.if.org Git - php/commitdiff
step through eval option
authorkrakjoe <joe.watkins@live.co.uk>
Wed, 20 Nov 2013 17:01:37 +0000 (17:01 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Wed, 20 Nov 2013 17:01:37 +0000 (17:01 +0000)
README.md
phpdbg.c
phpdbg.h
phpdbg_prompt.c

index c46d7b15d630d60557e9feffa3614e0905a0daac..c058ba070c4c876ea7158b2047fb67b782483813 100644 (file)
--- a/README.md
+++ b/README.md
@@ -62,6 +62,7 @@ The following switches change the default behaviour of phpdbg:
  - -O set oplog output file
  - -q do not print banner on startup
  - -r jump straight to run
+ - -E enable step through eval()
  
 *Note: passing -rr will cause phpdbg to quit after execution, rather than returning to the console*
 
index 9c3ca3892316f00301e6b8cc39372d34373ad787..ec106775292b701c77b843b2f257ef6ca4ae0797 100644 (file)
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -393,6 +393,7 @@ const opt_struct OPTIONS[] = { /* {{{ */
        {'I', 0, "ignore init"},
        {'O', 1, "opline log"},
        {'r', 0, "run"},
+       {'E', 0, "step-through-eval"},
        {'-', 0, NULL}
 }; /* }}} */
 
@@ -569,6 +570,10 @@ phpdbg_main:
                        case 's': /* set stepping on */
                                step = 1;
                        break;
+                       
+                       case 'E': /* stepping through eval on */
+                               flags |= PHPDBG_IS_STEPONEVAL;
+                       break;
 
                        case 'b': /* set colours off */
                                flags &= ~PHPDBG_IS_COLOURED;
index 889639a2ec849b7ff725ddbd87c857f84539d31e..2f99543c6f1cd49f9e9e9b415eb8f64af9c2879c 100644 (file)
--- a/phpdbg.h
+++ b/phpdbg.h
@@ -97,6 +97,7 @@
 #define PHPDBG_SEEK_MASK               (PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE)
 
 #define PHPDBG_IS_REGISTERED   (1<<16)
+#define PHPDBG_IS_STEPONEVAL   (1<<17)
 
 #ifndef _WIN32
 #   define PHPDBG_DEFAULT_FLAGS    (PHPDBG_IS_QUIET|PHPDBG_IS_COLOURED)
index baa303e717671c40a4f34dfdd3059e5da86bcef9..dc41e2498f06c37ba4baed6450062caf8a39de11 100644 (file)
@@ -489,7 +489,9 @@ PHPDBG_COMMAND(eval) /* {{{ */
        zval retval;
        char *code = NULL;
        
-       PHPDBG_G(flags) &= ~ PHPDBG_IS_STEPPING;
+       if (!(PHPDBG_G(flags) & PHPDBG_IS_STEPONEVAL)) {
+               PHPDBG_G(flags) &= ~ PHPDBG_IS_STEPPING;
+       }
 
        if (input && input->start) {
                code = (char*) input->start;
@@ -516,7 +518,8 @@ PHPDBG_COMMAND(eval) /* {{{ */
        PHPDBG_G(flags) &= ~PHPDBG_IN_EVAL;
 
     /* switch stepping back on */
-       if (stepping) {
+       if (stepping &&
+               !(PHPDBG_G(flags) & PHPDBG_IS_STEPONEVAL)) {
                PHPDBG_G(flags) |= PHPDBG_IS_STEPPING;
        }
 
@@ -869,6 +872,7 @@ PHPDBG_COMMAND(help) /* {{{ */
                        phpdbg_writeln(" -I\tN/A\t\t\tIgnore default .phpdbginit");
                        phpdbg_writeln(" -O\t-Omy.oplog\t\tSets oplog output file");
                        phpdbg_writeln(" -r\tN/A\t\t\tRun execution context");
+                       phpdbg_writeln(" -E\tN/A\t\t\tEnable step through eval, careful !");
                        phpdbg_notice(
                                "Note: passing -rr will cause phpdbg to quit after execution");
                        phpdbg_help_footer();
@@ -1184,13 +1188,15 @@ zend_vm_enter:
 #endif
 
 #define DO_INTERACTIVE() do {\
-       phpdbg_list_file(\
-               zend_get_executed_filename(TSRMLS_C), \
-               3, \
-               zend_get_executed_lineno(TSRMLS_C)-1, \
-               zend_get_executed_lineno(TSRMLS_C) \
-               TSRMLS_CC\
-       );\
+       if (!(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) {\
+               phpdbg_list_file(\
+                       zend_get_executed_filename(TSRMLS_C), \
+                       3, \
+                       zend_get_executed_lineno(TSRMLS_C)-1, \
+                       zend_get_executed_lineno(TSRMLS_C) \
+                       TSRMLS_CC\
+               );\
+       }\
        \
        do {\
                switch (phpdbg_interactive(TSRMLS_C)) {\