com php-src: add print exec command to show current execution context instructions make phpdbg_compile public: phpdbg_help .c phpdbg_print.c
phpdbg_print.h phpdbg_promp t.c phpdbg_prompt.h
| From: | Bob Weinand | Date: | Sun, 17 Nov 2013 09:30:44 +0000 |
| Subject: | com php-src: add print exec command to show current execution context instructions make phpdbg_compile public: phpdbg_help .c phpdbg_print.c phpdbg_print.h phpdbg_promp t.c phpdbg_prompt.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74907@lists.php.net to get a copy of this message | ||
Commit: 22ae0d51a184f95740217833def50a5cba951b0b
Author: krakjoe <joe.watkins@live.co.uk> Sun, 17 Nov 2013 09:30:44 +0000
Parents: 434949c5b40d56d5f1d97180a78cff8b968a50d2
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=22ae0d51a184f95740217833def50a5cba951b0b
Log:
add print exec command to show current execution context instructions
make phpdbg_compile public
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 e7de30a..2a0c998 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -94,6 +94,8 @@ PHPDBG_HELP(print) /* {{{ */
phpdbg_writeln("Will print the instructions for the global function my_function");
phpdbg_writeln("\t%sprint opline", PROMPT);
phpdbg_writeln("Will print the instruction for the current opline");
+ phpdbg_writeln("\t%sprint exec", PROMPT);
+ phpdbg_writeln("Will print the instruction for the execution context");
phpdbg_writeln(EMPTY);
phpdbg_writeln("Specific printers loaded are show below:");
phpdbg_notice("Commands");
diff --git a/phpdbg_print.c b/phpdbg_print.c
index 09e6d7f..9a4a158 100644
--- a/phpdbg_print.c
+++ b/phpdbg_print.c
@@ -57,7 +57,7 @@ static inline void phpdbg_print_function_helper(zend_function *method TSRMLS_DC)
phpdbg_writeln(
"\t#%d-%d %s() %s",
op_array->line_start, op_array->line_end,
- method->common.function_name,
+ method->common.function_name ? method->common.function_name :
"{main}",
op_array->filename ? op_array->filename : "unknown");
}
@@ -86,6 +86,26 @@ static inline void phpdbg_print_function_helper(zend_function *method TSRMLS_DC)
}
}
+PHPDBG_PRINT(exec) /* {{{ */
+{
+ if (PHPDBG_G(exec)) {
+ if (!PHPDBG_G(ops)) {
+ phpdbg_compile(TSRMLS_C);
+ }
+
+ if (PHPDBG_G(ops)) {
+ phpdbg_notice(
+ "Context %s", PHPDBG_G(exec));
+
+ phpdbg_print_function_helper((zend_function*) PHPDBG_G(ops) TSRMLS_CC);
+ }
+ } else {
+ phpdbg_error("No execution context set");
+ }
+
+ return SUCCESS;
+} /* }}} */
+
PHPDBG_PRINT(class) /* {{{ */
{
zend_class_entry **ce;
diff --git a/phpdbg_print.h b/phpdbg_print..h
index 01bc27f..dc6a133 100644
--- a/phpdbg_print.h
+++ b/phpdbg_print.h
@@ -34,6 +34,7 @@
/**
* Printer Forward Declarations
*/
+PHPDBG_PRINT(exec);
PHPDBG_PRINT(opline);
PHPDBG_PRINT(class);
PHPDBG_PRINT(method);
@@ -43,6 +44,7 @@ PHPDBG_PRINT(func);
* Commands
*/
static const phpdbg_command_t phpdbg_print_commands[] = {
+ PHPDBG_PRINT_D(exec, "print execution context instructions", 'e'),
PHPDBG_PRINT_D(opline, "print the current opline information", 'o'),
PHPDBG_PRINT_D(class, "print out the instructions in the specified class",
'c'),
PHPDBG_PRINT_D(method, "print out the instructions in the specified method",
'm'),
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index d3876be..0281fd7 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -232,7 +232,7 @@ static PHPDBG_COMMAND(exec) /* {{{ */
return SUCCESS;
} /* }}} */
-static inline int phpdbg_compile(TSRMLS_D) /* {{{ */
+int phpdbg_compile(TSRMLS_D) /* {{{ */
{
zend_file_handle fh;
diff --git a/phpdbg_prompt.h b/phpdbg_prompt.h
index 8e4a0c1..f3839d0 100644
--- a/phpdbg_prompt.h
+++ b/phpdbg_prompt.h
@@ -51,6 +51,7 @@ void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default TS
void phpdbg_welcome(zend_bool cleaning TSRMLS_DC);
int phpdbg_interactive(TSRMLS_D);
void phpdbg_print_opline(zend_execute_data *execute_data, zend_bool ignore_flags TSRMLS_DC);
+int phpdbg_compile(TSRMLS_D);
void phpdbg_clean(zend_bool full TSRMLS_DC);
#if PHP_VERSION_ID >= 50500