ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
-static inline char *phpdbg_decode_op(zend_op_array *ops, znode_op *op, uint32_t type, HashTable *vars) /* {{{ */
+static inline char *phpdbg_decode_op(zend_op_array *ops, znode_op *op, uint32_t type) /* {{{ */
{
char *decode = NULL;
case IS_VAR:
case IS_TMP_VAR: {
- zend_ulong id = 0, *pid = NULL;
- if (vars != NULL) {
- if ((pid = zend_hash_index_find_ptr(vars, (zend_ulong) ops->vars - op->var))) {
- id = *pid;
- } else {
- id = zend_hash_num_elements(vars);
- zend_hash_index_update_mem(vars, (zend_ulong) ops->vars - op->var, &id, sizeof(zend_ulong));
- }
- }
- asprintf(&decode, "@" ZEND_ULONG_FMT, id);
+ asprintf(&decode, "@%" PRIu32, EX_VAR_TO_NUM(op->var) - ops->last_var);
} break;
-
case IS_CONST: {
zval *literal = RT_CONSTANT(ops, *op);
decode = phpdbg_short_zval_print(literal, 20);
return decode;
} /* }}} */
-char *phpdbg_decode_opline(zend_op_array *ops, zend_op *op, HashTable *vars) /*{{{ */
+char *phpdbg_decode_opline(zend_op_array *ops, zend_op *op) /*{{{ */
{
char *decode[4] = {NULL, NULL, NULL, NULL};
break;
default:
- decode[1] = phpdbg_decode_op(ops, &op->op1, op->op1_type, vars);
+ decode[1] = phpdbg_decode_op(ops, &op->op1, op->op1_type);
break;
}
break;
default:
- decode[2] = phpdbg_decode_op(ops, &op->op2, op->op2_type, vars);
+ decode[2] = phpdbg_decode_op(ops, &op->op2, op->op2_type);
break;
}
asprintf(&decode[2], "%" PRIu32, op->result.num);
break;
default:
- decode[3] = phpdbg_decode_op(ops, &op->result, op->result_type, vars);
+ decode[3] = phpdbg_decode_op(ops, &op->result, op->result_type);
break;
}
return decode[0];
} /* }}} */
-void phpdbg_print_opline_ex(zend_execute_data *execute_data, HashTable *vars, zend_bool ignore_flags) /* {{{ */
+void phpdbg_print_opline_ex(zend_execute_data *execute_data, zend_bool ignore_flags) /* {{{ */
{
/* force out a line while stepping so the user knows what is happening */
if (ignore_flags ||
(PHPDBG_G(oplog)))) {
zend_op *opline = (zend_op *) execute_data->opline;
- char *decode = phpdbg_decode_opline(&execute_data->func->op_array, opline, vars);
+ char *decode = phpdbg_decode_opline(&execute_data->func->op_array, opline);
if (ignore_flags || (!(PHPDBG_G(flags) & PHPDBG_IS_QUIET) || (PHPDBG_G(flags) & PHPDBG_IS_STEPPING))) {
/* output line info */
void phpdbg_print_opline(zend_execute_data *execute_data, zend_bool ignore_flags) /* {{{ */
{
- phpdbg_print_opline_ex(execute_data, NULL, ignore_flags);
+ phpdbg_print_opline_ex(execute_data, ignore_flags);
} /* }}} */
const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ */
#include "zend_types.h"
const char *phpdbg_decode_opcode(zend_uchar);
-char *phpdbg_decode_opline(zend_op_array *ops, zend_op *op, HashTable *vars);
+char *phpdbg_decode_opline(zend_op_array *ops, zend_op *op);
void phpdbg_print_opline(zend_execute_data *execute_data, zend_bool ignore_flags);
-void phpdbg_print_opline_ex(zend_execute_data *execute_data, HashTable *vars, zend_bool ignore_flags);
+void phpdbg_print_opline_ex(zend_execute_data *execute_data, zend_bool ignore_flags);
typedef struct _phpdbg_oplog_entry phpdbg_oplog_entry;
struct _phpdbg_oplog_entry {
switch (method->type) {
case ZEND_USER_FUNCTION: {
zend_op_array* op_array = &(method->op_array);
- HashTable vars;
if (op_array) {
zend_op *opline = &(op_array->opcodes[0]);
op_array->last);
}
- zend_hash_init(&vars, op_array->last, NULL, NULL, 0);
do {
- char *decode = phpdbg_decode_opline(op_array, opline, &vars);
+ char *decode = phpdbg_decode_opline(op_array, opline);
if (decode != NULL) {
phpdbg_writeln("print", "line=\"%u\" opnum=\"%u\" opcode=\"%s\" op=\"%s\"", " L%-4u #%-5u %-23s %s",
opline->lineno,
}
opline++;
} while (opcode++ < end);
- zend_hash_destroy(&vars);
}
} break;
void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
{
zend_bool original_in_execution = PHPDBG_G(in_execution);
- HashTable vars;
-
- zend_hash_init(&vars, execute_data->func->op_array.last, NULL, NULL, 0);
if ((PHPDBG_G(flags) & PHPDBG_IS_STOPPING) && !(PHPDBG_G(flags) & PHPDBG_IS_RUNNING)) {
zend_bailout();
}
/* not while in conditionals */
- phpdbg_print_opline_ex(execute_data, &vars, 0);
+ phpdbg_print_opline_ex(execute_data, 0);
if (PHPDBG_G(flags) & PHPDBG_IS_STEPPING && (PHPDBG_G(flags) & PHPDBG_STEP_OPCODE || execute_data->opline->lineno != PHPDBG_G(last_line))) {
PHPDBG_G(flags) &= ~PHPDBG_IS_STEPPING;
if (PHPDBG_G(vmret) != 0) {
if (PHPDBG_G(vmret) < 0) {
- zend_hash_destroy(&vars);
PHPDBG_G(in_execution) = original_in_execution;
return;
} else {