automated trace output with gdb

Edward Peschko
Wed Oct 29 19:03:00 GMT 2008

Ok, I'm trying it, and it seems to be working - so far, speed isn't
really that great (ie: perl's tracemode in *its* debugger is faster,
line per line, in tracing perl code), but it's workable, with caveat.
For some things it'd be really painful (eg: debugging vim)

Just for future record, here are the commands that I used, and they
have to be done in the right order:

(gdb) set logging redirect on
(gdb) set logging file 'myfile'
(gdb) set logging on
(gdb) set pagination off
(gdb) b <certain_point>
(gdb) while 1
> step
> end

If they aren't in this order, then the behavior is indeterminate, and
if pagination isn't set off, you get 'hit <return> to continue' even
though everything else goes to the file..

I don't know - all in all, IMO this should be a feature of gdb itself,
just for simplicity's sake, and to avoid the overhead of the scripting
language. I'm just guessing, but I'd bet that if this was done in a
tight loop, it would be an order of magnitude faster..



On Wed, Oct 29, 2008 at 10:57 AM, Michael Snyder <> wrote:
> Edward Peschko wrote:
>> Michael,
>> Just curious, but how do you redirect the output to a file using that
>> script?
> Set logging, set logging file...
>> And how fast is it (ie: say I'm stepping through thousands of
>> steps.)
> Well... it's as fast as it is.  The only way to find out
> if it's fast enough to suit you is to try it.

More information about the Gdb mailing list