From 78d11cbc705651cb645d80c04923f546d85b3753 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 5 May 2006 15:14:37 +0000 Subject: - 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) --- .gdbinit | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 7 deletions(-) (limited to '.gdbinit') diff --git a/.gdbinit b/.gdbinit index 3ad39d44e7..c08018e2d0 100644 --- 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 -- cgit v1.2.1