define count_blocks set var $block=$arg0 set var $count=0 set var $size=0 set var $used=0 while $block set var $count++ set var $size += $block->end - $block->start set var $used += $block->free - $block->start end output $count echo blocks; output $size echo b allocated; output $used echo b used. end document count_blocks Count the number of blocks in a chain, and compute their total size. usage: count_blocks EXPR EXPR should have type 'struct block *'. example: (gdb) count_blocks generation[0].from_space end