mike            Fri May  5 15:14:37 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src    .gdbinit 
  Log:
  - add print_inh (prints a very simple class tree, ie. extensible)
  - add print_pi (prints property_info)
  - add ____print_str (print strings binary safely, for hash keys etc)
  
http://cvs.php.net/viewcvs.cgi/php-src/.gdbinit?r1=1.10.4.1&r2=1.10.4.2&diff_format=u
Index: php-src/.gdbinit
diff -u php-src/.gdbinit:1.10.4.1 php-src/.gdbinit:1.10.4.2
--- php-src/.gdbinit:1.10.4.1   Wed Mar  8 23:54:43 2006
+++ php-src/.gdbinit    Fri May  5 15:14:37 2006
@@ -119,7 +119,8 @@
                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 @@
                        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 @@
                        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 @@
                        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 @@
        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

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to