From jan@swi.psy.uva.nl  Mon Jul  5 15:14:37 1999
Received: from gollem.swi.psy.uva.nl (jan@gollem.swi.psy.uva.nl [145.18.114.15])
	by swi.swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id PAA08960
	for <prolog@swi.psy.uva.nl>; Mon, 5 Jul 1999 15:14:37 +0200 (MET DST)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.8.8/8.8.8) id PAA32336;
	Mon, 5 Jul 1999 15:16:21 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
To: lutz.wohlrab@informatik.tu-chemnitz.de
Subject: Re: Debugging under NT
Date: Mon, 5 Jul 1999 15:03:24 +0200
X-Mailer: KMail [version 0.7.9]
Content-Type: text/plain
References: <199907051248.OAA06280@mykonos.informatik.tu-chemnitz.de.informatik.tu-chemnitz.de>
Cc: prolog@gollem.swi.psy.uva.nl
MIME-Version: 1.0
Message-Id: <99070515162108.31199@gollem>
Content-Transfer-Encoding: 8bit

Lutz,

On Mon, 05 Jul 1999, you wrote:

>I am working on an embedded Prolog application with SWI-Prolog 3.2.8/NT.
>The application is put together with plld and option -g. However, Debuggers
>under NT complain that there is no debigging information in the resulting
>executable.

Use the -v flag to see what commands are invoked.  If this
doesn't satisfy your requirements use -ld-options and/or -cc-options to
pass the right flags.   Please keep me informed if the defaults are
wrong (I'm not much of an MSVC expert).

>Is there any way to have debug information in the executable prodced by
>plld?

If you pass the right flags, it should be ok.  If you want deep-down
debugging you'll have to fetch the sources and recompile libpl.dll for
debugging.

>A second problem I am having is the occurence of a segv signal to my
>embedded application (it's caught by the handlers of prolog). In what case
>does NT issue a segv signal and in what case a windows exception (resulting
>in a message box that launches MS Developer Studio with the debugger if you
>hit the cancel button)? My application did a lot of work before getting
>segv. Might this be a case of overflowing prolog stacks, or are they
>virtually unlimited?

NT issues segv if you address memory that is not mapped or mapped
read-only and you try to write (called General Protection Fault in
MS jargon).  SWI-Prolog for NT does not use segv for stack-expansion,
but uses software stack guarding instead (signal handling proved
unreliable on some Win32 implementations).  You might want to call 	

	signal(SIGSEGV, SIG_DFL);

after PL_initialise().  That should stop Prolog for reporting the signal
and enable default windows behaviour.  Not tested.

The stacks are limited (see statistics) and can be changed using the -L
-G and -T arguments to PL_initialise().

	Regards --- Jan

