[fpc-pascal] Calling unassigned procedure gives no stack trace with -gl
Tom Verhoeff
T.Verhoeff at tue.nl
Thu Jul 14 00:44:39 CEST 2005
When the following program is compiled with option -gl -Mdelphi
and executed, it results in
An unhandled exception occurred at $00000000 :
EAccessViolation : Access violation
without a stack trace or line numbers. How come? Is that a bug?
(If so, I will submit it as such.)
The problem remains when SysUtils is used as well.
This makes it very awkward to find the source of such unhandled exceptions.
(Something similar seems to happen with incorrect calls to Format.)
Is there any workaround?
Tom
--
program UnassignedProcedureBug;
{ compile with -gl -Mdelphi }
{ causes an unhandled exception (Access Violation) without stack trace }
uses
Classes;
type
TProcedure = procedure of object;
TMyClass = class(TObject)
public
FP: TProcedure;
procedure P;
end;
procedure TMyClass.P;
begin
writeln ( 'P called' )
end;
var
VMyClass: TMyClass;
begin
VMyClass := TMyClass.Create;
//VMyClass.FP := VMyClass.P; { with this assignment, it works }
VMyClass.FP; { this causes an Access Violation }
end.
--
E-MAIL: T.Verhoeff @ TUE.NL | Fac. of Math. & Computing Science
PHONE: +31 40 247 41 25 | Eindhoven University of Technology
FAX: +31 40 247 54 04 | PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/ | The Netherlands
More information about the fpc-pascal
mailing list