summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_opcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/phpdbg/phpdbg_opcode.c')
-rw-r--r--sapi/phpdbg/phpdbg_opcode.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c
index 0fd3d17edf..4b3bf4c668 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.c
@@ -37,7 +37,7 @@ static inline const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ */
} /* }}} */
static inline char *phpdbg_decode_op(
- zend_op_array *ops, const znode_op *op, uint32_t type) /* {{{ */
+ zend_op_array *ops, const zend_op *opline, const znode_op *op, uint32_t type) /* {{{ */
{
char *decode = NULL;
@@ -56,7 +56,7 @@ static inline char *phpdbg_decode_op(
spprintf(&decode, 0, "~%u", EX_VAR_TO_NUM(op->var) - ops->last_var);
break;
case IS_CONST: {
- zval *literal = RT_CONSTANT(ops, *op);
+ zval *literal = RT_CONSTANT(opline, *op);
decode = phpdbg_short_zval_print(literal, 20);
} break;
}
@@ -68,7 +68,7 @@ char *phpdbg_decode_input_op(
uint32_t flags) {
char *result = NULL;
if (op_type != IS_UNUSED) {
- result = phpdbg_decode_op(ops, &op, op_type);
+ result = phpdbg_decode_op(ops, opline, &op, op_type);
} else if (ZEND_VM_OP_JMP_ADDR == (flags & ZEND_VM_OP_MASK)) {
spprintf(&result, 0, "J%td", OP_JMP_ADDR(opline, op) - ops->opcodes);
} else if (ZEND_VM_OP_NUM == (flags & ZEND_VM_OP_MASK)) {
@@ -115,10 +115,16 @@ char *phpdbg_decode_opline(zend_op_array *ops, zend_op *opline) /*{{{ */
/* RESULT */
switch (opline->opcode) {
case ZEND_CATCH:
- spprintf(&decode[3], 0, "%" PRIu32, opline->result.num);
+ if (opline->extended_value == ZEND_LAST_CATCH) {
+ if (decode[2]) {
+ efree(decode[2]);
+ decode[2] = NULL;
+ }
+ }
+ decode[3] = phpdbg_decode_op(ops, opline, &opline->result, opline->result_type);
break;
default:
- decode[3] = phpdbg_decode_op(ops, &opline->result, opline->result_type);
+ decode[3] = phpdbg_decode_op(ops, opline, &opline->result, opline->result_type);
break;
}