Re: questions / suggestions about gdb

Andrew Cagney
2002-05-07T22:02:08Z

> Daniel Jacobowitz wrote:
>
>
>> can i activate the 'generate-core-file' a few steps before the program
>> breaks?
>
> Whenever you want to; you just issue the command, and then you can come
> back to look at the core file later.
>
>
> my question is; how the debugger would automatically know that three steps further the program will break and generate a core file; i guess to generate core files on every (say, 100 steps) could help a lot too.

In theory .... In addition to saving the internal state of the program,
you'll need to record all the external state and any additional I/O that
the running program performs. That way you can exactly replay that
program's behavour (this gets tricky when you're trying to to timers
just right). I suspect you'd end up having to use a simulator for this.
Alternativly, you can ignore the external state problem and get
something working most of the time (via something like fork()?).

Another possability is to have GDB use its builtin-simulator to look
ahead a few instructions at what the inferior would do given its current
state. Provided the simulator doesn't modify the inferior (debugged
process) nor do I/O it shouldn't affect the program that is running.

enjoy,
Andrew