[fpc-devel] Signal handlers

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Jul 18 14:07:30 CEST 2007


On 17 Jul 2007, at 23:43, Micha Nelissen wrote:

> SignalToRunError is a signal handler, but it calls an ErrorProc  
> calling
> many functions, like CRelocateThreadVar (for accessing the exception
> stack), GetMem (to allocate an exception object); are these functions
> guaranteed to run correctly in a signal handler ?

Probably not. For darwin/ppc, I actually do it differently (for  
another reason, but that's not relevant here): I change the signal  
context to return to HandleErrorAddrFrame, putting the required  
parameters (runerror number, program counter/instruction pointer,  
stack pointer) in the parameter registers of the context.

Since there are only 3 parameters, it should be possible to do this  
even on i386.


Jonas



More information about the fpc-devel mailing list