[fpc-pascal] How to get to Range Check Error location

Juha Manninen (gmail) juha.manninen62 at gmail.com
Sun Oct 3 09:10:34 CEST 2010


On Saturday 02 October 2010 17:47:27 José Mejuto wrote:
> The assembly window in Lazarus is shown when no backtrace line is
> available to point the cursor in, so open callstack "View -> Debug ->
> Callstack" and you will see that there is no available backtrace,
> maybe except the fpc sources without debug information (you will see
> some, usually 3, function names). The backtrace is often damaged when
> memory corruption happends and usually calling a non initialized
> object and not nil of course (as freed objects with heaptrc are
> signaled with a magic number).

Right. I finally found some errors.

One was a real error in my code, freeing an object twice, which happened 
seldom. For some reason Lazarus could not take me to its source line either. 
FPC output showed the place one level up in the call stack.

Lazarus Debugger code causes one range error which can be fixed with a 
typecast. FPC showed the point clearly. Issue #0017537.

TApplication.HandleException Range check error
  Stack trace:
  $000000000115AA93 line 1541 of ../debugger/gdbmidebugger.pp
  $0000000000786075
  $00000000011678C7 line 3884 of ../debugger/gdbmidebugger.pp
  $0000000000E53D13 line 1819 of ../debugger/debugger.pp
...

I think this is a Lazarus specific problem but I always get RunError(216) 
window when there is a range error. Sometimes I get a SIGSEGV window, too, 
while there is only a range error.

Juha



More information about the fpc-pascal mailing list