summaryrefslogtreecommitdiff
path: root/.gdbinit
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2003-04-06 18:40:19 (GMT)
committerMoriyoshi Koizumi <moriyoshi@php.net>2003-04-06 18:40:19 (GMT)
commit33fb9a6cdbbf052ea2d5e044e32ec244504377a5 (patch)
treed257453d5e230da7eb3c4c7ff7c9c2f753c260f5 /.gdbinit
parente184a55bf4e249173fd8c31d28ffb006992fe73b (diff)
downloadphp-33fb9a6cdbbf052ea2d5e044e32ec244504377a5.tar.gz
Improved zmemcheck macro so it displays the size of each memory block too.
Diffstat (limited to '.gdbinit')
-rw-r--r--.gdbinit16
1 files changed, 14 insertions, 2 deletions
diff --git a/.gdbinit b/.gdbinit
index 50eec27..75b32bf 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -213,12 +213,13 @@ end
define zmemcheck
set $p = alloc_globals.head
set $stat = "?"
+ set $total_size = 0
if $arg0 != 0
set $not_found = 1
else
set $not_found = 0
end
- printf " block status file:line\n"
+ printf " block size status file:line\n"
printf "-------------------------------------------------------------------------------\n"
while $p
set $aptr = $p + sizeof(struct _zend_mem_header) + sizeof(align_test)
@@ -238,7 +239,14 @@ define zmemcheck
else
set $filename = $filename + 1
end
- printf " 0x%08x %-06s %s:%d", $aptr, $stat, $filename, $p->lineno
+ printf " 0x%08x ", $aptr
+ if $p->size == sizeof(struct _zval_struct) && ((struct _zval_struct *)$aptr)->type >= 0 && ((struct _zval_struct *)$aptr)->type < 10
+ printf "ZVAL?(%-2d) ", $p->size
+ else
+ printf "%-9d ", $p->size
+ end
+ set $total_size = $total_size + $p->size
+ printf "%-06s %s:%d", $stat, $filename, $p->lineno
if $p->orig_filename
set $orig_filename = strrchr($p->orig_filename, '/')
if !$orig_filename
@@ -263,6 +271,10 @@ define zmemcheck
if $not_found
printf "no such block that begins at 0x%08x.\n", $aptr
end
+ if $arg0 == 0
+ printf "-------------------------------------------------------------------------------\n"
+ printf " total: %d bytes\n", $total_size
+ end
end
document zmemcheck