osdir.com
mailing list archive

Subject: reproducable segfault - msg#00121

List: ai.prolog.swi

Date: Prev Next Index Thread: Prev Next Index
Hi list,
Seems i have found a bug.
Good news is, it's easy to reproduce.
Below is the transcript of a xpce session that leads to a segfault.
Nothing to worry about too much. It only happens if the given clause reference does not belong to any existing reference. Anyway, i guess this should fail a bit more "gracefully", shouldn't it. :-)

Kind regards,
--lu

--------------8<----------
lukas@slaine:~$ xpce
% /home/lukas/.plrc compiled 0.00 sec, 484 bytes
XPCE 6.4.0, September 2004 for i686-linux and X11R6
Copyright (C) 1993-2002 University of Amsterdam.
XPCE comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
The host-language is SWI-Prolog version 5.4.2

For HELP on prolog, please type help. or apropos(topic).
on xpce, please type manpce.

?- clause(A,_,42).
[PCE fatal: @pce/pce: Signal trapped: Segmentation violation
in: <No exception goal>
]
<No goal>
Host stack:
[7] clause(_G185, _G186, 42)
[6] $execute_goal2(user:clause(_G185, _G186, 42), ['A'=_G185])
[3] prolog
[2] $runtoplevel
[1] $toplevel
% Execution Aborted
?-
--------------8<----------


------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@xxxxxxxxxxxxxx



Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

Re: C++ and prolog

> int _tmain() > { > _putenv("SWI_HOME_DIR=c:\\Archivos de programa\\pl"); > PlEngine("c:\\prolog\\pruebasVarias\\pruFi.pro"); > PlString av("as"); > //PlCall("prueba2"); > return 0; > } > PlEngine with 1 parameter only specifies the name of the executable, not which prolog file to load. Try PlEngine("c:\\path\\to\\myExecutable.exe"); or use the version which takes argc and argv. To load your file, use PlCall("consult('yourfile.pro')"); > wich compiles ok and links also really good, but when I try to execute > it I get this execution error: > "An Unhandled exception of type 'System.StackoverflowException' ocurred > in prolog.exe", and it points to a SWI-cpp.h code zone who is: > PlTerm() > { ref = PL_new_term_ref(); > } > PlTerm(term_t t) > { ref = t; > } > When SWI throws a PlException to C++ code, it constructs a PlTerm. You can see this if you look at swi-cpp.h, class PlException. ------------ For further info, please visit http://www.swi-prolog.org/ To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>" in its body to majordomo@xxxxxxxxxxxxxx

Next Message by Date: click to view message preview

Re: C++ and prolog

Hi Alan, and thanks for answering PlEngine with 1 parameter only specifies the name of the executable, not which prolog file to load. Try PlEngine("c:\\path\\to\\myExecutable.exe"); or use the version which takes argc and argv. Wich executable file do you reffer? To load your file, use PlCall("consult('yourfile.pro')"); The problem is not loading the .pl code (I can see that it´s loaded in the console), the problem is that when I declare an object, it doesn´t matter wich kind of object (for example, like in this code, a PlTermv class) and doing nothing, it crashes with the "An Unhandled exception of type 'System.StackoverflowException' ocurred" message I´ve been all day trying differnt thigs, but no result... Perhaps I´ve missed any declaration. Can anyone send me a simple example?????? It will be really useful. I´m working with an old version of swi prolog (5.0.5), could be this be the problem? (problems with dot net). The "last code" I tried is: _putenv("SWI_HOME_DIR=c:\\Archivos de programa\\pl"); char *arg[2]; arg[0]="c:\\prolog\\pruebasVarias\\pruFi.pl"; arg[1]=NULL; PlEngine(1,arg); try{ PlTermv av(1); } catch(PlException) Has anyone any idea? Thanks ------------ For further info, please visit http://www.swi-prolog.org/ To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>" in its body to majordomo@xxxxxxxxxxxxxx

Previous Message by Thread: click to view message preview

C++ and prolog

Hi, my problem is really strange. Two years ago I used SWI-cpp.h int managed c++ (Visual Studio .NET 2002) (Dot Net Framework 1.0) The code worked really well, but now I try to use it in a Visual Studio.NET 2003 (Framework 1.1) and I got a few problems, so I began with the classic hellow world in this platorm... so I got this c++ code: // This is the main project file for VC++ application project // generated using an Application Wizard. #include "stdafx.h" #using <mscorlib.dll> #include "SWI-cpp.h" using namespace System; int _tmain() { _putenv("SWI_HOME_DIR=c:\\Archivos de programa\\pl"); PlEngine("c:\\prolog\\pruebasVarias\\pruFi.pro"); PlString av("as"); //PlCall("prueba2"); return 0; } wich compiles ok and links also really good, but when I try to execute it I get this execution error: "An Unhandled exception of type 'System.StackoverflowException' ocurred in prolog.exe", and it points to a SWI-cpp.h code zone who is: PlTerm() { ref = PL_new_term_ref(); } PlTerm(term_t t) { ref = t; } --> Look that the plcall is comented and i alse get the same error. <-- The prlog code is : prueba2(Cad):-open('c:\\prueba2.txt',write,F,[]),write(F,'Probando eko charli'),close(F). And it works from console (with consult...) Has anyone any idea? Any idea will be welcome :) Thank you!!! ------------ For further info, please visit http://www.swi-prolog.org/ To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>" in its body to majordomo@xxxxxxxxxxxxxx

Next Message by Thread: click to view message preview

Re: reproducable segfault

On Wednesday 24 November 2004 17:12, Lukas Degener wrote: > Hi list, > Seems i have found a bug. > Good news is, it's easy to reproduce. > Below is the transcript of a xpce session that leads to a segfault. > Nothing to worry about too much. It only happens if the given clause > reference does not belong to any existing reference. Anyway, i guess > this should fail a bit more "gracefully", shouldn't it. :-) > > Kind regards, > --lu > > --------------8<---------- > lukas@slaine:~$ xpce > % /home/lukas/.plrc compiled 0.00 sec, 484 bytes > XPCE 6.4.0, September 2004 for i686-linux and X11R6 > Copyright (C) 1993-2002 University of Amsterdam. > XPCE comes with ABSOLUTELY NO WARRANTY. This is free software, > and you are welcome to redistribute it under certain conditions. > The host-language is SWI-Prolog version 5.4.2 > > For HELP on prolog, please type help. or apropos(topic). > on xpce, please type manpce. > > ?- clause(A,_,42). > [PCE fatal: @pce/pce: Signal trapped: Segmentation violation > in: <No exception goal> > ] > <No goal> > Host stack: > [7] clause(_G185, _G186, 42) > [6] $execute_goal2(user:clause(_G185, _G186, 42), ['A'=_G185]) > [3] prolog > [2] $runtoplevel > [1] $toplevel > % Execution Aborted > ?- Its nothing to do with XPCE, which only happens to take over trapping fatal signals from Prolog when loaded. Yes you're right, it is a bug. SWI-Prolog does a direct translation from a reference number to an address. Then it applies some simple heuristics to see whether the address refers to a clause, but this can easily fail. Clause and database record references must be used with care, where the program must ensure they are valid references. Finally, clause and database references are not part of the ISO standard and their use is discouraged. Cheers --- Jan ------------ For further info, please visit http://www.swi-prolog.org/ To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>" in its body to majordomo@xxxxxxxxxxxxxx
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by