com php-src: Shrink phpdbg opcode dump output a bit more: sapi/phpdbg/phpdbg_opcode.c sapi/phpdbg/phpdbg_print. c
| From: | Bob Weinand | Date: | Mon, 20 Apr 2015 18:59:13 +0000 |
| Subject: | com php-src: Shrink phpdbg opcode dump output a bit more: sapi/phpdbg/phpdbg_opcode.c sapi/phpdbg/phpdbg_print. c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86405@lists.php.net to get a copy of this message | ||
Commit: 5f10e84208c259a55db96789e9cbdf7e6af596a2
Author: Bob Weinand <bobwei9@hotmail.com> Mon, 20 Apr 2015 20:58:52 +0200
Parents: 0381c1b79e9491e68c9ca85a21e0a5bd68f3840f
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5f10e84208c259a55db96789e9cbdf7e6af596a2
Log:
Shrink phpdbg opcode dump output a bit more
Changed paths:
M sapi/phpdbg/phpdbg_opcode.c
M sapi/phpdbg/phpdbg_print.c
Diff:
diff --git a/sapi/phpdbg/phpdbg_opcode..c b/sapi/phpdbg/phpdbg_opcode.c
index 9622fd6..654bd62 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.c
@@ -27,28 +27,15 @@
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
-static inline uint32_t phpdbg_decode_literal(zend_op_array *ops, zval *literal) /* {{{ */
-{
- int iter = 0;
-
- while (iter < ops->last_literal) {
- if (literal == &ops->literals[iter]) {
- return iter;
- }
- iter++;
- }
-
- return 0;
-} /* }}} */
-
static inline char *phpdbg_decode_op(zend_op_array *ops, znode_op *op, uint32_t type, HashTable
*vars) /* {{{ */
{
char *decode = NULL;
switch (type &~ EXT_TYPE_UNUSED) {
- case IS_CV:
- asprintf(&decode, "$%s", ops->vars[EX_VAR_TO_NUM(op->var)]->val);
- break;
+ case IS_CV: {
+ zend_string *var = ops->vars[EX_VAR_TO_NUM(op->var)];
+ asprintf(&decode, "$%.*s%c", var->len <= 19 ? (int) var->len : 18,
var->val, var->len <= 19 ? 0 : '+');
+ } break;
case IS_VAR:
case IS_TMP_VAR: {
diff --git a/sapi/phpdbg/phpdbg_print.c b/sapi/phpdbg/phpdbg_print.c
index ffd2285..c1cea6e 100644
--- a/sapi/phpdbg/phpdbg_print.c
+++ b/sapi/phpdbg/phpdbg_print.c
@@ -85,10 +85,10 @@ static inline void phpdbg_print_function_helper(zend_function *method) /* {{{ */
do {
char *decode = phpdbg_decode_opline(op_array, opline, &vars);
if (decode != NULL) {
- phpdbg_writeln("print", "line=\"%u\" opnum=\"%u\"
opcode=\"%s\" op=\"%s\"", " L%-5u #%-5u %-36s %s",
+ phpdbg_writeln("print", "line=\"%u\" opnum=\"%u\"
opcode=\"%s\" op=\"%s\"", " L%-4u #%-5u %-23s %s",
opline->lineno,
opcode,
- phpdbg_decode_opcode(opline->opcode),
+ phpdbg_decode_opcode(opline->opcode) + 5, /* remove ZEND_ prefix */
decode);
free(decode);
} else {