[Lazarus] What lines of a project run

Martin Frb lazarus at mfriebe.de
Mon Aug 10 22:25:15 CEST 2015


On 10/08/2015 19:46, Aradeonas wrote:
> I want to know executed lines,I dont care about debugging in the mean
> time but I want to know what lines will executed,debugger know that so
> there should be a way to get this from it.
Actually the debugger does not always know what lines were executed. 
(But feel free to read the gdb docs)

It only:
- has a list of *all* liens that are in the exe, and that may or may not 
be executed.
- it knows when a line with a breakpoint is hit
- it knows when and which lines are single stepped.
If you use run (instead of step) between breakpoints, then which of the 
lines in between were executed is not known.

Now of course you can single step the entire app (or set breakpoints on 
al lines). Then you will get this list. But as I said, with the current 
gdb based debugger, that will be incredible slow.
(valgrind does the single stepping, but it does not have the overhead of 
interprocess communication between IDE and gdb)

Well newer gdb actually have a record mode, but not on all platforms. 
And I do not know if they allow to query the executed lines. The data is 
used for reverse execution. Anyway that is not available inside the IDE.

You can probably get a standalone gdb to do the singlestepping. Not sure 
but I guess it will still be slower than valgrind.

Again it can be added to the new fpdebug. But someone needs to do that. 
In fact it would be nice. Coverage is an important factor of testcases 
for example.


> >From the time I start programming years ago I like to know the lines
> will executed,its sometimes useful and also interesting.
Well you can always start the app in the debugger, and single step (set 
a breakpoint at the start, press F9 to run, then F7 and continue with 
f7, F7, F7, ....)
It will take forever, but you see every line that is executed .

Just make sure (in the options) that the project, and all packages of 
interest have debug info enabled.

However single stepping does not create a "logfile" of all lines.





More information about the Lazarus mailing list