Archive

Archive for August, 2014

helpful GDB macro

August 7th, 2014
Comments Off on helpful GDB macro

The fundamental data structure in ROMIO is the “flattened representation” of a dataype: this list of  “offset-length” pairs describes any MPI datatype, if perhaps at the cost of memory and computational overhead.  For years I have been linking in little utility functions to dump out these lists.  Turns out GDB macros can do this for me.  I added this to my .gdbinit:


define dump_flattened
set $flat = $arg0
set $i = 0
while $i < $flat->count
printf "(%ld, %ld)", $flat->indices[$i], $flat->blocklens[$i]
set $i = $i + 1
end
printf "\n"
end
document dump_flattened
Display ROMIO flattened representations (offset-length pairs) of datatypes
example usage: dump_flattened flat_type
end

then in gdb I can simply invoke ‘dump_flattened’ on the flat list node:

(gdb) p flat_buf
$1 = (ADIOI_Flatlist_node *) 0x638b68
(gdb) dump_flattened flat_buf
(0, 1296)(0, 1296)(0, 1296)

Hopefully future ROMIO hackers will benefit from this sooner than I did.

(note: an earlier version of this post had a bug in it that did not increment the blocklens[] index)

development