]> granicus.if.org Git - php/commitdiff
Enhancements and fixes for print_pi in gdbinit
authorMitch Hagstrand <mhagstrand@gmail.com>
Fri, 9 Feb 2018 17:30:45 +0000 (11:30 -0600)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 10 Feb 2018 18:18:39 +0000 (19:18 +0100)
1) Outputs the default value and the offset of a property
2) Fixed output of property flags

.gdbinit

index d60f214bf769c1366263036c47d28698ab4393c6..53ad8728a059a09d80129452d186cab2b3a019da 100644 (file)
--- a/.gdbinit
+++ b/.gdbinit
@@ -472,9 +472,12 @@ end
 
 define print_pi
        set $pi = (zend_property_info *)$arg0
+       set $initial_offset = ((uint32_t)(zend_uintptr_t)(&((zend_object*)0)->properties_table[(0)]))
+       set $ptr_to_val = (zval*)((char*)$pi->ce->default_properties_table + $pi->offset - $initial_offset)
        printf "[%p] {\n", $pi
+       printf "    offset = %p\n", $pi->offset
        printf "    ce = [%p] %s\n", $pi->ce, $pi->ce->name->val
-       printf "    flags = %d (", $pi->flags
+       printf "    flags = 0x%x (", $pi->flags
        if $pi->flags & 0x100
                printf "ZEND_ACC_PUBLIC"
        else
@@ -485,7 +488,11 @@ define print_pi
                                printf "ZEND_ACC_PRIVATE"
                        else
                                if $pi->flags & 0x800
-                                       printf "ZEND_ACC_CHANGED"
+                                       printf "ZEND_ACC_EARLY_BINDING"
+                               else
+                                       if $pi->flags & 0x20000
+                                               printf "ZEND_ACC_SHADOW"
+                                       end
                                end
                        end
                end
@@ -493,6 +500,8 @@ define print_pi
        printf ")\n"
        printf "    name  = "
        print_zstr $pi->name
+       printf "    default value: "
+       printzv $ptr_to_val
        printf "}\n"
 end