[fpc-pascal] catch segfaults

Tomas Hajny XHajT03 at hajny.biz
Thu Mar 14 11:16:54 CET 2013


On Thu, March 14, 2013 09:23, Xiangrong Fang wrote:
> 2013/3/14 Mattias Gaertner <nc-gaertnma at netcologne.de>
>> On Thu, 14 Mar 2013 07:05:21 +0800
>> Xiangrong Fang <xrfang at gmail.com> wrote:
>>
>> > Is it possible to use try...except to catch SIGSEGV?
>>
>> yes. The exception class is EAccessViolation.
>
> I am sorry that was what I thought, but does not work, see screenshot
> attached.

The screenshot does not show where exactly the problem happens (except for
the address, but that is useless without context), i.e. if it is covered
by the try..except construct. Try with the simple test I posted to see if
it works or not.

In any case, Jonas is obviously right that you shouldn't try to catch
SIGSEGV in such complex code (trying to catch the signal potentially
happening in the middle of some nested processing which might leave the
environment in completely undefined state).

Tomas





More information about the fpc-pascal mailing list