From 508c379428f2d1bc14321fdada9170bb15b8776e Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sun, 20 Apr 2014 12:54:50 +0200 Subject: Added error on compile failure in exec cmd --- phpdbg_prompt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'phpdbg_prompt.c') diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index c3971ccef4..c6297c0207 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -375,7 +375,10 @@ PHPDBG_COMMAND(exec) /* {{{ */ php_hash_environment(TSRMLS_C); phpdbg_notice("Set execution context: %s", PHPDBG_G(exec)); - phpdbg_compile(TSRMLS_C); + + if (phpdbg_compile(TSRMLS_C) == FAILURE) { + phpdbg_error("Failed to compile %s", PHPDBG_G(exec)); + } } else { phpdbg_notice("Execution context not changed"); } -- cgit v1.2.1 From 5a7497904e4f0f3bd300e1353a26fab80c178321 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sun, 20 Apr 2014 13:25:28 +0200 Subject: Breakpoints now hit only once if line was not switched --- phpdbg_prompt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'phpdbg_prompt.c') diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index c6297c0207..dcbd2ba327 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -1325,10 +1325,10 @@ zend_vm_enter: { phpdbg_breakbase_t *brake; - if ((PHPDBG_G(flags) & PHPDBG_BP_MASK) && - (brake = phpdbg_find_breakpoint(execute_data TSRMLS_CC))) { - phpdbg_hit_breakpoint( - brake, 1 TSRMLS_CC); + if ((PHPDBG_G(flags) & PHPDBG_BP_MASK) + && (brake = phpdbg_find_breakpoint(execute_data TSRMLS_CC)) + && (brake->type != PHPDBG_BREAK_FILE || execute_data->opline->lineno != PHPDBG_G(last_line))) { + phpdbg_hit_breakpoint(brake, 1 TSRMLS_CC); DO_INTERACTIVE(); } } @@ -1345,6 +1345,8 @@ next: DO_INTERACTIVE(); } + PHPDBG_G(last_line) = execute_data->opline->lineno; + PHPDBG_G(vmret) = execute_data->opline->handler(execute_data TSRMLS_CC); if (PHPDBG_G(vmret) > 0) { -- cgit v1.2.1 From e097919f160391c23d93d3ad9a94a505d7c230d8 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sun, 20 Apr 2014 16:47:24 +0200 Subject: Stepping is now line by line with gdb style command --- phpdbg_prompt.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'phpdbg_prompt.c') diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index dcbd2ba327..6eb7481c5e 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -43,7 +43,7 @@ int yyparse(phpdbg_param_t *stack, yyscan_t scanner); /* {{{ command declarations */ const phpdbg_command_t phpdbg_prompt_commands[] = { PHPDBG_COMMAND_D(exec, "set execution context", 'e', NULL, "s"), - PHPDBG_COMMAND_D(step, "step through execution", 's', NULL, "b"), + PHPDBG_COMMAND_D(step, "step through execution", 's', NULL, 0), PHPDBG_COMMAND_D(next, "continue execution", 'n', NULL, 0), PHPDBG_COMMAND_D(run, "attempt execution", 'r', NULL, "|s"), PHPDBG_COMMAND_D(ev, "evaluate some code", 0, NULL, "i"), @@ -424,16 +424,9 @@ int phpdbg_compile(TSRMLS_D) /* {{{ */ PHPDBG_COMMAND(step) /* {{{ */ { - if (param->num) { - PHPDBG_G(flags) |= PHPDBG_IS_STEPPING; - } else { - PHPDBG_G(flags) &= ~PHPDBG_IS_STEPPING; - } + PHPDBG_G(flags) |= PHPDBG_IS_STEPPING; - phpdbg_notice("Stepping %s", - (PHPDBG_G(flags) & PHPDBG_IS_STEPPING) ? "on" : "off"); - - return SUCCESS; + return PHPDBG_NEXT; } /* }}} */ PHPDBG_COMMAND(next) /* {{{ */ @@ -1314,6 +1307,11 @@ zend_vm_enter: phpdbg_print_opline_ex( execute_data, &vars, 0 TSRMLS_CC); + if (PHPDBG_G(flags) & PHPDBG_IS_STEPPING && execute_data->opline->lineno != PHPDBG_G(last_line)) { + PHPDBG_G(flags) &= ~PHPDBG_IS_STEPPING; + DO_INTERACTIVE(); + } + /* check if some watchpoint was hit */ { if (phpdbg_print_changed_zvals(TSRMLS_C) == SUCCESS) { @@ -1333,10 +1331,6 @@ zend_vm_enter: } } - if (PHPDBG_G(flags) & PHPDBG_IS_STEPPING) { - DO_INTERACTIVE(); - } - next: if (PHPDBG_G(flags) & PHPDBG_IS_SIGNALED) { phpdbg_writeln(EMPTY); -- cgit v1.2.1