diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2015-03-21 23:03:22 +0100 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2015-03-21 23:16:53 +0100 |
commit | ea643307db7f86946225edc06bef9fd1d143b3ff (patch) | |
tree | 75d5f58b70886b26bcb4c77c38f80bf0470b8c25 /sapi/phpdbg/phpdbg_prompt.c | |
parent | 2ed008583309e07cb11dbf14de919b21bd68ef16 (diff) | |
download | php-git-ea643307db7f86946225edc06bef9fd1d143b3ff.tar.gz |
Put info to info and made print always output opcodes
Diffstat (limited to 'sapi/phpdbg/phpdbg_prompt.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_prompt.c | 62 |
1 files changed, 35 insertions, 27 deletions
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!"); |