[fpc-devel] Invalid line-info on array of const
Joost van der Sluis
joost at cnoc.nl
Thu Sep 4 21:52:26 CEST 2014
I think I've found a bug while testing the fpdebug-debugger. The
line-info for the attached program is not entirely correct, I think.
Here's the generated assembly:
#  case i of
#  writeln('hallo');
#  end;
As you can see, according to the line-info the call to FPC_POPADDRSTACK
belongs to the writeln. But the jump in the case goes to label Lj9.
Imaging stepping through this procedure. When the writeln is skipped,
the 'call fpc_popaddrstack' is the next command. And the debugger will
think that the 'writeln' is the current command. (ie: the debugger jumps
from line 12 to 18. Even if line 18 is never executed)
Gdb does not show this. I think because it also checks if the current
instruction pointer is at the start of the line as given in the debug
info. FpDebug also does that check in some cases, but not in this case
since it should not be necessary. At least so I thought.
I can add this check to the debugger anyway, but am I right that the
line info in the example is wrong? Then I can try to fix it.
-------------- next part --------------
function Test: string;
i := 0;
case i of
if false then
More information about the fpc-devel