mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
add print exec command to show current execution context instructions
make phpdbg_compile public
This commit is contained in:
parent
434949c5b4
commit
22ae0d51a1
5 changed files with 27 additions and 2 deletions
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue