[m-dev.] diff: fix bug with external debugger

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Oct 24 19:56:58 AEST 1999


Estimated hours taken: 2

trace/mercury_trace_external.c:
	Fix a bug: we need to disable tracing inside
	MR_trace_event_external(), just as is done in
	MR_trace_event_internal().

	Otherwise, if you try to debug a program in which the browser
	library was compiled with tracing enabled, then MR_trace()
	ends up calling itself recursively in an infinite loop,
	which ends with a segmentation fault when the program runs
	out of C stack space.

Workspace: /home/mercury0/fjh/mercury
Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.24
diff -u -d -r1.24 mercury_trace_external.c
--- mercury_trace_external.c	1999/10/24 08:39:21	1.24
+++ mercury_trace_external.c	1999/10/24 09:47:22
@@ -401,6 +401,8 @@
 	Word		modules_list;
 	static String	MR_mmc_options;
 
+	MR_trace_enabled = FALSE;
+
         /*
         ** These globals can be overwritten when we call Mercury code,
         ** such as the code in browser/debugger_interface.m.
@@ -668,6 +670,8 @@
 	MR_trace_call_seqno = event_details.MR_call_seqno;
 	MR_trace_call_depth = event_details.MR_call_depth;
 	MR_trace_event_number = event_details.MR_event_number;
+
+	MR_trace_enabled = TRUE;
 
 	return jumpaddr;
 }

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list