mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
Merge branch 'master' of github.com:krakjoe/phpdbg
This commit is contained in:
commit
a6d573cd89
5 changed files with 34 additions and 1 deletions
1
phpdbg.c
1
phpdbg.c
|
@ -27,6 +27,7 @@ static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) {
|
||||||
pg->exec = NULL;
|
pg->exec = NULL;
|
||||||
pg->ops = NULL;
|
pg->ops = NULL;
|
||||||
pg->stepping = 0;
|
pg->stepping = 0;
|
||||||
|
pg->vmret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHP_MINIT_FUNCTION(phpdbg) {
|
static PHP_MINIT_FUNCTION(phpdbg) {
|
||||||
|
|
|
@ -72,6 +72,12 @@ PHPDBG_HELP(run) /* {{{ */
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
PHPDBG_HELP(eval) /* {{{ */
|
||||||
|
{
|
||||||
|
printf("Access to eval() allows you to change the environment during execution, careful though !!");
|
||||||
|
return SUCCESS;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
PHPDBG_HELP(break) /* {{{ */
|
PHPDBG_HELP(break) /* {{{ */
|
||||||
{
|
{
|
||||||
printf("doing break help: %s\n", expr);
|
printf("doing break help: %s\n", expr);
|
||||||
|
|
|
@ -36,6 +36,7 @@ PHPDBG_HELP(compile);
|
||||||
PHPDBG_HELP(step);
|
PHPDBG_HELP(step);
|
||||||
PHPDBG_HELP(next);
|
PHPDBG_HELP(next);
|
||||||
PHPDBG_HELP(run);
|
PHPDBG_HELP(run);
|
||||||
|
PHPDBG_HELP(eval);
|
||||||
PHPDBG_HELP(print);
|
PHPDBG_HELP(print);
|
||||||
PHPDBG_HELP(break);
|
PHPDBG_HELP(break);
|
||||||
|
|
||||||
|
@ -48,6 +49,7 @@ static const phpdbg_command_t phpdbg_help_commands[] = {
|
||||||
PHPDBG_HELP_D(step, "stepping through execution allows inspection of the opline after every opcode"),
|
PHPDBG_HELP_D(step, "stepping through execution allows inspection of the opline after every opcode"),
|
||||||
PHPDBG_HELP_D(next, "execute the next opcode"),
|
PHPDBG_HELP_D(next, "execute the next opcode"),
|
||||||
PHPDBG_HELP_D(run, "execution inside the phpdbg vm allows detailed inspection and debugging"),
|
PHPDBG_HELP_D(run, "execution inside the phpdbg vm allows detailed inspection and debugging"),
|
||||||
|
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(print, "printing allows inspection of the execution environment"),
|
||||||
PHPDBG_HELP_D(break, "breakpoints allow execution interruption"),
|
PHPDBG_HELP_D(break, "breakpoints allow execution interruption"),
|
||||||
{NULL, 0, 0}
|
{NULL, 0, 0}
|
||||||
|
|
|
@ -115,11 +115,27 @@ static PHPDBG_COMMAND(run) { /* {{{ */
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
printf("Nothing to execute !");
|
printf("Nothing to execute !\n");
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
static PHPDBG_COMMAND(eval) { /* {{{ */
|
||||||
|
zval retval;
|
||||||
|
|
||||||
|
if (expr) {
|
||||||
|
if (zend_eval_stringl((char*)expr, expr_len-1, &retval, "eval()'d code" TSRMLS_CC) == SUCCESS) {
|
||||||
|
printf("Success\n");
|
||||||
|
zval_dtor(&retval);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("No expression provided !\n");
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
static PHPDBG_COMMAND(print) { /* {{{ */
|
static PHPDBG_COMMAND(print) { /* {{{ */
|
||||||
if (!expr_len) {
|
if (!expr_len) {
|
||||||
printf("Showing Execution Context Information:\n");
|
printf("Showing Execution Context Information:\n");
|
||||||
|
@ -132,6 +148,10 @@ static PHPDBG_COMMAND(print) { /* {{{ */
|
||||||
printf("Variables\t%d\n", PHPDBG_G(ops)->last_var-1);
|
printf("Variables\t%d\n", PHPDBG_G(ops)->last_var-1);
|
||||||
} else printf("Variables\tNone\n");
|
} else printf("Variables\tNone\n");
|
||||||
}
|
}
|
||||||
|
printf("Executing\t%s\n", EG(in_execution) ? "yes" : "no");
|
||||||
|
if (EG(in_execution)) {
|
||||||
|
printf("VM Return\t%d\n", PHPDBG_G(vmret));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf(
|
printf(
|
||||||
"%s\n", expr);
|
"%s\n", expr);
|
||||||
|
@ -216,6 +236,7 @@ static const phpdbg_command_t phpdbg_prompt_commands[] = {
|
||||||
PHPDBG_COMMAND_D(step, "step through execution"),
|
PHPDBG_COMMAND_D(step, "step through execution"),
|
||||||
PHPDBG_COMMAND_D(next, "next opcode"),
|
PHPDBG_COMMAND_D(next, "next opcode"),
|
||||||
PHPDBG_COMMAND_D(run, "attempt execution"),
|
PHPDBG_COMMAND_D(run, "attempt execution"),
|
||||||
|
PHPDBG_COMMAND_D(eval, "evaluate some code"),
|
||||||
PHPDBG_COMMAND_D(print, "print something"),
|
PHPDBG_COMMAND_D(print, "print something"),
|
||||||
PHPDBG_COMMAND_D(break, "set breakpoint"),
|
PHPDBG_COMMAND_D(break, "set breakpoint"),
|
||||||
PHPDBG_COMMAND_D(help, "show help menu"),
|
PHPDBG_COMMAND_D(help, "show help menu"),
|
||||||
|
|
3
test.php
3
test.php
|
@ -1,3 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
echo "Hello World\n";
|
echo "Hello World\n";
|
||||||
|
if (isset($greeting)) {
|
||||||
|
echo $greeting;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue