step by line and opcode modes preserved, set stepping added, help updated

This commit is contained in:
krakjoe 2014-04-20 18:46:35 +01:00
parent 373b9ecd05
commit f96feea00c
5 changed files with 45 additions and 8 deletions

View File

@ -140,6 +140,7 @@
#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) /* }}} */

View 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

View 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:

View 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) {

View 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[];