com php-src: updates to helpers: phpdbg_help.c phpdbg_p rint.c phpdbg_print.h phpdbg_prompt.c phpdbg_ prompt.h
| From: | Bob Weinand | Date: | Tue, 12 Nov 2013 09:26:26 +0000 |
| Subject: | com php-src: updates to helpers: phpdbg_help.c phpdbg_p rint.c phpdbg_print.h phpdbg_prompt.c phpdbg_ prompt.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75071@lists.php.net to get a copy of this message | ||
Commit: 1d373be4fbaaf9878c4acb1afb21647651dbbbc4
Author: krakjoe <joe.watkins@live.co.uk> Tue, 12 Nov 2013 09:26:26 +0000
Parents: 83852d3bb775fd3555011e2cc1d5fdc9f418469e
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1d373be4fbaaf9878c4acb1afb21647651dbbbc4
Log:
updates to helpers
Changed paths:
M phpdbg_help.c
M phpdbg_print.c
M phpdbg_print.h
M phpdbg_prompt.c
M phpdbg_prompt.h
Diff:
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 21feb07..1a78c69 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -19,6 +19,9 @@
#include "phpdbg.h"
#include "phpdbg_help.h"
+#include "phpdbg_print.h"
+
+ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
PHPDBG_HELP(exec) /* {{{ */
{
@@ -31,7 +34,7 @@ PHPDBG_HELP(step) /* {{{ */
{
printf("You can enable and disable stepping at any phpdbg prompt during
execution\n");
printf("For example:\n");
- printf("\tphpdbg> stepping 1\n");
+ printf("\t%sstepping 1\n", PHPDBG_PROMPT_LINE(TSRMLS_C));
printf("Will enable stepping\n");
printf("While stepping is enabled you are presented with a prompt after the execution of
each opcode\n");
return SUCCESS;
@@ -56,11 +59,16 @@ 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("Specific printers loaded are show below:\n");
+ printf("%sCommands%s\n", PHPDBG_BOLD_LINE(TSRMLS_C), PHPDBG_END_LINE(TSRMLS_C));
+ {
+ phpdbg_command_t *print_command = phpdbg_print_commands;
+
+ while (print_command && print_command->name) {
+ printf("\t%s\t%s\n", print_command->name, print_command->tip);
+ ++print_command;
+ }
+ }
return SUCCESS;
} /* }}} */
@@ -86,13 +94,13 @@ PHPDBG_HELP(break) /* {{{ */
printf("\t\\my\\class::method\n");
printf("\t0x16\n");
printf("For example:\n");
- printf("\tphpdbg> break test.php:1\n");
+ printf("\t%sbreak test.php:1\n", PHPDBG_PROMPT_LINE(TSRMLS_C));
printf("Will break execution on line 1 of test.php\n");
- printf("\tphpdbg> break my_function\n");
+ printf("\t%sbreak my_function\n", PHPDBG_PROMPT_LINE(TSRMLS_C));
printf("Will break execution on entry to my_function\n");
- printf("\tphpdbg> break \\my\\class::method\n");
+ printf("\t%sbreak \\my\\class::method\n", PHPDBG_PROMPT_LINE(TSRMLS_C));
printf("Will break execution on entry to \\my\\class::method\n");
- printf("\tphpdbg> break 0x7ff68f570e08\n");
+ printf("\t%sbreak 0x7ff68f570e08\n", PHPDBG_PROMPT_LINE(TSRMLS_C));
printf("Will break at the opline with the address provided (addresses are shown during
execution)\n");
printf("It is important to note, an address is only valid for the current compiled
representation of the script\n");
printf("If you have to clean the environment and recompile then your opline break points will
be invalid\n");
@@ -117,9 +125,9 @@ PHPDBG_HELP(quiet) /* {{{ */
{
printf("Setting quietness on will stop the OPLINE output during execution\n");
printf("For example:\n");
- printf("\tphpdbg> quiet 1\n");
+ printf("\t%squiet 1\n", PHPDBG_PROMPT_LINE(TSRMLS_C));
printf("Will silence OPLINE output, while\n");
- printf("\tphpdbg> quiet 0\n");
+ printf("\t%squiet 0\n", PHPDBG_PROMPT_LINE(TSRMLS_C));
printf("Will enable OPLINE output again\n");
return SUCCESS;
} /* }}} */
@@ -128,7 +136,7 @@ PHPDBG_HELP(back) /* {{{ */
{
printf("The backtrace is gathered with the default debug_backtrace functionality.\n");
printf("You can set the limit on the trace, for example:\n");
- printf("\tphpdbg> back 5\n");
+ printf("\t%sback 5\n", PHPDBG_PROMPT_LINE(TSRMLS_C));
printf("Will limit the number of frames to 5, the default is no limit\n");
return SUCCESS;
} /* }}} */
@@ -136,11 +144,11 @@ PHPDBG_HELP(back) /* {{{ */
PHPDBG_HELP(list) /* {{{ */
{
printf("The list command displays N line from current context file.\n");
- printf("\tphpdbg> list 2\n");
+ printf("\t%slist 2\n", PHPDBG_PROMPT_LINE(TSRMLS_C));
printf("Will print next 2 lines from the current file\n");
- printf("\tphpdbg> list func\n");
+ printf("\t%slist func\n", PHPDBG_PROMPT_LINE(TSRMLS_C));
printf("Will print the source of the global function \"func\"\n");
- printf("\tphpdbg> list .mine\n");
+ printf("\t%slist .mine\n", PHPDBG_PROMPT_LINE(TSRMLS_C));
printf("Will print the source of the class method \"mine\"\n");
printf("Note: before listing functions you must have a populated function table, try compile
!!\n");
return SUCCESS;
diff --git a/phpdbg_print.c b/phpdbg_print.c
index d49cc26...7477897 100644
--- a/phpdbg_print.c
+++ b/phpdbg_print.c
@@ -20,8 +20,18 @@
#include "phpdbg.h"
#include "phpdbg_print.h"
-PHPDBG_PRINT(default) /* {{{ */
+ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
+
+PHPDBG_PRINT(opline) /* {{{ */
{
- printf("in default printer\n");
+ if (EG(in_execution) && EG(current_execute_data)) {
+ phpdbg_print_opline(
+ EG(current_execute_data), 1 TSRMLS_CC);
+ } else {
+ printf(
+ "%sNot Executing!%s\n",
+ PHPDBG_RED_LINE(TSRMLS_C), PHPDBG_END_LINE(TSRMLS_C));
+ }
+
return SUCCESS;
} /* }}} */
diff --git a/phpdbg_print.h b/phpdbg_print.h
index 825316a..ae8453b 100644
--- a/phpdbg_print.h
+++ b/phpdbg_print.h
@@ -34,13 +34,13 @@
/**
* Printer Forward Declarations
*/
-PHPDBG_PRINT(default);
+PHPDBG_PRINT(opline);
/**
* Commands
*/
static const phpdbg_command_t phpdbg_print_commands[] = {
- PHPDBG_PRINT_D(default, "the default print command"),
+ PHPDBG_PRINT_D(opline, "print the current opline information"),
{NULL, 0, 0}
};
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index dd225d6..5fae155 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -699,15 +699,15 @@ phpdbg_interactive_enter:
return SUCCESS;
} /* }}} */
-static void phpdbg_print_opline(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
+void phpdbg_print_opline(zend_execute_data *execute_data, zend_bool ignore_flags TSRMLS_DC) /* {{{
*/
{
/* force out a line while stepping so the user knows what is happening */
- if (!(PHPDBG_G(flags) & PHPDBG_IS_QUIET) || (PHPDBG_G(flags) & PHPDBG_IS_STEPPING)) {
+ if (ignore_flags || (!(PHPDBG_G(flags) & PHPDBG_IS_QUIET) || (PHPDBG_G(flags) &
PHPDBG_IS_STEPPING))) {
zend_op *opline = execute_data->opline;
printf(
"%sOPLINE: %p:%s%s\n",
- PHPDBG_BOLD_LINE(TSRMLS_C),
+ PHPDBG_BOLD_LINE(TSRMLS_C),
opline, phpdbg_decode_opcode(opline->opcode), PHPDBG_END_LINE(TSRMLS_C));
}
} /* }}} */
@@ -731,7 +731,7 @@ zend_vm_enter:
#endif
phpdbg_print_opline(
- execute_data TSRMLS_CC);
+ execute_data, 0 TSRMLS_CC);
if ((PHPDBG_G(flags) & PHPDBG_HAS_FILE_BP)
&& phpdbg_find_breakpoint_file(execute_data->op_array TSRMLS_CC) == SUCCESS)
{
diff --git a/phpdbg_prompt.h b/phpdbg_prompt.h
index bddc7f9..f9fd39d 100644
--- a/phpdbg_prompt.h
+++ b/phpdbg_prompt.h
@@ -60,5 +60,6 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le
int phpdbg_interactive(TSRMLS_D);
void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC);
+void phpdbg_print_opline(zend_execute_data *execute_data, zend_bool ignore_flags TSRMLS_DC);
#endif /* PHPDBG_PROMPT_H */