automated trace output with gdb

Edward Peschko
Wed Oct 29 17:58:00 GMT 2008


Just curious, but how do you redirect the output to a file using that
script? And how fast is it (ie: say I'm stepping through thousands of

Basically, what I'm looking to do is take a inkblot test of a
program.. ie: do one thing, record it, do another, record it, and then
look at the difference..



On Wed, Oct 29, 2008 at 10:11 AM, Michael Snyder <> wrote:
> Edward Peschko wrote:
>> All,
>> Solaris' dbx had the ability to record runs of programs - ie: you
>> could say 'trace step' and you could then see - printed out - all the
>> lines of code execute as the debugger executed them..
>> Does gdb have something similar? I see the concept of tracepoints, but
>> that's not exactly what I had in mind.. I just want a running
>> commentary of the code as it runs, without having to press 'n' and/or
>> 's' all the time.. Could this be implemented in terms of tracepoints?
> First of all, I don't think tracepoints are related.
> What you ask is not a built-in feature of gdb, but
> I often do something like it by writing a short gdb
> script.  For a not-very-general example, I'll do
> something like:
>  set $foo = 100
>  while $foo--
>    step
>  end
> You could make $foo a parameter, or you could define some
> more useful condition for stopping.  You could also use
> "while 1" if you wanted it to run forever.

More information about the Gdb mailing list