Subject: Re: Debugging under NT

From: Jan Wielemaker <[email-masked]>
Date: Mon, 5 Jul 1999 15:03:24 +0200

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