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.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c
index 3af52f17cd..5b93755bf9 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.c
@@ -24,6 +24,7 @@
#include "phpdbg_opcode.h"
#include "phpdbg_utils.h"
#include "ext/standard/php_string.h"
+#include "zend_smart_str.h"
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
@@ -56,7 +57,6 @@ char *phpdbg_decode_opline(zend_op_array *ops, zend_op *op) /*{{{ */
/* OP1 */
switch (op->opcode) {
case ZEND_JMP:
- case ZEND_GOTO:
case ZEND_FAST_CALL:
asprintf(&decode[1], "J%ld", OP_JMP_ADDR(op, op->op1) - ops->opcodes);
break;
@@ -114,6 +114,44 @@ char *phpdbg_decode_opline(zend_op_array *ops, zend_op *op) /*{{{ */
break;
}
+#if 1
+ if (ops->T_liveliness) {
+ uint32_t *var = ops->T_liveliness + (op - ops->opcodes);
+
+ if (*var != (uint32_t)-1) {
+ smart_str str = {0};
+
+ var = ops->T_liveliness + (*var);
+ smart_str_appends(&str, "; [@");
+ smart_str_append_long(&str, EX_VAR_TO_NUM(((*var) & ~0x3)) - ops->last_var);
+ while (*(++var) != (uint32_t)-1) {
+ smart_str_appends(&str, ", @");
+ smart_str_append_long(&str, EX_VAR_TO_NUM(((*var) & ~0x3)) - ops->last_var);
+ }
+ smart_str_appendc(&str, ']');
+ smart_str_0(&str);
+
+ asprintf(&decode[0],
+ "%-20s %-20s %-20s%-20s",
+ decode[1] ? decode[1] : "",
+ decode[2] ? decode[2] : "",
+ decode[3] ? decode[3] : "",
+ ZSTR_VAL(str.s));
+
+ smart_str_free(&str);
+
+ if (decode[1])
+ free(decode[1]);
+ if (decode[2])
+ free(decode[2]);
+ if (decode[3])
+ free(decode[3]);
+
+ return decode[0];
+ }
+ }
+#endif
+
asprintf(&decode[0],
"%-20s %-20s %-20s",
decode[1] ? decode[1] : "",