[PPL-devel] Re: [Yap-users] Throwing Prolog exceptions from C code

Roberto Bagnara bagnara at cs.unipr.it
Fri Jun 14 23:59:33 CEST 2002


Vitor Santos Costa wrote:
> 
> 
>>I don't know if I am doing something stupid but,
>>in order to throw a Prolog exception with term t
>>from C code, I create the Term `throw(t)' and then
>>I pass it to YapCallProlog().
>>Everything fails horribly and I have no idea why.
>>I append a stack trace hoping it may be enlightening
>>for someone.
> 
> 
> That looks like a nasty bug :-(.
> 
> I know it's not in the Manual, but have you tried using
> 
>  YapThrow(t)
> 
> from the C-code?


Hi Vitor,

I have tried right now and still get a failure,
but with a very different stack trace.
Thanks a lot for your prompt responses

      Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it

Program received signal SIGSEGV, Segmentation fault.
0x08051439 in StaticGetAPropHavingLock (ae=0x655f6e69, kind=65535)
     at Yatom.h:108
108 
{
(gdb) info stack
#0  0x08051439 in StaticGetAPropHavingLock (ae=0x655f6e69, kind=65535)
     at Yatom.h:108
#1  0x08051481 in GetAProp (a=0x655f6e69, kind=65535) at C/adtdefs.c:264
#2  0x0809aebd in writeTerm (t=135986733, p=1200, depth=1, rinfixarg=0)
     at C/write.c:446
#3  0x0809b7c3 in plwrite (t=135986733, mywrite=0x807eee0 <format_putc>,
     flags=4) at C/write.c:675
#4  0x08080a37 in format (tail=135986955, args=34, sno=2) at C/iopreds.c:4227
#5  0x08080f4a in p_format2 () at C/iopreds.c:4356
#6  0x080a5f9a in absmi (inp=0) at C/absmi.c:5719
#7  0x0806c9bc in exec_absmi (top=1) at C/exec.c:881
#8  0x0806cbc2 in do_goal (CodeAdr=0x80f2130 "p'\n\bôÿÿÿ¨ \017\b", arity=0,
     pt=0x0, args_to_save=0, top=1) at C/exec.c:942
#9  0x0806d224 in RunTopGoal (t=214610) at C/exec.c:1128
#10 0x080504aa in YapRunGoal (t=214610) at C/c_interface.c:704
#11 0x0804eb11 in do_top_goal (Goal=214610) at console/yap.c:122
#12 0x0804f2b1 in exec_top_level (BootMode=1, filename=0x0)
     at console/yap.c:457
#13 0x0804f32f in main (argc=1, argv=0xbffff9e4) at console/yap.c:483
#14 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6
(gdb)




More information about the PPL-devel mailing list