summaryrefslogtreecommitdiff
path: root/.gdbinit
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2014-05-29 12:47:40 +0200
committerNikita Popov <nikic@php.net>2014-05-29 12:47:40 +0200
commitd1ae74a1a56bccc9a57fbb54f90db63746eaa92f (patch)
tree742234647d607e701d8f7fc1fc39dfaa2ed26da0 /.gdbinit
parent47e85b1b354bae083e51bce7396d1a2ac1c77161 (diff)
downloadphp-git-d1ae74a1a56bccc9a57fbb54f90db63746eaa92f.tar.gz
Improve gdb ht and zval dumps
Diffstat (limited to '.gdbinit')
-rw-r--r--.gdbinit124
1 files changed, 46 insertions, 78 deletions
diff --git a/.gdbinit b/.gdbinit
index 4bad7dee79..f0575f7d67 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -167,11 +167,11 @@ define ____printzv_contents
set $zvalue = $arg0
set $type = $zvalue->u1.v.type
- if $type >= 7
+ # 15 == IS_INDIRECT
+ if $type >= 5 && $type != 15
printf "(refcount=%d) ", $zvalue->value.counted->refcount
- else
- printf "(refcount=NaN) "
- end
+ end
+
if $type == 0
printf "UNDEF"
end
@@ -194,7 +194,7 @@ define ____printzv_contents
printf "string: %s", $zvalue->value.str->val
end
if $type == 7
- printf "array: ", $zvalue->value.arr->ht.nNumUsed
+ printf "array: "
if ! $arg1
set $ind = $ind + 1
____print_ht $zvalue->value.ht 1
@@ -322,82 +322,50 @@ define ____print_ht
printf " "
set $n = $n - 1
end
- if $ht->u.v.flags & 4
- set $num = $ht->nNumUsed
- set $i = 0
- printf "Packed(%d)[%p]: {\n", $ht->nNumOfElements, $ht
- set $ind = $ind + 1
- while $i < $num
- set $p = (Bucket*)($ht->arData + $i)
- set $n = $ind
- if $p->val.u1.v.type > 0
- while $n > 0
- printf " "
- set $n = $n - 1
- end
- printf "[%d]", $i
+
+ if $ht->u.v.flags & 4
+ printf "Packed"
+ else
+ printf "Hash"
+ end
+ printf "(%d)[%p]: {\n", $ht->nNumOfElements, $ht
+
+ set $num = $ht->nNumUsed
+ set $i = 0
+ set $ind = $ind + 1
+ while $i < $num
+ set $p = (Bucket*)($ht->arData + $i)
+ set $n = $ind
+ if $p->val.u1.v.type > 0
+ while $n > 0
+ printf " "
+ set $n = $n - 1
+ end
+ printf "[%d] ", $i
+ if $p->key
+ printf "%s => ", $p->key->val
+ else
printf "%d => ", $p->h
- if $arg1 == 0
- printf "%p\n", (zval *)&$p->val
- end
- if $arg1 == 1
- set $zval = (zval *)&$p->val
- ____printzv $zval 1
- end
- if $arg1 == 2
- printf "%s\n", (char*)$p->val.value.ptr
- end
- if $arg1 == 3
- set $func = (zend_function*)$p->val.value.ptr
- printf "\"%s\"\n", $func->common.function_name->val
- end
end
- set $i = $i + 1
- end
- set $ind = $ind - 1
- printf "}\n"
- else
- set $num = $ht->nTableSize
- set $i = 0
- printf "Hash(%d)[%p]: {\n", $ht->nNumOfElements, $ht
- set $ind = $ind + 1
- while $i < $num
- set $hash = $ht->arHash[$i]
- if $hash != -1
- set $p = (Bucket*)($ht->arData + $hash)
- if $p->val.u1.v.type > 0
- set $n = $ind
- while $n > 0
- printf " "
- set $n = $n - 1
- end
- printf "[%d]", $i
- if $p->key
- printf "%s => ", $p->key->val
- else
- printf "%d => ", $p->h
- end
- if $arg1 == 0
- printf "%p\n", (zval *)&$p->val
- end
- if $arg1 == 1
- set $zval = (zval *)&$p->val
- ____printzv $zval 1
- end
- if $arg1 == 2
- printf "%s\n", (char*)$p->val.value.ptr
- end
- if $arg1 == 3
- set $func = (zend_function*)$p->val.value.ptr
- printf "\"%s\"\n", $func->common.function_name->val
- end
- end
+ if $arg1 == 0
+ printf "%p\n", (zval *)&$p->val
end
- set $i = $i + 1
- end
- set $ind = $ind - 1
- printf "}\n"
- end
+ if $arg1 == 1
+ set $zval = (zval *)&$p->val
+ ____printzv $zval 1
+ end
+ if $arg1 == 2
+ printf "%s\n", (char*)$p->val.value.ptr
+ end
+ if $arg1 == 3
+ set $func = (zend_function*)$p->val.value.ptr
+ printf "\"%s\"\n", $func->common.function_name->val
+ end
+ end
+ set $i = $i + 1
+ end
+ set $ind = $ind - 1
+ printf "}\n"
end
define print_ht