Merge branch 'master' of github.com:krakjoe/phpdbg

This commit is contained in:
Felipe Pena 2013-11-10 13:47:37 -02:00
commit 53f4201566
3 changed files with 46 additions and 12 deletions

View File

@ -55,14 +55,14 @@ PHPDBG_HELP(compile) /* {{{ */
PHPDBG_HELP(print) /* {{{ */
{
printf("By default, print will show information about the current execution environment\n");
printf("To show specific information pass an expression to print, for example:\n");
printf("\tphpdbg> print opcodes[0]\n");
printf("Will show the opline @ 0\n");
printf("Available print commands:\n");
printf("\tNone\n");
printf("By default, print will show information about the current execution environment\n");
printf("To show specific information pass an expression to print, for example:\n");
printf("\tphpdbg> print opcodes[0]\n");
printf("Will show the opline @ 0\n");
printf("Available print commands:\n");
printf("\tNone\n");
return SUCCESS;
return SUCCESS;
} /* }}} */
PHPDBG_HELP(run) /* {{{ */
@ -80,7 +80,19 @@ PHPDBG_HELP(eval) /* {{{ */
PHPDBG_HELP(break) /* {{{ */
{
printf("doing break help: %s\n", expr);
return SUCCESS;
printf("Setting a breakpoint stops execution at a specific stage, the syntax is:\n");
printf("\tfile:line\n");
printf("[more to come]\n");
printf("For example:\n");
printf("\tphpdbg> break test.php:1\n");
printf("Will break execution on line 1 of test.php\n");
return SUCCESS;
} /* }}} */
PHPDBG_HELP(cont) /* {{{ */
{
printf("Continues execution after a breakpoint is met\n");
printf("[Warnings about using stepping and break points here]\n");
return SUCCESS;
} /* }}} */

View File

@ -39,6 +39,7 @@ PHPDBG_HELP(run);
PHPDBG_HELP(eval);
PHPDBG_HELP(print);
PHPDBG_HELP(break);
PHPDBG_HELP(cont);
/**
* Commands
@ -52,6 +53,7 @@ static const phpdbg_command_t phpdbg_help_commands[] = {
PHPDBG_HELP_D(eval, "access to eval() allows you to affect the environment during execution"),
PHPDBG_HELP_D(print, "printing allows inspection of the execution environment"),
PHPDBG_HELP_D(break, "breakpoints allow execution interruption"),
PHPDBG_HELP_D(cont, "use continue when a break point is met"),
{NULL, 0, 0}
};

View File

@ -101,6 +101,10 @@ static PHPDBG_COMMAND(next) { /* {{{ */
return PHPDBG_NEXT;
} /* }}} */
static PHPDBG_COMMAND(cont) { /* {{{ */
return SUCCESS;
} /* }}} */
static PHPDBG_COMMAND(run) { /* {{{ */
if (PHPDBG_G(ops) || PHPDBG_G(exec)) {
if (!PHPDBG_G(ops)) {
@ -143,6 +147,21 @@ static PHPDBG_COMMAND(eval) { /* {{{ */
return SUCCESS;
} /* }}} */
static PHPDBG_COMMAND(back) { /* {{{ */
if (EG(in_execution)) {
const zend_execute_data *current = EG(current_execute_data);
if (current) {
do {
printf("%d\n", current->opline->opcode);
} while ((current = current->prev_execute_data));
}
return SUCCESS;
} else {
printf("Not executing !\n");
return FAILURE;
}
} /* }}} */
static PHPDBG_COMMAND(print) { /* {{{ */
if (!expr_len) {
printf("Showing Execution Context Information:\n");
@ -257,6 +276,8 @@ static const phpdbg_command_t phpdbg_prompt_commands[] = {
PHPDBG_COMMAND_D(eval, "evaluate some code"),
PHPDBG_COMMAND_D(print, "print something"),
PHPDBG_COMMAND_D(break, "set breakpoint"),
PHPDBG_COMMAND_D(cont, "continue execution"),
PHPDBG_COMMAND_D(back, "show backtrace"),
PHPDBG_COMMAND_D(help, "show help menu"),
PHPDBG_COMMAND_D(quit, "exit phpdbg"),
{NULL, 0, 0}
@ -333,9 +354,8 @@ int phpdbg_interactive(int argc, char **argv TSRMLS_DC) /* {{{ */
void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
{
zend_bool original_in_execution;
zend_bool original_in_execution = EG(in_execution);
original_in_execution = EG(in_execution);
EG(in_execution) = 1;
if (0) {