[fpc-pascal] Calling unassigned procedure gives no stack trace with -gl

Peter Vreman peter at freepascal.org
Thu Jul 14 10:27:01 CEST 2005


> On Thu, Jul 14, 2005 at 01:12:23AM +0200, Marcel Martin wrote:
>> Tom Verhoeff a écrit :
>> >begin
>> >  VMyClass := TMyClass.Create;
>> >  //VMyClass.FP := VMyClass.P;  { with this assignment, it works }
>> >  VMyClass.FP;  { this causes an Access Violation }
>>
>> Of course, at this point FP = nil since you didn't set it.
>
> Just in case, I was not understood:
>
> The point is that there is no stack trace with line numbers on the
> (obviously correct) exception, in spite of the option -gl (even when
> explicitly using SysUtils).

The problem is that the framepointer register EBP is 0 in the sigcontext.
We can't solve this.

(gdb) bt
#0  CATCHUNHANDLEDEXCEPTION (OBJ=0x40060054, ADDR=0x0, FRAMECOUNT=0,
FRAMES=0x0) at sysutils.inc:206
#1  0x0805275c in DOUNHANDLEDEXCEPTION () at except.inc:168
#2  0x08052bae in fpc_reraise () at except.inc:278
#3  0x080869af in RUNERRORTOEXCEPT (ERRNO=216, ADDRESS=0x0, FRAME=0x0) at
sysutils.inc:225
#4  0x0805515e in HANDLEERRORADDRFRAME (ERRNO=216, ADDR=0x0, FRAME=0x0) at
system.inc:677
#5  0x0805d50d in SIGNALTORUNERROR (SIG=11, SIGINFO=0xbffff598,
SIGCONTEXT=0xbffff618) at sighnd.inc:73
#6  <signal handler called>
#7  0x00000000 in ?? ()
#8  0x08048117 in main () at p.pp:24
(gdb) dir ~/fpc/rtl/linux/i386
Source directories searched: /home/pvreman/fpc/rtl/linux/i386:$cdir:$cwd
(gdb) l
24        VMyClass.FP;  { this causes an Access Violation }
25      end.
(gdb) fr 5
#5  0x0805d50d in SIGNALTORUNERROR (SIG=11, SIGINFO=0xbffff598,
SIGCONTEXT=0xbffff618) at sighnd.inc:73
73         
HandleErrorAddrFrame(res,pointer(SigContext^.eip),pointer(SigContext^.ebp));
(gdb) p sigcontext
$1 = (PSIGCONTEXT) 0xbffff618
(gdb) p sigcontext^
$2 = {GS = 0, __GSH = 0, FS = 0, __FSH = 0, ES = 0, __ESH = 0, DS = 2,
__DSH = 0, EDI = 0, ESI = 0, EBP = 0, ESP = 123, EBX = 123,
  EDX = 134932428, ECX = 0, EAX = 3221223688, TRAPNO = 3221223684, ERR =
67584, EIP = 0, CS = 63724, __CSH = 49151, EFLAGS = 0,
  ESP_AT_SIGNAL = 14, SS = 4, __SSH = 0, FPSTATE = 0x0, OLDMASK = 115, CR2
= 2163270}






More information about the fpc-pascal mailing list