Subject: [SWIPL] on_signal

From: "Andrew V. Diatchkov" <[email-masked]>
Date: Tue, 19 Jun 2001 12:02:33 +0400 (MSD)

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