]> granicus.if.org Git - php/commitdiff
Reduce variabledetails+variable to just one variable tag
authorBob Weinand <bobwei9@hotmail.com>
Thu, 9 Oct 2014 09:47:52 +0000 (11:47 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Thu, 9 Oct 2014 09:47:52 +0000 (11:47 +0200)
phpdbg_info.c
xml.md

index 9c17e42c2eb8e104f886649a7ac3842261eb4474..a85484238c3cae51214b2462a6663bdf5f67a564 100644 (file)
@@ -184,29 +184,29 @@ static int phpdbg_print_symbols(zend_bool show_globals TSRMLS_DC) {
 
                        phpdbg_try_access {
                                if (!(invalid_data = !*data)) {
-                                       phpdbg_writeln("variable", "address=\"%p\" refcount=\"%d\" type=\"%s\"", "%p\t%d\t(%s)", *data, Z_REFCOUNT_PP(data), zend_zval_type_name(*data));
+#define VARIABLEINFO(attrs, msg, ...) phpdbg_writeln("variable", "address=\"%p\" refcount=\"%d\" type=\"%s\" refstatus=\"%s\" name=\"%s\" " attrs, "%p\t%d\t(%s)\n%s$%s", *data, Z_REFCOUNT_PP(data), zend_zval_type_name(*data), Z_ISREF_PP(data) ? "&": "", var, ##__VA_ARGS__)
 
                                        if (Z_TYPE_PP(data) == IS_RESOURCE) {
                                                phpdbg_try_access {
                                                        int type;
-                                                       phpdbg_writeln("variabledetails", "refstatus=\"%s\" name=\"%s\" type=\"%s\"", "%s$%s\n|-------(typeof)------> (%s)\n", Z_ISREF_PP(data) ? "&": "", var, zend_list_find(Z_RESVAL_PP(data), &type) ? zend_rsrc_list_get_rsrc_type(type TSRMLS_CC) : "unknown");
+                                                       VARIABLEINFO("type=\"%s\"", "\n|-------(typeof)------> (%s)\n", zend_list_find(Z_RESVAL_PP(data), &type) ? zend_rsrc_list_get_rsrc_type(type TSRMLS_CC) : "unknown");
                                                } phpdbg_catch_access {
-                                                       phpdbg_writeln("variabledetails", "refstatus=\"%s\" name=\"%s\" type=\"unknown\"", "%s$%s\n|-------(typeof)------> (unknown)\n", Z_ISREF_PP(data) ? "&": "", var);
+                                                       VARIABLEINFO("type=\"unknown\"", "\n|-------(typeof)------> (unknown)\n");
                                                } phpdbg_end_try_access();
                                        } else if (Z_TYPE_PP(data) == IS_OBJECT) {
                                                phpdbg_try_access {
-                                                       phpdbg_writeln("variabledetails", "refstatus=\"%s\" name=\"%s\" instanceof=\"%s\"", "%s$%s\n|-----(instanceof)----> (%s)\n", Z_ISREF_PP(data) ? "&": "", var, Z_OBJCE_PP(data)->name);
+                                                       VARIABLEINFO("instanceof=\"%s\"", "\n|-----(instanceof)----> (%s)\n", Z_OBJCE_PP(data)->name);
                                                } phpdbg_catch_access {
-                                                       phpdbg_writeln("variabledetails", "refstatus=\"%s\" name=\"%s\" instanceof=\"unknown\"", "%s$%s\n|-----(instanceof)----> (unknown)\n", Z_ISREF_PP(data) ? "&": "", var);
+                                                       VARIABLEINFO("instanceof=\"%s\"", "\n|-----(instanceof)----> (unknown)\n");
                                                } phpdbg_end_try_access();
                                        } else {
-                                               phpdbg_writeln("variabledetails", "refstatus=\"%s\" name=\"%s\"", "%s$%s", Z_ISREF_PP(data) ? "&": "", var);
+                                               VARIABLEINFO("", "");
                                        }
                                }
                        } phpdbg_end_try_access();
 
                        if (invalid_data) {
-                               phpdbg_writeln("variabledetails", "name=\"%s\"", "n/a\tn/a\tn/a\t$%s", var);
+                               phpdbg_writeln("variable", "name=\"%s\"", "n/a\tn/a\tn/a\t$%s", var);
                        }
                }
        }
diff --git a/xml.md b/xml.md
index bd3adc7a5dc272d01928eb8fa61d572eb7df70db..5cf45535c7d2a9b44672e85742ffe0708aa0044c 100644 (file)
--- a/xml.md
+++ b/xml.md
@@ -260,11 +260,11 @@ info (subcommands)
  - file
  - opline
 - for each variable there is a &lt;variable> followed by a &lt;variabledetails> element
-- &lt;variable address="" refcount="" type="" />
+- &lt;variable address="" refcount="" type="" name="" />
  - address: pointer to zval (hexadecimal)
  - refcount: refcount of zval
  - type: the variable type (long, string, ...). If the value is "unknown", the other attributes are meaningless
-- &lt;variabledetails name="" /> with name the name of the variable, optional args are:
+ - name: the name of the variable
  - refstatus: empty if the zval is not a reference
  - class: the class the object in the zval is an instance of
  - resource: the type of the resource in the zval