[fpc-pascal]No line numbers shown when Format raises an exception, compiled with -gl
Tom Verhoeff
wstomv at win.tue.nl
Thu Jan 22 09:14:12 CET 2004
Recently, I have been caught a couple of times by mistakes in my
programs using Format (from SysUtils). When the format string and
the supplied arguments do not match, Format raises an exception.
This is nice, but unfortunately, only a hexadecimal address is printed
when the exception is not caught (my programs do not catch this
exception). All the pieces of these programs have been compiled with
-gl under Linux on i386 with 1.0.10 (actually with ppc386 -vwn -gl -O2
-Sd -Ci -Cr -Co -Ct).
It is a small disaster to find out which Format call is in error, if
you have many of them. How can one get line numbers on the uncaught
exception? Shouldn't a normal backtrace be generated, including line
numbers?
Here is a small program and its response:
wstomv at antilope(228) cat formatexception.pp
program FormatException;
uses SysUtils; { for Format }
begin
writeln ( Format ( '%S', [ 1 ] ) ) { 1 is not a string --> ECONVERTERROR }
end.
wstomv at antilope(229) ppc386 -gl -Sd formatexception.pp
Free Pascal Compiler version 1.0.10 [2003/06/26] for i386
Copyright (c) 1993-2003 by Florian Klaempfl
Target OS: Linux for i386
Compiling formatexception.pp
Assembling formatexception
Linking formatexception
7 Lines compiled, 0.3 sec
wstomv at antilope(230) ./formatexception
An unhandled exception occurred at 0x0805093B :
ECONVERTERROR : Invalid argument index in format ""
0x0805093B
Thanks,
Tom
More information about the fpc-pascal
mailing list