in reply to how to write a program to control gdb

I'm sure it must be possible using, but last time I tried this (a few years ago) I didn't get very far, and it seemed easiest to use Perl to glue a TCL-style expect script and do the post-processing, as in this script which I used to generate a labelled disassembly of one function of a program.

I can't remember now what problems I had with - it may be related to the fact that I learnt TCL before perl, and had used expect extensively in that period.