mirror of
https://github.com/php/php-src.git
synced 2026-04-23 07:58:20 +02:00
don't be lazy, scan for ZEND_RETURN when setting seek opline
This commit is contained in:
@@ -94,6 +94,7 @@
|
||||
#define PHPDBG_IN_UNTIL (1<<13)
|
||||
#define PHPDBG_IN_FINISH (1<<14)
|
||||
#define PHPDBG_IN_LEAVE (1<<15)
|
||||
#define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE)
|
||||
|
||||
#ifndef _WIN32
|
||||
# define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET|PHPDBG_IS_COLOURED)
|
||||
|
||||
+58
-31
@@ -326,7 +326,18 @@ static PHPDBG_COMMAND(finish) /* {{{ */
|
||||
}
|
||||
|
||||
PHPDBG_G(flags) |= PHPDBG_IN_FINISH;
|
||||
PHPDBG_G(seek) = (zend_ulong) &(EG(active_op_array)->opcodes[EG(active_op_array)->last-2]);
|
||||
{
|
||||
zend_uint next = 0,
|
||||
self = (EG(current_execute_data)->opline - EG(active_op_array)->opcodes);
|
||||
zend_op *opline = &EG(active_op_array)->opcodes[self];
|
||||
|
||||
for (next = self; next < EG(active_op_array)->last; next++) {
|
||||
if (EG(active_op_array)->opcodes[next].opcode == ZEND_RETURN) {
|
||||
PHPDBG_G(seek) = (zend_ulong) &EG(active_op_array)->opcodes[next];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PHPDBG_FINISH;
|
||||
} /* }}} */
|
||||
@@ -339,7 +350,18 @@ static PHPDBG_COMMAND(leave) /* {{{ */
|
||||
}
|
||||
|
||||
PHPDBG_G(flags) |= PHPDBG_IN_LEAVE;
|
||||
PHPDBG_G(seek) = (zend_ulong) &(EG(active_op_array)->opcodes[EG(active_op_array)->last-2]);
|
||||
{
|
||||
zend_uint next = 0,
|
||||
self = (EG(current_execute_data)->opline - EG(active_op_array)->opcodes);
|
||||
zend_op *opline = &EG(active_op_array)->opcodes[self];
|
||||
|
||||
for (next = self; next < EG(active_op_array)->last; next++) {
|
||||
if (EG(active_op_array)->opcodes[next].opcode == ZEND_RETURN) {
|
||||
PHPDBG_G(seek) = (zend_ulong) &EG(active_op_array)->opcodes[next];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PHPDBG_LEAVE;
|
||||
} /* }}} */
|
||||
@@ -375,7 +397,8 @@ static PHPDBG_COMMAND(run) /* {{{ */
|
||||
zend_activate_auto_globals(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
|
||||
PHPDBG_G(flags) &= ~(PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE);
|
||||
/* clean flags */
|
||||
PHPDBG_G(flags) &= ~PHPDBG_SEEK_MASK;
|
||||
|
||||
zend_try {
|
||||
zend_execute(
|
||||
@@ -1009,38 +1032,42 @@ zend_vm_enter:
|
||||
goto next;
|
||||
}
|
||||
|
||||
/* run to next line */
|
||||
if (PHPDBG_G(flags) & PHPDBG_IN_UNTIL) {
|
||||
if (((zend_ulong)execute_data->opline) == PHPDBG_G(seek)) {
|
||||
PHPDBG_G(flags) &= ~PHPDBG_IN_UNTIL;
|
||||
} else {
|
||||
/* perform seek operation */
|
||||
if (PHPDBG_G(flags) & PHPDBG_SEEK_MASK) {
|
||||
|
||||
/* run to next line */
|
||||
if (PHPDBG_G(flags) & PHPDBG_IN_UNTIL) {
|
||||
if (((zend_ulong)execute_data->opline) == PHPDBG_G(seek)) {
|
||||
PHPDBG_G(flags) &= ~PHPDBG_IN_UNTIL;
|
||||
} else {
|
||||
/* skip possible breakpoints */
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
|
||||
/* run to finish */
|
||||
if (PHPDBG_G(flags) & PHPDBG_IN_FINISH) {
|
||||
if (((zend_ulong)execute_data->opline) == PHPDBG_G(seek)) {
|
||||
PHPDBG_G(flags) &= ~PHPDBG_IN_FINISH;
|
||||
}
|
||||
/* skip possible breakpoints */
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
|
||||
/* run to finish */
|
||||
if (PHPDBG_G(flags) & PHPDBG_IN_FINISH) {
|
||||
if (((zend_ulong)execute_data->opline) == PHPDBG_G(seek)) {
|
||||
PHPDBG_G(flags) &= ~PHPDBG_IN_FINISH;
|
||||
}
|
||||
/* skip possible breakpoints */
|
||||
goto next;
|
||||
}
|
||||
|
||||
/* break for leave */
|
||||
if (PHPDBG_G(flags) & PHPDBG_IN_LEAVE) {
|
||||
if (((zend_ulong)execute_data->opline) == PHPDBG_G(seek)) {
|
||||
PHPDBG_G(flags) &= ~PHPDBG_IN_LEAVE;
|
||||
phpdbg_notice(
|
||||
"Breaking for leave at %s:%u",
|
||||
zend_get_executed_filename(TSRMLS_C),
|
||||
zend_get_executed_lineno(TSRMLS_C)
|
||||
);
|
||||
DO_INTERACTIVE();
|
||||
} else {
|
||||
/* skip possible breakpoints */
|
||||
goto next;
|
||||
/* break for leave */
|
||||
if (PHPDBG_G(flags) & PHPDBG_IN_LEAVE) {
|
||||
if (((zend_ulong)execute_data->opline) == PHPDBG_G(seek)) {
|
||||
PHPDBG_G(flags) &= ~PHPDBG_IN_LEAVE;
|
||||
phpdbg_notice(
|
||||
"Breaking for leave at %s:%u",
|
||||
zend_get_executed_filename(TSRMLS_C),
|
||||
zend_get_executed_lineno(TSRMLS_C)
|
||||
);
|
||||
DO_INTERACTIVE();
|
||||
} else {
|
||||
/* skip possible breakpoints */
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user