summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sapi/phpdbg/phpdbg_help.c10
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c62
2 files changed, 42 insertions, 30 deletions
diff --git a/sapi/phpdbg/phpdbg_help.c b/sapi/phpdbg/phpdbg_help.c
index bd0456b7d9..ceab62bcd8 100644
--- a/sapi/phpdbg/phpdbg_help.c
+++ b/sapi/phpdbg/phpdbg_help.c
@@ -389,6 +389,7 @@ phpdbg_help_text_t phpdbg_help_text[] = {
" **-l** **-l**4000 Setup remote console ports" CR
" **-a** **-a**192.168.0.3 Setup remote console bind address" CR
" **-x** Enable xml output (instead of normal text output)" CR
+" **-h** Print the help overview" CR
" **-V** Print version number" CR
" **--** **--** arg1 arg2 Use to delimit phpdbg arguments and php $argv; append any $argv "
"argument after it" CR CR
@@ -637,8 +638,8 @@ phpdbg_help_text_t phpdbg_help_text[] = {
{"frame",
"The **frame** takes an optional integer argument. If omitted, then the current frame is displayed "
-"If specified then the current scope is set to the corresponding frame listed in a **back** trace. " "This can be used to allowing access to the variables in a higher stack frame than that currently "
-"being executed." CR CR
+"If specified then the current scope is set to the corresponding frame listed in a **back** trace. "
+"This can be used to allowing access to the variables in a higher stack frame than that currently being executed." CR CR
"**Examples**" CR CR
" $P frame 2" CR
@@ -651,6 +652,7 @@ phpdbg_help_text_t phpdbg_help_text[] = {
{"info",
"**info** commands provide quick access to various types of information about the PHP environment" CR
+"By default general information about environment and PHP build is shown." CR
"Specific info commands are show below:" CR CR
" **Target** **Alias** **Purpose**" CR
@@ -738,7 +740,7 @@ phpdbg_help_text_t phpdbg_help_text[] = {
},
{"print",
-"By default, print will show information about the current execution context." CR
+"By default, print will show the opcodes of the current execution context." CR
"Other printing commands give access to instruction information." CR
"Specific printers loaded are show below:" CR CR
@@ -750,6 +752,8 @@ phpdbg_help_text_t phpdbg_help_text[] = {
" **func** **f** print out the instructions in the specified function" CR
" **stack** **s** print out the instructions in the current stack" CR CR
+"In case passed argument does not match a specific printing command, it will treat it as function or method name and print its opcodes" CR CR
+
"**Examples**" CR CR
" $P print class \\\\my\\\\class" CR
" $P p c \\\\my\\\\class" CR
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 9218c4a815..fdee749df9 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -73,12 +73,12 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
PHPDBG_COMMAND_D(until, "continue past the current line", 'u', NULL, 0, 0),
PHPDBG_COMMAND_D(finish, "continue past the end of the stack", 'F', NULL, 0, 0),
PHPDBG_COMMAND_D(leave, "continue until the end of the stack", 'L', NULL, 0, 0),
- PHPDBG_COMMAND_D(print, "print something", 'p', phpdbg_print_commands, 0, 0),
+ PHPDBG_COMMAND_D(print, "print something", 'p', phpdbg_print_commands, "|*c", 0),
PHPDBG_COMMAND_D(break, "set breakpoint", 'b', phpdbg_break_commands, "|*c", 0),
PHPDBG_COMMAND_D(back, "show trace", 't', NULL, "|n", PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(frame, "switch to a frame", 'f', NULL, "|n", PHPDBG_ASYNC_SAFE),
- PHPDBG_COMMAND_D(list, "lists some code", 'l', phpdbg_list_commands, "*", PHPDBG_ASYNC_SAFE),
- PHPDBG_COMMAND_D(info, "displays some informations", 'i', phpdbg_info_commands, "s", PHPDBG_ASYNC_SAFE),
+ PHPDBG_COMMAND_D(list, "lists some code", 'l', phpdbg_list_commands, "*", PHPDBG_ASYNC_SAFE),
+ PHPDBG_COMMAND_D(info, "displays some informations", 'i', phpdbg_info_commands, "|s", PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(clean, "clean the execution environment", 'X', NULL, 0, 0),
PHPDBG_COMMAND_D(clear, "clear breakpoints", 'C', NULL, 0, 0),
PHPDBG_COMMAND_D(help, "show help menu", 'h', phpdbg_help_commands, "|s", PHPDBG_ASYNC_SAFE),
@@ -780,51 +780,59 @@ PHPDBG_COMMAND(back) /* {{{ */
PHPDBG_COMMAND(print) /* {{{ */
{
+ if (!param || param->type == EMPTY_PARAM) {
+ return phpdbg_do_print_exec(param);
+ } else switch (param->type) {
+ case STR_PARAM:
+ return phpdbg_do_print_func(param);
+ case METHOD_PARAM:
+ return phpdbg_do_print_method(param);
+ default:
+ phpdbg_error("print", "type=\"invalidarg\"", "Invalid arguments to print, expected nothing, function name or method name");
+ return SUCCESS;
+ }
+} /* }}} */
+
+PHPDBG_COMMAND(info) /* {{{ */
+{
phpdbg_out("Execution Context Information\n\n");
phpdbg_xml("<printinfo %r>");
#ifdef HAVE_LIBREADLINE
- phpdbg_writeln("print", "readline=\"yes\"", "Readline yes");
+ phpdbg_writeln("info", "readline=\"yes\"", "Readline yes");
#else
- phpdbg_writeln("print", "readline=\"no\"", "Readline no");
+ phpdbg_writeln("info", "readline=\"no\"", "Readline no");
#endif
#ifdef HAVE_LIBEDIT
- phpdbg_writeln("print", "libedit=\"yes\"", "Libedit yes");
+ phpdbg_writeln("info", "libedit=\"yes\"", "Libedit yes");
#else
- phpdbg_writeln("print", "libedit=\"no\"", "Libedit no");
+ phpdbg_writeln("info", "libedit=\"no\"", "Libedit no");
#endif
- phpdbg_writeln("print", "context=\"%s\"", "Exec %s", PHPDBG_G(exec) ? PHPDBG_G(exec) : "none");
- phpdbg_writeln("print", "compiled=\"%s\"", "Compiled %s", PHPDBG_G(ops) ? "yes" : "no");
- phpdbg_writeln("print", "stepping=\"%s\"", "Stepping %s", (PHPDBG_G(flags) & PHPDBG_IS_STEPPING) ? "on" : "off");
- phpdbg_writeln("print", "quiet=\"%s\"", "Quietness %s", (PHPDBG_G(flags) & PHPDBG_IS_QUIET) ? "on" : "off");
- phpdbg_writeln("print", "oplog=\"%s\"", "Oplog %s", PHPDBG_G(oplog) ? "on" : "off");
+ phpdbg_writeln("info", "context=\"%s\"", "Exec %s", PHPDBG_G(exec) ? PHPDBG_G(exec) : "none");
+ phpdbg_writeln("info", "compiled=\"%s\"", "Compiled %s", PHPDBG_G(ops) ? "yes" : "no");
+ phpdbg_writeln("info", "stepping=\"%s\"", "Stepping %s", (PHPDBG_G(flags) & PHPDBG_IS_STEPPING) ? "on" : "off");
+ phpdbg_writeln("info", "quiet=\"%s\"", "Quietness %s", (PHPDBG_G(flags) & PHPDBG_IS_QUIET) ? "on" : "off");
+ phpdbg_writeln("info", "oplog=\"%s\"", "Oplog %s", PHPDBG_G(oplog) ? "on" : "off");
if (PHPDBG_G(ops)) {
- phpdbg_writeln("print", "ops=\"%d\"", "Opcodes %d", PHPDBG_G(ops)->last);
- phpdbg_writeln("print", "vars=\"%d\"", "Variables %d", PHPDBG_G(ops)->last_var ? PHPDBG_G(ops)->last_var - 1 : 0);
+ phpdbg_writeln("info", "ops=\"%d\"", "Opcodes %d", PHPDBG_G(ops)->last);
+ phpdbg_writeln("info", "vars=\"%d\"", "Variables %d", PHPDBG_G(ops)->last_var ? PHPDBG_G(ops)->last_var - 1 : 0);
}
- phpdbg_writeln("print", "executing=\"%d\"", "Executing %s", PHPDBG_G(in_execution) ? "yes" : "no");
+ phpdbg_writeln("info", "executing=\"%d\"", "Executing %s", PHPDBG_G(in_execution) ? "yes" : "no");
if (PHPDBG_G(in_execution)) {
- phpdbg_writeln("print", "vmret=\"%d\"", "VM Return %d", PHPDBG_G(vmret));
+ phpdbg_writeln("info", "vmret=\"%d\"", "VM Return %d", PHPDBG_G(vmret));
}
- phpdbg_writeln("print", "classes=\"%d\"", "Classes %d", zend_hash_num_elements(EG(class_table)));
- phpdbg_writeln("print", "functions=\"%d\"", "Functions %d", zend_hash_num_elements(EG(function_table)));
- phpdbg_writeln("print", "constants=\"%d\"", "Constants %d", zend_hash_num_elements(EG(zend_constants)));
- phpdbg_writeln("print", "includes=\"%d\"", "Included %d", zend_hash_num_elements(&EG(included_files)));
+ phpdbg_writeln("info", "classes=\"%d\"", "Classes %d", zend_hash_num_elements(EG(class_table)));
+ phpdbg_writeln("info", "functions=\"%d\"", "Functions %d", zend_hash_num_elements(EG(function_table)));
+ phpdbg_writeln("info", "constants=\"%d\"", "Constants %d", zend_hash_num_elements(EG(zend_constants)));
+ phpdbg_writeln("info", "includes=\"%d\"", "Included %d", zend_hash_num_elements(&EG(included_files)));
phpdbg_xml("</printinfo>");
return SUCCESS;
} /* }}} */
-PHPDBG_COMMAND(info) /* {{{ */
-{
- phpdbg_error("info", "type=\"toofewargs\" expected=\"1\"", "No information command selected!");
-
- return SUCCESS;
-} /* }}} */
-
PHPDBG_COMMAND(set) /* {{{ */
{
phpdbg_error("set", "type=\"toofewargs\" expected=\"1\"", "No set command selected!");