| 1 | # Examples of using gdb's command language to print out various gdb data |
| 2 | # structures. |
| 3 | |
| 4 | define 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 |
| 12 | end |
| 13 | document list-objfiles |
| 14 | Print a table of the current objfiles. |
| 15 | end |
| 16 | |
| 17 | define 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 |
| 28 | end |
| 29 | document print-values |
| 30 | Print a list of values. |
| 31 | Takes one argument, the value to print, and prints all the values which |
| 32 | are chained through the next field. Thus the most recently created values |
| 33 | will be listed first. The "Contents0-3" field gives the first "int" |
| 34 | of the VALUE_CONTENTS; not the entire contents. |
| 35 | end |