gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible to record program execution


From: Tom Tromey
Subject: Re: Possible to record program execution
Date: Fri, 22 Oct 2010 13:27:05 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>>>>> "Paul" == ppmoore  <address@hidden> writes:

Paul> I set a breakpoint at a point in the code, and start the program.
Paul> The breakpoint is reached and the program stops.
Paul> When I try step over the breakpoint to the next line of code, GDB
Paul> immediately indicates that the program executed normally, the intervening
Paul> lines of code are not executed.

Did you compile with -g?
I think that is the most common reason for this behavior.

Paul> To track it down, I would like to do record lines of code executed. 
Paul> Something like the following:
Paul> - set the breakpoint as mentioned above, and start the program
Paul> - the breakpoint is reached
Paul> - set a breakpoint at exit(), and then somehow record all lines of code
Paul> executed up to the point where the program exits
Paul> - when the exit() breakpoint is reached, examine the recorded trace of the
Paul> program execution, line by line. AFAIK, the trace command can't do this.

Paul> Is this possible?

It is possible, though not readily, depending on what you want to trace.
The simplest thing is:

  while 1
    step
  end

... but that is going to be very slow and print mostly useless
information.

Tom



reply via email to

[Prev in Thread] Current Thread [Next in Thread]