186d7f5d3SJohn Marino# Examples of using gdb's command language to print out various gdb data 286d7f5d3SJohn Marino# structures. 386d7f5d3SJohn Marino 486d7f5d3SJohn Marinodefine list-objfiles 586d7f5d3SJohn Marino set $obj = object_files 686d7f5d3SJohn Marino printf "objfile bfd msyms name\n" 786d7f5d3SJohn Marino while $obj != 0 886d7f5d3SJohn Marino printf "0x%-8x 0x%-8x %6d %s\n", $obj, $obj->obfd, \ 986d7f5d3SJohn Marino $obj->minimal_symbol_count, $obj->name 1086d7f5d3SJohn Marino set var $obj = $obj->next 1186d7f5d3SJohn Marino end 1286d7f5d3SJohn Marinoend 1386d7f5d3SJohn Marinodocument list-objfiles 1486d7f5d3SJohn MarinoPrint a table of the current objfiles. 1586d7f5d3SJohn Marinoend 1686d7f5d3SJohn Marino 1786d7f5d3SJohn Marinodefine print-values 1886d7f5d3SJohn Marino printf "Location Offset Size Lazy Contents0-3 Lval\n" 1986d7f5d3SJohn Marino set $val = $arg0 2086d7f5d3SJohn Marino while $val != 0 2186d7f5d3SJohn Marino printf "%8x %6d %10d %4d %12x ", $val->location.address, \ 2286d7f5d3SJohn Marino $val->offset, \ 2386d7f5d3SJohn Marino $val->type->length, $val->lazy, $val->aligner.contents[0] 2486d7f5d3SJohn Marino output $val->lval 2586d7f5d3SJohn Marino printf "\n" 2686d7f5d3SJohn Marino set $val = $val->next 2786d7f5d3SJohn Marino end 2886d7f5d3SJohn Marinoend 2986d7f5d3SJohn Marinodocument print-values 3086d7f5d3SJohn MarinoPrint a list of values. 3186d7f5d3SJohn MarinoTakes one argument, the value to print, and prints all the values which 3286d7f5d3SJohn Marinoare chained through the next field. Thus the most recently created values 3386d7f5d3SJohn Marinowill be listed first. The "Contents0-3" field gives the first "int" 3486d7f5d3SJohn Marinoof the VALUE_CONTENTS; not the entire contents. 3586d7f5d3SJohn Marinoend 36