Programm Execution Tracing with GDB
Ok found another problem in tinycc, the __attribute__ handling code gets confused by parenthesis, 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
Comments (3)
hrmm, nice but
hi there; i386-marcel-freebsd (6.1.1) Hangup detected on fd 0 error detected on stdin However, if I run the commands directly in gdb it works(tm)
strange - works here
Strange works here under Debian GNU/Linux, anyway if you find a better way to do it just send me a mail. Thanks, Marc
cant get it working
Hi, after working this out myself, I found your post. But I couldnt get what you had working in linux, was some glitch with gdb... not sure exactly. Anyhow, heres how I managed to do the same thing with gdb http://wiki.blender.org/index.php/User:Ideasman42#Program_Execution_Tracing