Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-06

ExceptAddrStack FRAMETYPE=1 ?

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin

I am still stuck on this issue.

I don't know if fpc_reraise has been entered while it should not; or if the data was corrupted.

What does FRAMETYPE = 1 mean?

Should it expect an ExceptionObject? Should it be on top of the frame list, when in fpc_reraise?

Or does it indicate that fpc_reraise was called where it should not have been called?
What could trigger it to be called?

Best Regards
Martin

Martin wrote 30 lines
I am one tiny step forward.. The SigSegV happens in fpc_ReRaise; => but the actual error must have been introduced further up. Procedure fpc_ReRaise;[Public, Alias : 'FPC_RERAISE']; compilerproc; var _ExceptAddrStack : PExceptAddr; begin {$ifdef excdebug} writeln ('In reraise'); {$endif} _ExceptAddrStack:=ExceptAddrStack; If _ExceptAddrStack=Nil then DoUnHandledException; ExceptObjectStack^.refcount := 0; //<<<<<<<<<<<<<<<<< longjmp(_ExceptAddrStack^.Buf^,FPC_Exception); end; This is RTL (and compiled with -O1 => it doesn't use regvar), so I should be able to trust variables here. (I also checked the assembler view, and memory/registers...) - ExceptObjectStack is nil => So the line marked raises a SigSegV. - ExceptAddrStack is not nil => so DoUnHandledException was not called The question is, any hints where to concentrate looking, in order to find out, how this can end up with a nil pointer there?

The content of ExceptAddrStack

record TEXCEPTADDR {
BUF = $a3ef728,
NEXT = $a3ef768,
FRAMETYPE = 1}

Reply by email

Sergei Gorelkin
to Martin
Martin wrote
I am still stuck on this issue. I don't know if fpc_reraise has been entered while it should not; or if the data was corrupted.

Normally you should be able to figure it out by examining the call stack/backtrace.

What does FRAMETYPE = 1 mean?

Guess it is the value of FPC_EXCEPTION (trunk/rtl/inc/except.inc), the only currently available/supported value for FrameType.

Show quoted text 6 lines
Should it expect an ExceptionObject? Should it be on top of the frame list, when in fpc_reraise? Or does it indicate that fpc_reraise was called where it should not have been called? What could trigger it to be called?

First, as the name suggests, it's triggered by a 'raise' keyword in a try..except block. Second, and more important, any try..finally block (including the implicit ones) contains a call to fpc_reraise. It is translated into:

try
    <body>
except
    <finalization statements>
    raise;  <-- implies fpc_reraise
end;

Regards,
Sergei

Show quoted text 39 lines
On 09/06/2010 18:42, Martin wrote: > > I am one tiny step forward.. > > The SigSegV happens in fpc_ReRaise; => but the actual error must have > been introduced further up. > > Procedure fpc_ReRaise;[Public, Alias : 'FPC_RERAISE']; compilerproc; > var > _ExceptAddrStack : PExceptAddr; > begin > {$ifdef excdebug} > writeln ('In reraise'); > {$endif} > _ExceptAddrStack:=ExceptAddrStack; > If _ExceptAddrStack=Nil then > DoUnHandledException; > ExceptObjectStack^.refcount := 0; //<<<<<<<<<<<<<<<<< > longjmp(_ExceptAddrStack^.Buf^,FPC_Exception); > end; > > > This is RTL (and compiled with -O1 => it doesn't use regvar), so I > should be able to trust variables here. (I also checked the assembler > view, and memory/registers...) > > - ExceptObjectStack is nil => So the line marked raises a SigSegV. > - ExceptAddrStack is not nil => so DoUnHandledException was not called > > The question is, any hints where to concentrate looking, in order to > find out, how this can end up with a nil pointer there? The content of ExceptAddrStack record TEXCEPTADDR { BUF = $a3ef728, NEXT = $a3ef768, FRAMETYPE = 1}

Reply by email

Sven Barth
to Sergei Gorelkin

Hi!

Sergei Gorelkin wrote 5 lines
> What does FRAMETYPE = 1 mean? > Guess it is the value of FPC_EXCEPTION (trunk/rtl/inc/except.inc), the only currently available/supported value for FrameType.

If I remember my analysis of FPC's exception system correctly, this field is not the type of the exception (e.g. FPC_EXCEPTION), but the type of the handler, e.g. cExceptionFrame=1 or cFinalizeFrame=2 (both defined in rtl/inc/except.inc).

Regards,
Sven

Reply by email