summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_opcode.c
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-06-29 02:51:10 +0200
committerBob Weinand <bobwei9@hotmail.com>2015-06-29 02:51:10 +0200
commit088f589f7d5aa24a8c42fea582dc53b8cb7232c2 (patch)
tree97e9052ee449a2cbecf5a2fa0646177a2ada6f81 /sapi/phpdbg/phpdbg_opcode.c
parentf500471e8c27af61e3c213d183e583b49d8b42ee (diff)
downloadphp-git-088f589f7d5aa24a8c42fea582dc53b8cb7232c2.tar.gz
Make backtraces *much* more readable
Diffstat (limited to 'sapi/phpdbg/phpdbg_opcode.c')
-rw-r--r--sapi/phpdbg/phpdbg_opcode.c54
1 files changed, 1 insertions, 53 deletions
diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c
index ffc5db04d4..75009108a2 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.c
@@ -53,60 +53,8 @@ static inline char *phpdbg_decode_op(zend_op_array *ops, znode_op *op, uint32_t
case IS_CONST: {
zval *literal = RT_CONSTANT(ops, *op);
- switch (Z_TYPE_P(literal)) {
- case IS_UNDEF:
- decode = zend_strndup("", 0);
- break;
- case IS_NULL:
- decode = zend_strndup(ZEND_STRL("null"));
- break;
- case IS_FALSE:
- decode = zend_strndup(ZEND_STRL("false"));
- break;
- case IS_TRUE:
- decode = zend_strndup(ZEND_STRL("true"));
- break;
- case IS_LONG:
- asprintf(&decode, ZEND_ULONG_FMT, Z_LVAL_P(literal));
- break;
- case IS_DOUBLE:
- asprintf(&decode, "%.*G", 14, Z_DVAL_P(literal));
- break;
- case IS_STRING: {
- int i;
- zend_string *str = php_addcslashes(Z_STR_P(literal), 0, "\\\"", 2);
- for (i = 0; i < str->len; i++) {
- if (str->val[i] < 32) {
- str->val[i] = ' ';
- }
- }
- asprintf(&decode, "\"%.*s\"%c", str->len <= 18 ? (int) str->len : 17, str->val, str->len <= 18 ? 0 : '+');
- zend_string_release(str);
- } break;
- case IS_RESOURCE:
- asprintf(&decode, "Rsrc #%d", Z_RES_HANDLE_P(literal));
- break;
- case IS_ARRAY:
- asprintf(&decode, "array(%d)", zend_hash_num_elements(Z_ARR_P(literal)));
- break;
- case IS_OBJECT: {
- zend_string *str = Z_OBJCE_P(literal)->name;
- asprintf(&decode, "%.*s%c", str->len <= 18 ? (int) str->len : 18, str->val, str->len <= 18 ? 0 : '+');
- } break;
- case IS_CONSTANT:
- decode = zend_strndup(ZEND_STRL("<constant>"));
- break;
- case IS_CONSTANT_AST:
- decode = zend_strndup(ZEND_STRL("<ast>"));
- break;
- default:
- asprintf(&decode, "unknown type: %d", Z_TYPE_P(literal));
- break;
- }
+ decode = phpdbg_short_zval_print(literal, 20);
} break;
-
- case IS_UNUSED:
- return NULL;
}
return decode;
} /* }}} */