[mercury-users] Segfaults and stack overflows?

David Overton dmo at cs.mu.OZ.AU
Mon Jun 7 18:58:05 AEST 2004


On Mon, Jun 07, 2004 at 12:34:10PM +1000, Peter Hawkins wrote:
> Hi...
> 
> Can anyone suggest ways of tracking down the cause of the following segfault? 
> (a stack overflow is quite possible, but how does one know _which_ stack 
> should be made bigger? I tried tweaking everything I could see in 
> MERCURY_OPTIONS). The relevant system has plenty of memory available.
> 
> Output:
> Steiner system S(5,7,28)
> Propagation method: domain
> Number of blocks: 4680
> 
> *** Mercury runtime: caught segmentation violation ***
> PC at signal: 134655154 (806acb2)
> address involved: 0x2

Looks like an attempt to dereference a (tagged) NULL pointer, rather
than a stack overflow.  If you have any embedded C code in your program,
that is most likely the culprit.

I would start by running the program with mdb to try to determine where
it is crashing and what variable it is trying to access.  It will
most probably be on a deconstruction unification.

If that doesn't narrow it down enough, try recompiling with --c-debug
and, preferably, in a hlc grade, and then run the program with GDB.  You
will need to refer to the generated C code during debugging, but with
hlc grades this corresponds fairly directly with the Mercury code so
shouldn't be too hard.


> This may have been caused by a stack overflow, due to unbounded recursion.

This is not always the most helpful message, unfortunately ...


David
-- 
David Overton
WWW: http://www.overtons.id.au/
Mobile Phone (UK): +44 7799 344 322
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list