From: Bob Weinand Date: Mon, 6 Oct 2014 09:46:39 +0000 (+0200) Subject: Fix frames output X-Git-Tag: php-5.6.3RC1~51^2~52^2~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=abd75ea2c5d28f61ca02092aaea600917ddc008c;p=php Fix frames output --- diff --git a/phpdbg_frame.c b/phpdbg_frame.c index 8c7b1084ea..eb4a9a8b4d 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(""); - } else { - phpdbg_xml(" />"); } phpdbg_out(")"); } @@ -210,13 +213,13 @@ void phpdbg_dump_backtrace(size_t num TSRMLS_DC) /* {{{ */ } if (user_defined == SUCCESS) { - phpdbg_xml(" "); + phpdbg_xml(""); + phpdbg_xml(""); } /* }}} */ diff --git a/phpdbg_utils.c b/phpdbg_utils.c index 782a8f085f..c303bc1665 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)) {