com php-src: Fix frames output: phpdbg_frame.c phpdbg_u tils.c
| From: | Bob Weinand | Date: | Mon, 06 Oct 2014 09:46:39 +0000 |
| Subject: | com php-src: Fix frames output: phpdbg_frame.c phpdbg_u tils.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82576@lists.php.net to get a copy of this message | ||
Commit: abd75ea2c5d28f61ca02092aaea600917ddc008c
Author: Bob Weinand <bobwei9@hotmail.com> Mon, 6 Oct 2014 11:46:39 +0200
Parents: fb763168196a9701b0b43c33adccaf34edcdd100
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=abd75ea2c5d28f61ca02092aaea600917ddc008c
Log:
Fix frames output
Changed paths:
M phpdbg_frame.c
M phpdbg_utils.c
Diff:
diff --git a/phpdbg_frame.c b/phpdbg_frame.c
index 8c7b108..eb4a9a8 100644
--- a/phpdbg_frame.c
+++ b/phpdbg_frame.c
@@ -104,6 +104,7 @@ static void phpdbg_dump_prototype(zval **tmp TSRMLS_DC) /* {{{ */
{
zval **funcname, **class, **type, **args, **argstmp;
char is_class;
+ int has_args = FAILURE;
zend_hash_find(Z_ARRVAL_PP(tmp), "function", sizeof("function"),
(void **)&funcname);
@@ -121,19 +122,26 @@ static void phpdbg_dump_prototype(zval **tmp TSRMLS_DC) /* {{{ */
zend_hash_find(Z_ARRVAL_PP(tmp), "type", sizeof("type"), (void **)&type);
}
+ has_args = zend_hash_find(Z_ARRVAL_PP(tmp), "args", sizeof("args"), (void
**)&args) == SUCCESS;
+
phpdbg_xml(" symbol=\"%s%s%s\"",
is_class == FAILURE?"":Z_STRVAL_PP(class),
is_class == FAILURE?"":Z_STRVAL_PP(type),
Z_STRVAL_PP(funcname)
);
+ if (has_args) {
+ phpdbg_xml(">");
+ } else {
+ phpdbg_xml(" />");
+ }
+
phpdbg_out("%s%s%s(",
is_class == FAILURE?"":Z_STRVAL_PP(class),
is_class == FAILURE?"":Z_STRVAL_PP(type),
Z_STRVAL_PP(funcname)
);
- if (zend_hash_find(Z_ARRVAL_PP(tmp), "args", sizeof("args"),
- (void **)&args) == SUCCESS) {
+ if (has_args) {
HashPosition iterator;
const zend_function *func = phpdbg_get_function(
Z_STRVAL_PP(funcname), is_class == FAILURE ? NULL : Z_STRVAL_PP(class) TSRMLS_CC);
@@ -141,8 +149,6 @@ static void phpdbg_dump_prototype(zval **tmp TSRMLS_DC) /* {{{ */
int j = 0, m = func ? func->common.num_args : 0;
zend_bool is_variadic = 0;
- phpdbg_xml(">");
-
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(args), &iterator);
while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(args),
(void **) &argstmp, &iterator) == SUCCESS) {
@@ -154,15 +160,14 @@ static void phpdbg_dump_prototype(zval **tmp TSRMLS_DC) /* {{{ */
#if PHP_VERSION_ID >= 50600
is_variadic = arginfo[j].is_variadic;
#endif
- phpdbg_xml(" variadic=\"%s\" name=\"%s\"", is_variadic ?
"variadic" : "", arginfo[j].name);
+ phpdbg_xml(" variadic=\"%s\" name=\"%s\">", is_variadic ?
"variadic" : "", arginfo[j].name);
+ phpdbg_out("%s=%s", arginfo[j].name, is_variadic ? "[": "");
- phpdbg_out("%s=%s",
- arginfo[j].name, is_variadic ? "[": "");
+ } else {
+ phpdbg_xml(">");
}
++j;
- phpdbg_xml(">");
-
zend_print_flat_zval_r(*argstmp TSRMLS_CC);
zend_hash_move_forward_ex(Z_ARRVAL_PP(args), &iterator);
@@ -172,8 +177,6 @@ static void phpdbg_dump_prototype(zval **tmp TSRMLS_DC) /* {{{ */
phpdbg_out("]");
}
phpdbg_xml("</frame>");
- } else {
- phpdbg_xml(" />");
}
phpdbg_out(")");
}
@@ -210,13 +213,13 @@ void phpdbg_dump_backtrace(size_t num TSRMLS_DC) /* {{{ */
}
if (user_defined == SUCCESS) {
- phpdbg_xml("<frame id=\"%d\" file=\"%s\"
line=\"%d\"", i, Z_STRVAL_PP(file), Z_LVAL_PP(line));
phpdbg_out("frame #%d: ", i++);
+ phpdbg_xml("<frame %r id=\"%d\" file=\"%s\"
line=\"%d\"", i, Z_STRVAL_PP(file), Z_LVAL_PP(line));
phpdbg_dump_prototype(tmp TSRMLS_CC);
phpdbg_out(" at %s:%ld\n", Z_STRVAL_PP(file), Z_LVAL_PP(line));
} else {
- phpdbg_xml("<frame id=\"%d\" internal=\"internal\"", i,
Z_STRVAL_PP(file), Z_LVAL_PP(line));
phpdbg_out(" => ");
+ phpdbg_xml("<frame %r id=\"%d\" internal=\"internal\"", i,
Z_STRVAL_PP(file), Z_LVAL_PP(line));
phpdbg_dump_prototype(tmp TSRMLS_CC);
phpdbg_out(" (internal function)\n");
}
@@ -225,5 +228,5 @@ void phpdbg_dump_backtrace(size_t num TSRMLS_DC) /* {{{ */
phpdbg_out("\n");
zval_dtor(&zbacktrace);
- phpdbg_xml("<backtrace>");
+ phpdbg_xml("</backtrace>");
} /* }}} */
diff --git a/phpdbg_utils.c b/phpdbg_utils.c
index 782a8f0..c303bc1 100644
--- a/phpdbg_utils.c
+++ b/phpdbg_utils.c
@@ -771,6 +771,12 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool
esca
break;
+ case 'r':
+ s_len = asprintf(&s, "req=\"%lu\"", PHPDBG_G(req_id));
+ free_s = s;
+ break;
+
+
case 'f':
case 'F':
case 'e':
@@ -1279,7 +1285,7 @@ PHPDBG_API int phpdbg_xml_internal(FILE *fp TSRMLS_DC, const char *fmt, ...) {
int buflen;
va_start(args, fmt);
- buflen = vspprintf(&buffer, 0, fmt, args);
+ buflen = phpdbg_xml_vasprintf(&buffer, fmt, 0, args TSRMLS_CC);
va_end(args);
if (PHPDBG_G(in_script_xml)) {