Subject: Re: [SWIPL] Creating terms from external C under FreeBSD.

From: Jan Wielemaker <[email-masked]>
Date: Wed, 27 Feb 2002 10:17:11 +0100

Could you turn this into a program I can test or, if this
is not easy give the little bit of C-code constructing the
terms and some overview of the overall control in the 
application, as well as a backtrace of the crash?

I found a problem using mmapped() stacks for MacOS X (based
on OpenBSD).  You can check whether your system is victim
by running

	make check

The Mac never finished the `resource' tests, where the system
tries to run out of stack and handle this gracefully.  It turns
out PROT_NONE (creating non-accessible memory) doesn't work on
this platform.  Configure now tests for this and sets 
#define NO_SEGV_HANDLING 1 to do software stack-guarding.

	Cheers --- Jan

On Wednesday 27 February 2002 10:59, Yan Guiborat wrote:
> Hello,
>
> I wrote, a little while ago, about a problem while creating
> term in a C foreign predicate.
>
> At Term creation, with PL_new_term_ref() or
> PL_new_term_refs functions, my application started being
> swapped by the pager, and them, after a while, I receive a
> nice core file of 600 Megs wich is the size of my swap
> partition.
> I guessed there could be something wrong with mmap()
> function under FreeBSD, I so reconfigured SWI-Prolog, with
> this time the mmapping desabled, and compile it with its
> debug information.
> This time, my application get a segmentation fault instead
> of going into its weird swapping.
>
> It seems to come from the file PL_wam.c, in function
> open_foreign_frame() where "fr" pointer is on 0x0 and a
> make the segmentation fault a few lines after.
>
> Here is the point where I am, and I don't feel so
> confortable modifying the Wam machine and the way it manage
> the stack.
>
> I must add that I just remembered that my pl library is
> compiled as a .a file, could it be the reason of my
> problem ?
>
> Any help will be great thanks, may be someone have already
> found the same problem ?
>
> --------------------------------------
> Yan Guiborat.
> French Exchange Student,
> Tampere University of Technology.
> e-mail:[email-masked].
> --------------------------------------
> ______________________________________________________
> Boîte aux lettres - Caramail - http://www.caramail.com