From ad@solvo.ru Tue Jun 19 10:02:59 2001
Received: from dual.solvo.ru (dual.solvo.ru [195.201.44.111])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f5J82jc05356
	for <prolog@swi.psy.uva.nl>; Tue, 19 Jun 2001 10:02:48 +0200 (MET DST)
Received: from dual by dual.solvo.ru with esmtp
	(Smail3.2.0.111 #2) id m15CGT6-001VEqC; Tue, 19 Jun 2001 12:02:36 +0400 (MSD)
Date: Tue, 19 Jun 2001 12:02:33 +0400 (MSD)
From: "Andrew V. Diatchkov" <ad@solvo.ru>
To: prolog@swi.psy.uva.nl
Message-ID: <Pine.LNX.4.10.10106191119030.31128-100000@dual.solvo.ru>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Subject: [SWIPL] on_signal

Hello.
I'm using on_signal for handling SEGV signal and halt my
program in this case (SWI-Prolog 4.0.7, RedHat Linux 7.1).

There is the test program (see below) which doesn't handles SIGSEGV. I
would like to use it as runtime application. Can you help?

Thanks.

main.pl :

:- on_signal(segv,_,sigsegv).

sigsegv(Context) :- writef('Done. Context=%w',[Context]),nl,halt.
main :-
           repeat,
	   sleep(1.0),
	   fail.

Makefile :
prog:	main.pl
	pl -o prog -t
'[main],qsave_program(prog,[goal=true,toplevel=main,stand_alone=true])'


Type this:

kill -11 `pidof prog`

Result: 'ERROR: sleep/1: Caught signal 11 (segv)'

Why not 'Done. Context=segv'?

--
Andrew V. Diatchkov
Solvo Ltd

