Programm Execution Tracing with GDB

Ok found another problem in tinycc, the __attribute__ handling code gets confused by parentheses, sent a fix to tinycc-devel.

The next issue I faced is a bit more complex, there seams to be a bug with nested struct/union initialization.

While debugging this I looked for a way to get an exact trace of the lines which are executed. So I ended up writing this little shell script, which makes gdb looping over every program step by sending the appropriate command to its stdin.

#!/bin/sh

gdb --args $* <<EOF
    break main
    run
    while 1
        step
    end
    quit
EOF

Don’t know how useful this will be because the amount of generated data is quite large. Anyway the GNU GDB Online Documentation is a good place to search for information about gdb commands (what a surprise ;).

Marc