{"id":137,"date":"2014-08-07T22:13:06","date_gmt":"2014-08-07T22:13:06","guid":{"rendered":"http:\/\/press3.mcs.anl.gov\/romio\/?p=137"},"modified":"2014-08-07T22:13:06","modified_gmt":"2014-08-07T22:13:06","slug":"helpful-gdb-macro","status":"publish","type":"post","link":"https:\/\/wordpress.cels.anl.gov\/romio\/2014\/08\/07\/helpful-gdb-macro\/","title":{"rendered":"helpful GDB macro"},"content":{"rendered":"<p>The fundamental data structure in ROMIO is the &#8220;flattened representation&#8221; of a dataype: this list of\u00a0 &#8220;offset-length&#8221; pairs describes any MPI datatype, if perhaps at the cost of memory and computational overhead.\u00a0 For years I have been linking in little utility functions to dump out these lists.\u00a0 Turns out GDB macros can do this for me.\u00a0 I added this to my .gdbinit:<br \/>\n<code><br \/>\ndefine dump_flattened<br \/>\nset $flat = $arg0<br \/>\nset $i = 0<br \/>\nwhile $i &lt; $flat-&gt;count<br \/>\nprintf \"(%ld, %ld)\", $flat-&gt;indices[$i], $flat-&gt;blocklens[$i]<br \/>\nset $i = $i + 1<br \/>\nend<br \/>\nprintf \"\\n\"<br \/>\nend<br \/>\ndocument dump_flattened<br \/>\nDisplay ROMIO flattened representations (offset-length pairs) of datatypes<br \/>\nexample usage: dump_flattened flat_type<br \/>\nend<\/code><br \/>\nthen in gdb I can simply invoke &#8216;dump_flattened&#8217; on the flat list node:<br \/>\n<code><br \/>\n(gdb) p flat_buf<br \/>\n$1 = (ADIOI_Flatlist_node *) 0x638b68<br \/>\n(gdb) dump_flattened flat_buf<br \/>\n(0, 1296)(0, 1296)(0, 1296)<br \/>\n<\/code><br \/>\nHopefully future ROMIO hackers will benefit from this sooner than I did.<br \/>\n(note: an earlier version of this post had a bug in it that did not increment the blocklens[] index)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The fundamental data structure in ROMIO is the &#8220;flattened representation&#8221; of a dataype: this list of\u00a0 &#8220;offset-length&#8221; pairs describes any MPI datatype, if perhaps at the cost of memory and computational overhead.\u00a0 For years I have been linking in little utility functions to dump out these lists.\u00a0 Turns out GDB macros can do this for &hellip;<\/p>\n","protected":false},"author":362,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-137","post","type-post","status-publish","format-standard","hentry","category-development"],"acf":[],"_links":{"self":[{"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/posts\/137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/comments?post=137"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/posts\/137\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/media?parent=137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/categories?post=137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/tags?post=137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}