]> granicus.if.org Git - php/commitdiff
step by line and opcode modes preserved, set stepping added, help updated
authorkrakjoe <joe.watkins@live.co.uk>
Sun, 20 Apr 2014 17:46:35 +0000 (18:46 +0100)
committerkrakjoe <joe.watkins@live.co.uk>
Sun, 20 Apr 2014 17:46:35 +0000 (18:46 +0100)
phpdbg.h
phpdbg_help.c
phpdbg_prompt.c
phpdbg_set.c
phpdbg_set.h

index 43f26ca3236f66aa89aaf88a6fc1800d793629df..c24c5ea1fe8cc27a77514ccbd678a15cf9b3d13e 100644 (file)
--- a/phpdbg.h
+++ b/phpdbg.h
 #define PHPDBG_IS_DISCONNECTED        (1<<27)
 
 #define PHPDBG_SHOW_REFCOUNTS         (1<<28)
+#define PHPDBG_STEP_OPCODE                       (1<<29)
 
 #define PHPDBG_SEEK_MASK              (PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE)
 #define PHPDBG_BP_RESOLVE_MASK           (PHPDBG_HAS_FUNCTION_OPLINE_BP|PHPDBG_HAS_METHOD_OPLINE_BP|PHPDBG_HAS_FILE_OPLINE_BP)
@@ -200,6 +201,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
 
        phpdbg_command_t *lcmd;                      /* last command */
        phpdbg_param_t    lparam;                    /* last param */
+       zend_ulong        lline;                     /* last line */
 
        zend_ulong flags;                            /* phpdbg flags */
 ZEND_END_MODULE_GLOBALS(phpdbg) /* }}} */
index 4866f1e67e2f350675f0df7cb4789fa17527b249..2a6f9e82b652c386230b919780bac4a776570c0e 100644 (file)
@@ -800,12 +800,13 @@ phpdbg_help_text_t phpdbg_help_text[] = {
 "   **Type**    **Alias**    **Purpose**" CR
 "   **prompt**     **p**     set the prompt" CR
 "   **color**      **c**     set color  <element> <color>" CR
-"   **colors**     **C**     set colors <on|off>" CR
-"   **oplog**      **O**     set oplog output" CR
+"   **colors**     **C**     set colors [<on|off>]" CR
+"   **oplog**      **O**     set oplog [output]" CR
 "   **break**      **b**     set break **id** <on|off>" CR
-"   **breaks**     **B**     set breaks <on|off>" CR
-"   **quiet**      **q**     set quiet <on|off>" CR
-"   **refcount**   **r**     set refcount <on|off> (refcount display upon hit watchpoint)" CR CR
+"   **breaks**     **B**     set breaks [<on|off>]" CR
+"   **quiet**      **q**     set quiet [<on|off>]" CR
+"   **stepping**   **s**     set stepping [<opcode|line>]" CR
+"   **refcount**   **r**     set refcount [<on|off>] " CR CR
 
 "Valid colors are **none**, **white**, **red**, **green**, **yellow**, **blue**, **purple**, "
 "**cyan** and **black**.  All colours except **none** can be followed by an optional "
@@ -824,6 +825,9 @@ phpdbg_help_text_t phpdbg_help_text[] = {
 "     $P S c error red-bold" CR
 "     Use red bold for errors" CR CR
 
+"     $P S refcount on" CR
+"     Enable refcount display when hitting watchpoints" CR CR
+
 "     $P S b 4 off" CR
 "     Temporarily disable breakpoint 4.  This can be subsequently reenabled by a **s b 4 on**." CR
 //*********** check oplog syntax
index 1b1cb25215bbb122912a26dc1556ddbccdc0c16d..b8df289687b902d51234d48c8685154d72cc6a32 100644 (file)
@@ -1230,6 +1230,7 @@ zend_vm_enter:
 #endif
 
 #define DO_INTERACTIVE() do { \
+       PHPDBG_G(lline) = zend_get_executed_lineno(TSRMLS_C);\
        if (!(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) { \
                phpdbg_list_file( \
                        zend_get_executed_filename(TSRMLS_C), \
@@ -1331,7 +1332,10 @@ zend_vm_enter:
                }
 
                if (PHPDBG_G(flags) & PHPDBG_IS_STEPPING) {
-                       DO_INTERACTIVE();
+                       if ((PHPDBG_G(flags) & PHPDBG_STEP_OPCODE) || 
+                               (execute_data->opline->lineno != PHPDBG_G(lline))) {
+                               DO_INTERACTIVE();       
+                       }
                }
 
 next:
index aeb882657ebf39b5dfb460b4dee57084f8176581..54269a81931d63e421cdc06ebf5a9c5a21e30552 100644 (file)
@@ -40,6 +40,7 @@ const phpdbg_command_t phpdbg_set_commands[] = {
        PHPDBG_SET_COMMAND_D(break,        "usage: set break id [<on|off>]",          'b', set_break,        NULL, "l|b"),
        PHPDBG_SET_COMMAND_D(breaks,       "usage: set breaks [<on|off>]",            'B', set_breaks,       NULL, "|b"),
        PHPDBG_SET_COMMAND_D(quiet,        "usage: set quiet [<on|off>]",             'q', set_quiet,        NULL, "|b"),
+       PHPDBG_SET_COMMAND_D(stepping,     "usage: set stepping [<line|op>]",         's', set_stepping,     NULL, "|s"),
        PHPDBG_SET_COMMAND_D(refcount,     "usage: set refcount [<on|off>]",          'r', set_refcount,     NULL, "|b"),
        PHPDBG_END_COMMAND
 };
@@ -196,7 +197,8 @@ PHPDBG_SET(oplog) /* {{{ */
 PHPDBG_SET(quiet) /* {{{ */
 {
        if (!param || param->type == EMPTY_PARAM) {
-               phpdbg_writeln("Quietness %s", PHPDBG_G(flags) & PHPDBG_IS_QUIET ? "on" : "off");
+               phpdbg_writeln("Quietness %s", 
+                       PHPDBG_G(flags) & PHPDBG_IS_QUIET ? "on" : "off");
        } else switch (param->type) {
                case NUMERIC_PARAM: {
                        if (param->num) {
@@ -212,10 +214,34 @@ PHPDBG_SET(quiet) /* {{{ */
        return SUCCESS;
 } /* }}} */
 
+PHPDBG_SET(stepping) /* {{{ */
+{
+       if (!param || param->type == EMPTY_PARAM) {
+               phpdbg_writeln("Stepping %s",
+                       PHPDBG_G(flags) & PHPDBG_STEP_OPCODE ? "opcode" : "line");
+       } else switch (param->type) {
+               case STR_PARAM: {       
+                       if ((param->len == sizeof("opcode")-1) &&
+                               (memcmp(param->str, "opcode", sizeof("opcode")) == SUCCESS)) {
+                               PHPDBG_G(flags) |= PHPDBG_STEP_OPCODE;
+                       } else if ((param->len == sizeof("line")-1) &&
+                               (memcmp(param->str, "line", sizeof("line")) == SUCCESS)) {
+                               PHPDBG_G(flags) &= ~PHPDBG_STEP_OPCODE;
+                       } else {
+                               phpdbg_error("usage set stepping [<opcode|line>]");
+                       }
+               } break;
+
+               phpdbg_default_switch_case();
+       }
+
+       return SUCCESS;
+} /* }}} */
+
 PHPDBG_SET(refcount) /* {{{ */
 {
        if (!param || param->type == EMPTY_PARAM) {
-               phpdbg_writeln("Showing refcounts on watchpoints %s", PHPDBG_G(flags) & PHPDBG_IS_QUIET ? "on" : "off");
+               phpdbg_writeln("Refcount %s", PHPDBG_G(flags) & PHPDBG_IS_QUIET ? "on" : "off");
        } else switch (param->type) {
                case NUMERIC_PARAM: {
                        if (param->num) {
index 67bf4cd7defbe271931ad67c05335bde00b6e5dd..dea61ed3825b5fed020f072495315517b9673c67 100644 (file)
@@ -34,6 +34,7 @@ PHPDBG_SET(oplog);
 PHPDBG_SET(break);
 PHPDBG_SET(breaks);
 PHPDBG_SET(quiet);
+PHPDBG_SET(stepping);
 PHPDBG_SET(refcount);
 
 extern const phpdbg_command_t phpdbg_set_commands[];