Re: Possible to record program execution
Tom Tromey <[email protected]> Fri, 22 Oct 2010 13:27:05 -0600
| Newsgroups | gmane.comp.gdb.general |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "Paul" == ppmoore <[email protected]> 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