1# Examples of using gdb's command language to print out various gdb data 2# structures. 3 4define list-objfiles 5 set $obj = object_files 6 printf "objfile bfd msyms name\n" 7 while $obj != 0 8 printf "0x%-8x 0x%-8x %6d %s\n", $obj, $obj->obfd, \ 9 $obj->minimal_symbol_count, $obj->name 10 set var $obj = $obj->next 11 end 12end 13document list-objfiles 14Print a table of the current objfiles. 15end 16 17define print-values 18 printf "Location Offset Size Lazy Contents0-3 Lval\n" 19 set $val = $arg0 20 while $val != 0 21 printf "%8x %6d %10d %4d %12x ", $val->location.address, \ 22 $val->offset, \ 23 $val->type->length, $val->lazy, $val->aligner.contents[0] 24 output $val->lval 25 printf "\n" 26 set $val = $val->next 27 end 28end 29document print-values 30Print a list of values. 31Takes one argument, the value to print, and prints all the values which 32are chained through the next field. Thus the most recently created values 33will be listed first. The "Contents0-3" field gives the first "int" 34of the VALUE_CONTENTS; not the entire contents. 35end 36