]> granicus.if.org Git - php/commitdiff
- add print_inh (prints a very simple class tree, ie. extensible)
authorMichael Wallner <mike@php.net>
Fri, 5 May 2006 15:14:37 +0000 (15:14 +0000)
committerMichael Wallner <mike@php.net>
Fri, 5 May 2006 15:14:37 +0000 (15:14 +0000)
- add print_pi (prints property_info)
- add ____print_str (print strings binary safely, for hash keys etc)

.gdbinit

index 3ad39d44e775d38034907235738559e90e963549..c08018e2d038772233b315bd7b2ac2c5933a2e64 100644 (file)
--- a/.gdbinit
+++ b/.gdbinit
@@ -119,7 +119,8 @@ define ____printzv_contents
                set $type = 0
        end
        if $type == 6
-               printf "string(%d): \"%s\"", $zvalue->value.str.len, $zvalue->value.str.val
+               printf "string(%d): ", $zvalue->value.str.len
+               ____print_str $zvalue->value.str.val $zvalue->value.str.len
        end
        if $type == 7
                printf "resource: #%d", $zvalue->value.lval
@@ -167,8 +168,9 @@ define ____print_const_table
                        set $i = $i - 1
                end
 
-               if $p->nKeyLength > 0 
-                       printf "\"%s\" => ", $p->arKey
+               if $p->nKeyLength > 0
+                       ____print_str $p->arKey $p->nKeyLength
+                       printf " => "
                else
                        printf "%d => ", $p->h
                end
@@ -198,8 +200,9 @@ define ____print_ht
                        set $i = $i - 1
                end
 
-               if $p->nKeyLength > 0 
-                       printf "\"%s\" => ", $p->arKey
+               if $p->nKeyLength > 0
+                       ____print_str $p->arKey $p->nKeyLength
+                       printf " => "
                else
                        printf "%d => ", $p->h
                end
@@ -233,8 +236,9 @@ define ____print_ft
                        set $i = $i - 1
                end
 
-               if $p->nKeyLength > 0 
-                       printf "\"%s\" => ", (char*)$p->arKey
+               if $p->nKeyLength > 0
+                       ____print_str $p->arKey $p->nKeyLength
+                       printf " => "
                else
                        printf "%d => ", $p->h
                end
@@ -255,6 +259,75 @@ document print_ft
        dumps a function table (HashTable)
 end
 
+define print_inh
+       set $ce = $arg0
+       set $depth = 0
+       while $ce != 0
+               set $tmp = $depth
+               while $tmp != 0
+                       printf " "
+                       set $tmp = $tmp - 1
+               end
+               printf "class %s", $ce->name
+               if $ce->parent != 0
+                       printf " extends %s", $ce->parent->name
+               end
+               printf " {\n"
+               set $depth = $depth + 1
+               set $ce = $ce->parent
+       end
+       while $depth != 0
+               set $tmp = $depth
+               while $tmp != 1
+                       printf " "
+                       set $tmp = $tmp - 1
+               end
+               printf "}\n"
+               set $depth = $depth - 1
+       end
+end
+
+define print_pi
+       set $pi = $arg0
+       printf "[0x%08x] {\n", $pi
+       printf "    h     = %lu\n", $pi->h
+       printf "    flags = %d (", $pi->flags
+       if $pi->flags & 0x100
+               printf "ZEND_ACC_PUBLIC"
+       else
+               if $pi->flags & 0x200
+                       printf "ZEND_ACC_PROTECTED"
+               else
+                       if $pi->flags & 0x400
+                               printf "ZEND_ACC_PRIVATE"
+                       else
+                               if $pi->flags & 0x800
+                                       printf "ZEND_ACC_CHANGED"
+                               end
+                       end
+               end
+       end
+       printf ")\n"
+       printf "    name  = "
+       ____print_str $pi->name $pi->name_length
+       printf "\n}\n"
+end
+
+define ____print_str
+       set $tmp = 0
+       set $str = $arg0
+       printf "\""
+       while $tmp < $arg1
+               if $str[$tmp] > 32 && $str[$tmp] < 127
+                       printf "%c", $str[$tmp]
+               else
+                       printf "\\%o", $str[$tmp]
+               end
+               set $tmp = $tmp + 1
+       end
+       printf "\""
+end
+
 define printzn
        ____executor_globals
        set $ind = 0