[m-rev.] for review: nondet_stack -d

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Aug 8 17:42:01 AEST 2001


Make the debugging of minimal model tabling easier by providing a mechanism
to print the contents of the nondet stack, *including* the values of the
variables in its stack frames, even for frames which are not ancestors
of the currently executing call.

runtime/mercury_stack_trace.[ch]:
	Add functions for traversing the nondet stack, and for keeping track of
	through which label control returns to each nondet stack frame, so that
	we know which label's layout structure to interpret the stack frame's
	contents. For some, this will be the return label of a call; for
	others, it will be the label of a resumption point stored in a
	redoip slot.

	Rename an old function to allow the new one to fit into our naming
	scheme.

runtime/mercury_stack_trace.[ch]:
runtime/mercury_tabling.c:
library/exception.m:
trace/mercury_trace.c:
	Add MR_ prefixes to the values of the enum returned by
	MR_stack_walk_step.

	Rename references to the renamed function.

runtime/mercury_conf_param.h:
	Add macros for debugging label names and for debugging retries (which
	needs label names, just as debugging tabling does).

	Add a macro for controlling whether mercury_debug.c prints raw
	addresses as well as offsets (for stack pointers) or label names (for
	labels). The raw pointers can be useful in debugging, but they need to
	be turned off in test cases one wants to be reproducible.

runtime/mercury_label.h:
runtime/mercury_conf_param.h:
	Move the MR_NEED_ENTRY_LABEL_ARRAY and MR_NEED_ENTRY_LABEL_INFO macros
	from mercury_label.h to mercury_conf_param.h, since mercury_debug.c
	also needs them now.

runtime/mercury_debug.c:
	addresses as well as offsets (for stack pointers) or label names (for
	labels). The raw pointers can be useful in debugging, but they need to
	be turned off in test cases one wants to be reproducible.

runtime/mercury_init.h:
runtime/mercury_wrapper.[ch]:
util/mkinit.c:
	Add a global variable pointing to a function through which the stack
	walk code in runtime/mercury_stack_trace.c can invoke code from the
	debugger to print the values of the variables in nondet stack frames
	without breaking the rule prohibiting references to the trace directory
	from the runtime directory.

runtime/mercury_wrapper.c:
	Define the succip of the dummy frame at the bottom of the nondet stack,
	to avoid dereferencing a garbage pointer during detailed stack dumps.

runtime/mercury_goto.h:
	Add a mechanism for always registering the name of a specific label,
	even if label names are not being registered in general. This mechanism
	is intended to be used for labels such as do_fail, which occur
	frequently in nondet stack traces.

runtime/mercury_context.c:
runtime/mercury_engine.c:
runtime/mercury_ho_call.c:
runtime/mercury_trace_base.c:
runtime/mercury_wrapper.c:
	Use this mechanism for the labels defined in these modules.

library/builtin.m:
	Define type_ctor_infos for the pseudotypes representing nondet stack
	frame slots unconditionally, since the debugger may now need them.

trace/mercury_trace.c:
	Add conditionally enabled to code to make debugging retry easier.

trace/mercury_trace_internal.c:
	Add a -d option to the nondet_stack command that causes it to print
	detailed nondet stack dumps, including the names and values of the
	variables in each nondet stack frame.

trace/mercury_trace_vars.c:
	Provide a mechanism for printing the variables of a stack frame
	even when that stack frame is not an ancestor of the current call.

doc/user_guide.texi:
	Document the new option of the nondet_stack command.

tests/debugger/nondet_stack.{m,inp,exp,exp2}:
	A new test case to test "nondet_stack -d".

tests/debugger/Mmakefile:
	Enable the new test case.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.270
diff -u -b -r1.270 user_guide.texi
--- doc/user_guide.texi	2001/08/07 02:16:01	1.270
+++ doc/user_guide.texi	2001/08/08 07:24:08
@@ -2771,9 +2771,12 @@
 of the Mercury implementation.
 @sp 1
 @table @code
- at item nondet_stack
+ at item nondet_stack [-d]
 @kindex nondet_stack (mdb command)
-Prints the contents of the fixed slots of the frames on the nondet stack.
+Prints the contents of the frames on the nondet stack.
+By default, it prints only of the fixed slots in each nondet stack frame,
+but if the option @samp{-d} or @samp{--detailed} option is given,
+it will also print the names and values of the live variables in them.
 @sp 1
 @item stack_regs
 @kindex stack_regs (mdb command)
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing library
Index: library/exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.49
diff -u -b -r1.49 exception.m
--- library/exception.m	2001/07/03 08:16:25	1.49
+++ library/exception.m	2001/07/03 08:24:08
@@ -1270,7 +1270,7 @@
 		*/
 		result = MR_stack_walk_step(entry_layout, &return_label_layout,
 			&base_sp, &base_curfr, &problem);
-		if (result != STEP_OK) {
+		if (result != MR_STEP_OK) {
 			WARNING(problem);
 			return NULL;
 		}
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_conf_param.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_conf_param.h,v
retrieving revision 1.48
diff -u -b -r1.48 mercury_conf_param.h
--- runtime/mercury_conf_param.h	2001/05/31 06:00:10	1.48
+++ runtime/mercury_conf_param.h	2001/08/08 05:56:24
@@ -172,6 +172,20 @@
 ** MR_TABLE_DEBUG
 ** 	Enables low-level debugging messages from the tabling system.
 **
+** MR_DEBUG_RETRY
+** 	Enables low-level debugging messages from retry operations in the
+** 	debugger.
+**
+** MR_DEBUG_LABEL_NAMES
+** 	Registers labels and their names, enabling label addresses to be
+** 	converted back to a form in which they are usable by a developer.
+** 	Implied by MR_TABLE_DEBUG and MR_DEBUG_RETRY.
+**
+** MR_LOWLEVEL_ADDR_DEBUG
+** 	Enables the printing of raw addresses in debugging output even for
+** 	things (such as stack slots and labels) that can be identified by more
+** 	human-friendly handles (such as stack offsets and label names).
+**
 ** MR_DEBUG_JMPBUFS
 ** 	Enables low-level debugging messages from MR_call_engine and the
 ** 	code handling exceptions.
@@ -309,6 +323,16 @@
 /* XXX document MR_BYTECODE_CALLABLE */
 
 /*
+** MR_DEBUG_LABEL_NAMES -- we need to be able to convert code addresses into
+**			   the names of the labels they correspond to.
+*/
+
+/* MR_TABLE_DEBUG and MR_DEBUG_RETRY imply MR_DEBUG_LABEL_NAMES */
+#if defined(MR_TABLE_DEBUG) || defined(MR_DEBUG_RETRY)
+  #define MR_DEBUG_LABEL_NAMES
+#endif
+
+/*
 ** MR_INSERT_LABELS     -- labels need to be inserted into the label table. 
 **			   (this also means the initialization code needs
 **			   to be run some time before the first use of the
@@ -326,7 +350,7 @@
   #error "MR_INSERT_LABELS should not be defined on the command line"
 #endif
 #if defined(MR_STACK_TRACE) || defined(NATIVE_GC) || defined(MR_DEBUG_GOTOS) \
-	|| defined(MR_BYTECODE_CALLABLE)
+	|| defined(MR_BYTECODE_CALLABLE) || defined(MR_DEBUG_LABEL_NAMES)
   #define MR_INSERT_LABELS
 #endif
 
@@ -342,7 +366,8 @@
   #error "MR_INSERT_ENTRY_LABEL_NAMES should not be defined on the command line"
 #endif
 #if defined(MR_MPROF_PROFILE_CALLS) || defined(MR_DEBUG_GOTOS) \
-		|| defined(MR_DEBUG_AGC_SCHEDULING)
+		|| defined(MR_DEBUG_AGC_SCHEDULING) \
+		|| defined(MR_DEBUG_LABEL_NAMES)
   #define MR_INSERT_ENTRY_LABEL_NAMES
 #endif
 
@@ -357,8 +382,35 @@
 #ifdef MR_INSERT_INTERNAL_LABEL_NAMES
   #error "MR_INSERT_INTERNAL_LABEL_NAMES should not be defined on the command line"
 #endif
-#if defined(MR_DEBUG_GOTOS) || defined(MR_DEBUG_AGC_SCHEDULING)
+#if defined(MR_DEBUG_GOTOS) || defined(MR_DEBUG_AGC_SCHEDULING) \
+	|| defined(MR_DEBUG_LABEL_NAMES)
   #define MR_INSERT_INTERNAL_LABEL_NAMES
+#endif
+
+/*
+** MR_NEED_ENTRY_LABEL_ARRAY -- we need an array of the procedure entry code
+**                              addresses and possibly their label names,
+**                              sorted by the code address before use.
+**
+** This is required by garbage collection and for some kinds of low level
+** debugging.
+**
+** MR_NEED_ENTRY_LABEL_INFO --  we need to register procedure entry code
+**                              addresses.
+**
+** This is required in order to construct the sorted array of procedure entry
+** code addresses, to let the mprof profiling system turn program counter
+** samples back into procedure names, and to let accurate gc find out the
+** layout of stack frames.
+*/
+
+#if defined(NATIVE_GC) || defined(MR_DEBUG_GOTOS) \
+	|| defined(MR_INSERT_ENTRY_LABEL_NAMES)
+  #define MR_NEED_ENTRY_LABEL_ARRAY
+#endif
+
+#if defined(MR_NEED_ENTRY_LABEL_ARRAY) || defined(MR_MPROF_PROFILE_CALLS)
+  #define MR_NEED_ENTRY_LABEL_INFO
 #endif
 
 /*
Index: runtime/mercury_context.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_context.c,v
retrieving revision 1.29
diff -u -b -r1.29 mercury_context.c
--- runtime/mercury_context.c	2001/05/31 06:00:11	1.29
+++ runtime/mercury_context.c	2001/08/08 05:27:59
@@ -303,7 +303,7 @@
 MR_define_extern_entry(MR_do_runnext);
 
 MR_BEGIN_MODULE(scheduler_module)
-	MR_init_entry_ai(MR_do_runnext);
+	MR_init_entry_an(MR_do_runnext);
 MR_BEGIN_CODE
 
 MR_define_entry(MR_do_runnext);
Index: runtime/mercury_debug.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_debug.c,v
retrieving revision 1.5
diff -u -b -r1.5 mercury_debug.c
--- runtime/mercury_debug.c	2001/05/31 06:00:11	1.5
+++ runtime/mercury_debug.c	2001/08/08 05:16:41
@@ -19,6 +19,14 @@
 static void	MR_print_ordinary_regs(void);
 static void	MR_printdetslot_as_label(const MR_Integer offset);
 
+#ifdef	MR_LOWLEVEL_ADDR_DEBUG
+  #define	MR_PRINT_RAW_ADDRS	TRUE
+#else
+  #define	MR_PRINT_RAW_ADDRS	FALSE
+#endif
+
+static	bool	MR_print_raw_addrs = MR_PRINT_RAW_ADDRS;
+
 /* debugging messages */
 
 #ifdef MR_LOWLEVEL_DEBUG
@@ -225,15 +233,22 @@
 void 
 MR_printstring(const char *s)
 {
+	if (MR_print_raw_addrs) {
 	printf("string %p %s\n", (const void *) s, s);
+	} else {
+		printf("string %s\n", s, s);
+	}
 }
 
 void 
 MR_printheap(const MR_Word *h)
 {
 #ifndef CONSERVATIVE_GC
-	printf("ptr %p, offset %3ld words\n",
-		(const void *) h,
+	if (MR_print_raw_addrs) {
+		printf("ptr %p, ", (const void *) h);
+	}
+
+	printf("offset %3ld words\n",
 		(long) (MR_Integer) (h - MR_ENGINE(MR_eng_heap_zone)->min));
 #else
 	printf("ptr %p\n",
@@ -246,8 +261,12 @@
 {
 	int	i;
 
-	printf("frame at ptr %p, offset %3ld words\n",
-		(const void *) fr, 
+	printf("frame at ");
+	if (MR_print_raw_addrs) {
+		printf("ptr %p, ", (const void *) fr);
+	}
+
+	printf("offset %3ld words\n",
 		(long) (MR_Integer)
 			(fr - MR_CONTEXT(MR_ctxt_nondetstack_zone)->min));
 	printf("\t succip    "); MR_printlabel(stdout, MR_succip_slot(fr));
@@ -356,17 +375,23 @@
 void 
 MR_print_detstackptr(FILE *fp, const MR_Word *s)
 {
-	fprintf(fp, "det %3ld (%p)",
+	fprintf(fp, "det %3ld ",
 		(long) (MR_Integer)
-			(s - MR_CONTEXT(MR_ctxt_detstack_zone)->min),
-		(const void *) s);
+			(s - MR_CONTEXT(MR_ctxt_detstack_zone)->min));
+
+	if (MR_print_raw_addrs) {
+		fprintf(fp, " (%p)", (const void *) s);
+	}
 }
 
 void 
 MR_printdetstack(const MR_Word *s)
 {
-	printf("ptr %p, offset %3ld words\n",
-		(const void *) s,
+	if (MR_print_raw_addrs) {
+		printf("ptr %p, ", (const void *) s);
+	}
+
+	printf("offset %3ld words\n",
 		(long) (MR_Integer)
 			(s - MR_CONTEXT(MR_ctxt_detstack_zone)->min));
 }
@@ -380,17 +405,24 @@
 void 
 MR_print_nondstackptr(FILE *fp, const MR_Word *s)
 {
-	fprintf(fp, "non %3ld (%p)",
+	fprintf(fp, "non %3ld",
 		(long) (MR_Integer)
-			(s - MR_CONTEXT(MR_ctxt_nondetstack_zone)->min),
+			(s - MR_CONTEXT(MR_ctxt_nondetstack_zone)->min));
+
+	if (MR_print_raw_addrs) {
+		fprintf(fp, " (%p)",
 		(const void *) s);
+	}
 }
 
 void 
 MR_printnondstack(const MR_Word *s)
 {
-	printf("ptr %p, offset %3ld words\n",
-		(const void *) s,
+	if (MR_print_raw_addrs) {
+		printf("ptr %p, ", (const void *) s);
+	}
+
+	printf("offset %3ld words\n",
 		(long) (MR_Integer)
 			(s - MR_CONTEXT(MR_ctxt_nondetstack_zone)->min));
 }
@@ -399,13 +431,15 @@
 MR_print_heapptr(FILE *fp, const MR_Word *s)
 {
 #ifdef	CONSERVATIVE_GC
-	fprintf(fp, "heap %ld (%p)",
-		(long) s, (const void *) s);
+	fprintf(fp, "heap %ld", (long) s);
 #else
-	fprintf(fp, "heap %3ld (%p)",
-		(long) (MR_Integer) (s - MR_ENGINE(MR_eng_heap_zone)->min),
-		(const void *) s);
+	fprintf(fp, "heap %3ld",
+		(long) (MR_Integer) (s - MR_ENGINE(MR_eng_heap_zone)->min)),
 #endif
+
+	if (MR_print_raw_addrs) {
+		printf(" (%p)", (const void *) s);
+	}
 }
 
 void 
@@ -416,25 +450,31 @@
 	internal = MR_lookup_internal_by_addr(w);
 	if (internal != NULL) {
 		if (internal->i_name != NULL) {
-			fprintf(fp, "label %s (%p)", internal->i_name, w);
+			fprintf(fp, "label %s", internal->i_name);
 		} else {
-			fprintf(fp, "label (%p)", w);
+			fprintf(fp, "unnamed label");
 		}
 	} else {
-#ifdef	MR_DEBUG_GOTOS
+#ifdef	MR_NEED_ENTRY_LABEL_ARRAY
 		MR_Entry	*entry;
 
 		entry = MR_prev_entry_by_addr(w);
-		if (entry != NULL && entry->e_addr == w
-			&& entry->e_name != NULL)
-		{
-			fprintf(fp, "label %s (%p)", entry->e_name, w);
+		if (entry != NULL && entry->e_addr == w) {
+			if (entry->e_name != NULL) {
+				fprintf(fp, "entry label %s", entry->e_name);
 		} else {
-			fprintf(fp, "label UNKNOWN (%p)", w);
+				fprintf(fp, "unnamed entry label");
 		}
+		} else {
+			fprintf(fp, "label UNKNOWN");
+		}
 #else
-		fprintf(fp, "label UNKNOWN (%p)", w);
-#endif	/* not MR_DEBUG_GOTOS */
+		fprintf(fp, "label UNKNOWN");
+#endif	/* not MR_NEED_ENTRY_LABEL_ARRAY */
+	}
+
+	if (MR_print_raw_addrs) {
+		fprintf(fp, " (%p)", w);
 	}
 }
 
Index: runtime/mercury_engine.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_engine.c,v
retrieving revision 1.35
diff -u -b -r1.35 mercury_engine.c
--- runtime/mercury_engine.c	2001/06/08 08:23:09	1.35
+++ runtime/mercury_engine.c	2001/08/08 05:24:28
@@ -662,12 +662,12 @@
 MR_define_extern_entry(MR_exception_handler_do_fail);
 
 MR_BEGIN_MODULE(special_labels_module)
-	MR_init_entry_ai(MR_do_redo);
-	MR_init_entry_ai(MR_do_fail);
-	MR_init_entry_ai(MR_do_succeed);
-	MR_init_entry_ai(MR_do_last_succeed);
-	MR_init_entry_ai(MR_do_not_reached);
-	MR_init_entry_ai(MR_exception_handler_do_fail);
+	MR_init_entry_an(MR_do_redo);
+	MR_init_entry_an(MR_do_fail);
+	MR_init_entry_an(MR_do_succeed);
+	MR_init_entry_an(MR_do_last_succeed);
+	MR_init_entry_an(MR_do_not_reached);
+	MR_init_entry_an(MR_exception_handler_do_fail);
 MR_BEGIN_CODE
 
 MR_define_entry(MR_do_redo);
Index: runtime/mercury_goto.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_goto.h,v
retrieving revision 1.30
diff -u -b -r1.30 mercury_goto.h
--- runtime/mercury_goto.h	2001/07/31 21:26:10	1.30
+++ runtime/mercury_goto.h	2001/08/08 05:29:48
@@ -49,21 +49,30 @@
 ** or if we need the label address for profiling or
 ** accurate garbage collection.
 **
-** The versions of the macros below with the _ai or _sl suffix always insert
-** the label into the label table, the difference between them being that
-** the _ai variant does not include a layout structure. If the label *has*
-** a layout structure, use the _sl variant.
+** The versions of the macros below with the _ai, _an or _sl suffix always
+** insert the label into the label table, the difference between them being that
+** the _ai and _an variants do not include a layout structure. If the label
+** *has* a layout structure, use the _sl variant. The difference between the
+** _ai and the _an variants is that the latter always inserts the name of the
+** label as well. This is intended for a small number of labels that are
+** frequently needed in debugging, e.g. do_fail.
 */
 
 #define MR_make_label_ai(n, a, l)		MR_insert_internal(n, a, NULL)
+#define MR_make_label_an(n, a, l)		MR_insert_internal_label(n, \
+							a, NULL)
 #define MR_make_label_sl(n, a, l)		MR_insert_internal(n, a, \
 							MR_LABEL_LAYOUT(l))
 
 #define MR_make_local_ai(n, a, l)		MR_insert_entry(n, a, NULL)
+#define MR_make_local_an(n, a, l)		MR_insert_entry_label(n, \
+							a, NULL)
 #define MR_make_local_sl(n, a, l)		MR_insert_entry(n, a, \
 							MR_PROC_LAYOUT(l))
 
 #define MR_make_entry_ai(n, a, l)		MR_insert_entry(n, a, NULL)
+#define MR_make_entry_an(n, a, l)		MR_insert_entry_label(n, \
+							a, NULL)
 #define MR_make_entry_sl(n, a, l)		MR_insert_entry(n, a, \
 							MR_PROC_LAYOUT(l))
 
@@ -561,6 +570,9 @@
     #define MR_init_entry_ai(label)	\
 	MR_PRETEND_ADDRESS_IS_USED(&&label); \
 	MR_make_entry_ai(MR_STRINGIFY(label), label, label)
+    #define MR_init_entry_an(label)	\
+	MR_PRETEND_ADDRESS_IS_USED(&&label); \
+	MR_make_entry_an(MR_STRINGIFY(label), label, label)
     #define MR_init_entry_sl(label)	\
 	MR_PRETEND_ADDRESS_IS_USED(&&label); \
 	MR_make_entry_sl(MR_STRINGIFY(label), label, label)
@@ -594,6 +606,9 @@
     #define MR_init_entry_ai(label)	\
 	MR_make_entry_ai(MR_STRINGIFY(label), &&label, label);	\
 	MR_entry(label) = &&label
+    #define MR_init_entry_an(label)	\
+	MR_make_entry_an(MR_STRINGIFY(label), &&label, label);	\
+	MR_entry(label) = &&label
     #define MR_init_entry_sl(label)	\
 	MR_make_entry_sl(MR_STRINGIFY(label), &&label, label);	\
 	MR_entry(label) = &&label
@@ -616,6 +631,8 @@
   	MR_make_local(MR_STRINGIFY(label), &&MR_entry(label), label)
   #define MR_init_local_ai(label)	\
   	MR_make_local_ai(MR_STRINGIFY(label), &&MR_entry(label), label)
+  #define MR_init_local_an(label)	\
+  	MR_make_local_an(MR_STRINGIFY(label), &&MR_entry(label), label)
   #define MR_init_local_sl(label)	\
   	MR_make_local_sl(MR_STRINGIFY(label), &&MR_entry(label), label)
   #define MR_define_label(label)	MR_define_local(label)
@@ -624,6 +641,8 @@
 	MR_make_label(MR_STRINGIFY(label), &&MR_entry(label), label)
   #define MR_init_label_ai(label)	\
 	MR_make_label_ai(MR_STRINGIFY(label), &&MR_entry(label), label)
+  #define MR_init_label_an(label)	\
+	MR_make_label_an(MR_STRINGIFY(label), &&MR_entry(label), label)
   #define MR_init_label_sl(label)	\
 	MR_make_label_sl(MR_STRINGIFY(label), &&MR_entry(label), label)
 
@@ -673,6 +692,8 @@
 		  				label, label)
   #define MR_init_entry_ai(label)	MR_make_entry_ai(MR_STRINGIFY(label), \
 		  				label, label)
+  #define MR_init_entry_an(label)	MR_make_entry_an(MR_STRINGIFY(label), \
+		  				label, label)
   #define MR_init_entry_sl(label)	MR_make_entry_sl(MR_STRINGIFY(label), \
 		  				label, label)
 
@@ -685,6 +706,8 @@
 		  				label, label)
   #define MR_init_local_ai(label)	MR_make_local_ai(MR_STRINGIFY(label), \
 		  				label, label)
+  #define MR_init_local_an(label)	MR_make_local_an(MR_STRINGIFY(label), \
+		  				label, label)
   #define MR_init_local_sl(label)	MR_make_local_sl(MR_STRINGIFY(label), \
 		  				label, label)
 
@@ -696,6 +719,8 @@
   #define MR_init_label(label)		MR_make_label(MR_STRINGIFY(label),    \
 		  				label, label)
   #define MR_init_label_ai(label)	MR_make_label_ai(MR_STRINGIFY(label), \
+		  				label, label)
+  #define MR_init_label_an(label)	MR_make_label_an(MR_STRINGIFY(label), \
 		  				label, label)
   #define MR_init_label_sl(label)	MR_make_label_sl(MR_STRINGIFY(label), \
 		  				label, label)
Index: runtime/mercury_ho_call.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_ho_call.c,v
retrieving revision 1.46
diff -u -b -r1.46 mercury_ho_call.c
--- runtime/mercury_ho_call.c	2001/07/03 08:16:33	1.46
+++ runtime/mercury_ho_call.c	2001/08/08 05:28:09
@@ -158,13 +158,13 @@
 MR_declare_label(mercury__compare_3_0_i1);
 
 MR_BEGIN_MODULE(call_module)
-	MR_init_entry_ai(mercury__do_call_closure);
-	MR_init_entry_ai(mercury__do_call_class_method);
-	MR_init_entry_ai(mercury__unify_2_0);
-	MR_init_entry_ai(mercury__compare_3_0);
-	MR_init_entry_ai(mercury__compare_3_1);
-	MR_init_entry_ai(mercury__compare_3_2);
-	MR_init_entry_ai(mercury__compare_3_3);
+	MR_init_entry_an(mercury__do_call_closure);
+	MR_init_entry_an(mercury__do_call_class_method);
+	MR_init_entry_an(mercury__unify_2_0);
+	MR_init_entry_an(mercury__compare_3_0);
+	MR_init_entry_an(mercury__compare_3_1);
+	MR_init_entry_an(mercury__compare_3_2);
+	MR_init_entry_an(mercury__compare_3_3);
 MR_BEGIN_CODE
 
 /*
Index: runtime/mercury_init.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_init.h,v
retrieving revision 1.29
diff -u -b -r1.29 mercury_init.h
--- runtime/mercury_init.h	2001/01/18 01:19:06	1.29
+++ runtime/mercury_init.h	2001/01/28 11:37:19
@@ -123,6 +123,10 @@
 extern	char	*MR_trace_getline(const char *, FILE *mdb_in, FILE *mdb_out);
 extern	char	*MR_trace_get_command(const char *, FILE *, FILE *);
 
+/* in trace/mercury_trace_vars.h */
+extern	const char *MR_trace_browse_all_on_level(FILE *,
+			const MR_Label_Layout *, MR_Word *, MR_Word *, int);
+
 /* in trace/mercury_trace_external.h */
 extern	void	MR_trace_init_external(void);
 extern	void	MR_trace_final_external(void);
Index: runtime/mercury_label.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_label.h,v
retrieving revision 1.9
diff -u -b -r1.9 mercury_label.h
--- runtime/mercury_label.h	2001/05/31 06:00:14	1.9
+++ runtime/mercury_label.h	2001/06/14 03:11:37
@@ -15,17 +15,10 @@
 #ifndef	MERCURY_LABEL_H
 #define	MERCURY_LABEL_H
 
+#include "mercury_conf_param.h"	    /* for `MR_NEED_ENTRY_LABEL_ARRAY' etc */
 #include "mercury_types.h"		/* for `MR_Code *' */
 #include "mercury_dlist.h" 		/* for `List' */
 #include "mercury_stack_layout.h"	/* for `MR_Proc_Layout' etc */
-
-#if     defined(NATIVE_GC) || defined(MR_DEBUG_GOTOS)
-  #define	MR_NEED_ENTRY_LABEL_ARRAY
-#endif
-
-#if     defined(MR_NEED_ENTRY_LABEL_ARRAY) || defined(MR_MPROF_PROFILE_CALLS)
-  #define	MR_NEED_ENTRY_LABEL_INFO
-#endif
 
 /*
 ** This struct records information about entry labels. Elements in the
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.42
diff -u -b -r1.42 mercury_stack_trace.c
--- runtime/mercury_stack_trace.c	2001/05/31 06:00:16	1.42
+++ runtime/mercury_stack_trace.c	2001/08/08 05:15:29
@@ -12,9 +12,18 @@
 
 #include "mercury_imp.h"
 #include "mercury_stack_trace.h"
+#include "mercury_stack_layout.h"
 #include "mercury_debug.h"
+#include "mercury_array_macros.h"
 #include <stdio.h>
 
+static	const char *MR_step_over_nondet_frame(FILE *fp,
+			int level_number, MR_Word *fr);
+static	bool	MR_find_matching_branch(MR_Word *fr, int *branch_ptr);
+static	void	MR_record_temp_redoip(MR_Word *fr);
+static	MR_Code *MR_find_temp_redoip(MR_Word *fr);
+static	void	MR_erase_temp_redoip(MR_Word *fr);
+
 static	void	MR_dump_stack_record_init(bool include_trace_data,
 			bool include_contexts);
 static	void	MR_dump_stack_record_frame(FILE *fp,
@@ -100,10 +109,10 @@
 
 		result = MR_stack_walk_step(entry_layout, &cur_label_layout,
 				&stack_trace_sp, &stack_trace_curfr, &problem);
-		if (result == STEP_ERROR_BEFORE) {
+		if (result == MR_STEP_ERROR_BEFORE) {
 			MR_dump_stack_record_flush(fp, print_stack_record);
 			return problem;
-		} else if (result == STEP_ERROR_AFTER) {
+		} else if (result == MR_STEP_ERROR_AFTER) {
 			MR_dump_stack_record_frame(fp, prev_label_layout,
 				old_trace_sp, old_trace_curfr, 
 				print_stack_record);
@@ -142,7 +151,7 @@
 				&return_label_layout,
 				stack_trace_sp, stack_trace_curfr, problem);
 
-		if (result != STEP_OK) {
+		if (result != MR_STEP_OK) {
 			/* *problem has already been filled in */
 			return NULL;
 		}
@@ -180,7 +189,7 @@
 		*/
 
 		*problem_ptr = "reached procedure with no stack trace info";
-		return STEP_ERROR_BEFORE;
+		return MR_STEP_ERROR_BEFORE;
 	}
 
 	if (MR_DETISM_DET_STACK(determinism)) {
@@ -190,7 +199,7 @@
 
 		if (type != MR_LONG_LVAL_TYPE_STACKVAR) {
 			*problem_ptr = "can only handle stackvars";
-			return STEP_ERROR_AFTER;
+			return MR_STEP_ERROR_AFTER;
 		}
 
 		success = (MR_Code *) MR_based_stackvar(*stack_trace_sp_ptr,
@@ -203,31 +212,125 @@
 	}
 
 	if (success == MR_stack_trace_bottom) {
-		return STEP_OK;
+		return MR_STEP_OK;
 	}
 
 	label = MR_lookup_internal_by_addr(success);
 	if (label == NULL) {
 		*problem_ptr = "reached unknown label";
-		return STEP_ERROR_AFTER;
+		return MR_STEP_ERROR_AFTER;
 	}
 
 	if (label->i_layout == NULL) {
 		*problem_ptr = "reached label with no stack layout info";
-		return STEP_ERROR_AFTER;
+		return MR_STEP_ERROR_AFTER;
 	}
 
 	*return_label_layout = label->i_layout;
-	return STEP_OK;
+	return MR_STEP_OK;
 }
 
+/**************************************************************************/
+
+void
+MR_dump_nondet_stack(FILE *fp, MR_Word *base_maxfr)
+{
+	MR_dump_nondet_stack_from_layout(fp, base_maxfr, NULL, NULL, NULL);
+}
+
+/*
+** Detailed nondet stack dumps include the values of the local variables in
+** each nondet stack frame. To find out what variables are live in each frame,
+** we must know through what label control will go back to that frame, so we
+** can use that label's layout structure.
+**
+** Control can reach a frame through one of three means.
+**
+** - It may already be there. This is true only for the frame defined by the
+**   arguments of MR_dump_nondet_stack_from_layout, and the layout structure
+**   we use is also among the arguments.
+**
+** - It may get there by backtracking. In this case, the layout structure to
+**   use is the one associated with the frame's redoip structure.
+**
+** - It may get there by returning from a call. In this case, the layout
+**   structure to use is the one associated with the return label.
+**
+** We distinguish the last two cases by keeping an array of nondet stack frames
+** that will be returned to from other nondet stack frames higher up, possibly
+** via other procedures that live on the det stack. Procedures that live on the
+** det stack may occur in the call chain of the currently active procedure, but
+** they may not occur in side branches of the search tree: a model_non call may
+** leave stack frames only on the nondet stack when it exits.
+**
+** When we find the top frame of a side branch, we don't know what the value
+** of the det stack pointer sp was when execution created that nondet stack
+** frame. This means that if that an ancestor of that nondet stack frame lives
+** on the det stack, we cannot find the address of the stack frame of the
+** ancestor. However, due that above invariant the only such ancestor a nondet
+** stack frame on a side branch can have is an ancestor it shares with the
+** currently executing call, and for the ancestors of the currently executing
+** call we *do* know the values of sp.
+**
+** The MR_nondet_branch_infos array has one entry for each nondet branch; this
+** entry gives the details of the next frame on the nondet stack from that
+** branch. The branch_curfr field is valid for all entries and all entries in
+** the array have distinct values for this field. The branch_sp field is valid
+** only for the entry on the main branch; for all other entries, in contains
+** NULL. The branch_layout field gives the address of the layout structure of
+** the return address through which control will return to that frame. (Frames
+** to which control returns via backtracking never get put into this array,
+** only their ancestors do.) The branch_topfr field gives the address of the
+** top frame in the branch; we print this because it makes the stack dump
+** easier to interpret.
+**
+** The MR_nondet_branch_infos array grows when we find the tops of new side
+** branches and shrinks when we find frames that created side branches.
+*/
+
+typedef struct
+{
+	MR_Word			*branch_sp;
+	MR_Word			*branch_curfr;
+	const MR_Label_Layout	*branch_layout;
+	MR_Word			*branch_topfr;
+} MR_Nondet_Branch_Info;
+
+static MR_Nondet_Branch_Info	*MR_nondet_branch_infos = NULL;
+static int			MR_nondet_branch_info_next = 0;
+static int			MR_nondet_branch_info_max = 0;
+
+#define	MR_INIT_NONDET_BRANCH_ARRAY_SIZE	10
+
 void
-MR_dump_nondet_stack_from_layout(FILE *fp, MR_Word *base_maxfr)
+MR_dump_nondet_stack_from_layout(FILE *fp, MR_Word *base_maxfr,
+	const MR_Label_Layout *top_layout,
+	MR_Word *base_sp, MR_Word *base_curfr)
 {
 	int	frame_size;
+	int		level_number;
+	bool		print_vars;
+	const char	*problem;
 
 	MR_do_init_modules();
 
+	MR_nondet_branch_info_next = 0;
+	if (top_layout != NULL && base_sp != NULL && base_curfr != NULL
+		&& MR_address_of_trace_browse_all_on_level != NULL)
+	{
+		print_vars = TRUE;
+		MR_ensure_room_for_next(MR_nondet_branch_info,
+			MR_Nondet_Branch_Info,
+			MR_INIT_NONDET_BRANCH_ARRAY_SIZE);
+		MR_nondet_branch_infos[0].branch_sp = base_sp;
+		MR_nondet_branch_infos[0].branch_curfr = base_curfr;
+		MR_nondet_branch_infos[0].branch_layout = top_layout;
+		MR_nondet_branch_infos[0].branch_topfr = base_curfr;
+		MR_nondet_branch_info_next++;
+	} else {
+		print_vars = FALSE;
+	}
+
 	/*
 	** The comparison operator in the condition of the while loop
 	** should be >= if you want the trace to include the bottom frame
@@ -236,6 +339,7 @@
 	** frame to be included.
 	*/
 
+	level_number = 0;
 	while (base_maxfr >= MR_nondet_stack_trace_bottom) {
 		frame_size = base_maxfr - MR_prevfr_slot(base_maxfr);
 		if (frame_size == MR_NONDET_TEMP_SIZE) {
@@ -246,6 +350,10 @@
 			fprintf(fp, " redofr: ");
 			MR_print_nondstackptr(fp, MR_redofr_slot(base_maxfr));
 			fprintf(fp, " \n");
+
+			if (print_vars) {
+				MR_record_temp_redoip(base_maxfr);
+			}
 		} else if (frame_size == MR_DET_TEMP_SIZE) {
 			MR_print_nondstackptr(fp, base_maxfr);
 			fprintf(fp, ": temp\n");
@@ -271,11 +379,283 @@
 			fprintf(fp, " succfr: ");
 			MR_print_nondstackptr(fp, MR_succfr_slot(base_maxfr));
 			fprintf(fp, " \n");
+
+			level_number++;
+			if (print_vars &&
+				base_maxfr > MR_nondet_stack_trace_bottom)
+			{
+				problem = MR_step_over_nondet_frame(fp,
+					level_number, base_maxfr);
+				if (problem != NULL) {
+					fprintf(fp, "%s\n", problem);
+					return;
+				}
 		}
+		}
 
 		base_maxfr = MR_prevfr_slot(base_maxfr);
 	}
 }
+
+static const char *
+MR_step_over_nondet_frame(FILE *fp, int level_number, MR_Word *fr)
+{
+	MR_Stack_Walk_Step_Result	result;
+	MR_Determinism			determinism;
+	const MR_Internal		*internal;
+	int				branch;
+	int				last;
+	MR_Word				*base_sp;
+	MR_Word				*base_curfr;
+	MR_Word				*topfr;
+	const MR_Label_Layout		*label_layout;
+	const MR_Proc_Layout		*proc_layout;
+	const char			*problem;
+
+	if (MR_find_matching_branch(fr, &branch)) {
+		base_sp = MR_nondet_branch_infos[branch].branch_sp;
+		base_curfr = MR_nondet_branch_infos[branch].branch_curfr;
+		label_layout = MR_nondet_branch_infos[branch].branch_layout;
+		topfr = MR_nondet_branch_infos[branch].branch_topfr;
+		if (base_sp == NULL) {
+			fprintf(fp, " internal frame on nondet side branch ");
+			MR_printnondstackptr(topfr);
+			fprintf(fp, "\n");
+		} else {
+			fprintf(fp, " on main nondet branch ");
+			MR_printnondstackptr(topfr);
+			fprintf(fp, "\n");
+		}
+		(*MR_address_of_trace_browse_all_on_level)(fp,
+			label_layout, base_sp, base_curfr, level_number);
+		MR_erase_temp_redoip(fr);
+		proc_layout = label_layout->MR_sll_entry;
+
+		/*
+		** Step past all other detstack-living
+		** ancestors on the main branch.
+		*/
+		while (TRUE) {
+			result = MR_stack_walk_step(proc_layout, &label_layout,
+					&base_sp, &base_curfr, &problem);
+
+			if (result != MR_STEP_OK) {
+				return problem;
+			}
+
+			if (label_layout == NULL) {
+				return NULL;
+			}
+
+			proc_layout = label_layout->MR_sll_entry;
+			determinism = proc_layout->MR_sle_detism;
+
+			if (! MR_DETISM_DET_STACK(determinism)) {
+				/*
+				** We will handle this call to a model_non
+				** procedure when the sweep in
+				** MR_dump_nondet_stack_from_layout reaches it.
+				** For now, we only put into the table.
+				*/
+				break;
+			} else if (base_sp == NULL) {
+				/*
+				** We are on a side branch, and we must have
+				** arrived at the common ancestor of the side
+				** branch and the main branch.
+				*/
+				return NULL;
+			}
+		}
+
+		last = MR_nondet_branch_info_next - 1;
+		MR_nondet_branch_infos[branch].branch_layout =
+			MR_nondet_branch_infos[last].branch_layout;
+		MR_nondet_branch_infos[branch].branch_sp =
+			MR_nondet_branch_infos[last].branch_sp;
+		MR_nondet_branch_infos[branch].branch_curfr =
+			MR_nondet_branch_infos[last].branch_curfr;
+		MR_nondet_branch_infos[branch].branch_topfr =
+			MR_nondet_branch_infos[last].branch_topfr;
+		MR_nondet_branch_info_next--;
+	} else {
+		MR_Code	*redoip;
+
+		redoip = MR_find_temp_redoip(fr);
+		if (redoip == NULL) {
+			redoip = MR_redoip_slot(fr);
+		}
+
+		internal = MR_lookup_internal_by_addr(redoip);
+		if (internal == NULL || internal->i_layout == NULL) {
+			return "cannot find redoip label's layout structure";
+		}
+
+		label_layout = internal->i_layout;
+		fprintf(fp, " top frame of a nondet side branch ");
+		MR_printnondstackptr(fr);
+		fprintf(fp, "\n");
+		(*MR_address_of_trace_browse_all_on_level)(fp,
+			label_layout, NULL, fr, level_number);
+		MR_erase_temp_redoip(fr);
+
+		/*
+		** Passing a NULL base_sp to MR_stack_walk_step is OK because
+		** the procedure whose stack frame we are now looking at uses
+		** the nondet stack. Putting a NULL base_sp into the table
+		** is OK because all the ancestors of this procedure that are
+		** not also ancestors of the call currently being executed
+		** must also use the nondet stack. This is a consequence of the
+		** invariant that model_non calls leave the det stack
+		** unchanged.
+		*/
+
+		base_sp = NULL;
+		base_curfr = fr;
+		proc_layout = label_layout->MR_sll_entry;
+		topfr = fr;
+		result = MR_stack_walk_step(proc_layout, &label_layout,
+				&base_sp, &base_curfr, &problem);
+
+		if (result != MR_STEP_OK) {
+			return problem;
+		}
+
+		if (label_layout == NULL) {
+			return NULL;
+		}
+
+		proc_layout = label_layout->MR_sll_entry;
+		determinism = proc_layout->MR_sle_detism;
+		if (MR_DETISM_DET_STACK(determinism)) {
+			/*
+			** We must have found the common ancestor of the
+			** procedure call whose variables we just printed
+			** and the call currently being executed. While this
+			** common ancestor must include model_non code, this
+			** may be inside a commit in a procedure that lives on
+			** the det stack. If that is the case, the common
+			** ancestor must not be put into MR_nondet_branch_info.
+			*/
+
+			return NULL;
+		}
+	}
+
+	if (! MR_find_matching_branch(base_curfr, &branch)) {
+		MR_ensure_room_for_next(MR_nondet_branch_info,
+			MR_Nondet_Branch_Info,
+			MR_INIT_NONDET_BRANCH_ARRAY_SIZE);
+		last = MR_nondet_branch_info_next;
+		MR_nondet_branch_infos[last].branch_layout = label_layout;
+		MR_nondet_branch_infos[last].branch_sp = base_sp;
+		MR_nondet_branch_infos[last].branch_curfr = base_curfr;
+		MR_nondet_branch_infos[last].branch_topfr = topfr;
+		MR_nondet_branch_info_next++;
+	} else if (base_sp != NULL &&
+		MR_nondet_branch_infos[last].branch_sp == NULL)
+	{
+		MR_fatal_error("common ancestor reached from "
+			"non-main branch first");
+	}
+
+	return NULL;
+}
+
+static bool
+MR_find_matching_branch(MR_Word *fr, int *branch_ptr)
+{
+	int	branch;
+
+	for (branch = 0; branch < MR_nondet_branch_info_next; branch++) {
+		if (MR_nondet_branch_infos[branch].branch_curfr == fr) {
+			*branch_ptr = branch;
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
+/*
+** The contents of a nondet stack frame which control will enter via
+** backtracking is described by the layout structure of the label at which
+** execution will resume inside the procedure. This need not be the label in
+** the redoip slot in the procedure's ordinary stack frame; if the procedure
+** created any temporary nondet stack frames, it will be the label in the
+** redoip slot of the top temporary nondet stack frame created by the
+** procedure.
+**
+** We record the contents of topmost temp frames as go past them, and erase the
+** records as we go past the ordinary frames to which they refer.
+*/
+
+typedef struct
+{
+	MR_Word		*temp_redofr;
+	MR_Code		*temp_redoip;
+} MR_Temp_Redoip;
+
+static MR_Temp_Redoip	*MR_temp_frame_infos = NULL;
+static int		MR_temp_frame_info_next = 0;
+static int		MR_temp_frame_info_max = 0;
+
+#define	MR_INIT_TEMP_REDOIP_ARRAY_SIZE	10
+
+static void
+MR_record_temp_redoip(MR_Word *fr)
+{
+	int	slot;
+
+	for (slot = 0; slot < MR_temp_frame_info_next; slot++) {
+		if (fr == MR_temp_frame_infos[slot].temp_redofr) {
+			/* this is not the top temp frame for this call */
+			return;
+		}
+	}
+
+	MR_ensure_room_for_next(MR_temp_frame_info, MR_Temp_Redoip,
+		MR_INIT_TEMP_REDOIP_ARRAY_SIZE);
+	slot = MR_temp_frame_info_next;
+	MR_temp_frame_infos[slot].temp_redofr = fr;
+	MR_temp_frame_infos[slot].temp_redoip = MR_redoip_slot(fr);
+	MR_temp_frame_info_next++;
+}
+
+static MR_Code *
+MR_find_temp_redoip(MR_Word *fr)
+{
+	int	slot;
+
+	for (slot = 0; slot < MR_temp_frame_info_next; slot++) {
+		if (fr == MR_temp_frame_infos[slot].temp_redofr) {
+			return MR_temp_frame_infos[slot].temp_redoip;
+		}
+	}
+
+	return NULL;
+}
+
+static void
+MR_erase_temp_redoip(MR_Word *fr)
+{
+	int	slot;
+	int	last;
+
+	for (slot = 0; slot < MR_temp_frame_info_next; slot++) {
+		if (fr == MR_temp_frame_infos[slot].temp_redofr) {
+			last = MR_temp_frame_info_next - 1;
+			MR_temp_frame_infos[slot].temp_redofr =
+				MR_temp_frame_infos[last].temp_redofr;
+			MR_temp_frame_infos[slot].temp_redoip =
+				MR_temp_frame_infos[last].temp_redoip;
+			MR_temp_frame_info_next--;
+			return;
+		}
+	}
+}
+
+/**************************************************************************/
 
 static	const MR_Proc_Layout	*prev_entry_layout;
 static	int			prev_entry_layout_count;
Index: runtime/mercury_stack_trace.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_trace.h,v
retrieving revision 1.25
diff -u -b -r1.25 mercury_stack_trace.h
--- runtime/mercury_stack_trace.h	2001/01/18 01:19:08	1.25
+++ runtime/mercury_stack_trace.h	2001/01/28 17:51:47
@@ -73,14 +73,22 @@
 				MR_Print_Stack_Record print_stack_record);
 
 /*
+** MR_dump_nondet_stack:
+**	This function dumps the control slots of the nondet stack.
+**	The output format is not meant to be intelligible to non-implementors.
+*/
+
+extern	void	MR_dump_nondet_stack(FILE *fp, MR_Word *maxfr);
+
+/*
 ** MR_dump_nondet_stack_from_layout:
-**	This function dumps the control control slots of the nondet stack.
+**	This function dumps the nondet stack.
 **	The output format is not meant to be intelligible to non-implementors.
-**	The value of maxfr should be in *base_maxfr.
 */
 
-extern	void	MR_dump_nondet_stack_from_layout(FILE *fp,
-			MR_Word *base_maxfr);
+extern	void	MR_dump_nondet_stack_from_layout(FILE *fp, MR_Word *maxfr,
+			const MR_Label_Layout *label_layout,
+			MR_Word *base_sp, MR_Word *base_curfr);
 
 /*
 ** MR_find_nth_ancestor:
@@ -112,18 +120,23 @@
 **	return_label_layout will be set to the stack_layout of the
 **	continuation label, or NULL if the bottom of the stack has
 **	been reached.
+**
+**	The meanings of the possible return values from MR_stack_walk_step
+**	are as follows:
+**
+**	MR_STEP_OK:		everything is fine.
+**	MR_STEP_ERROR_BEFORE:	entry_layout has no valid stack trace info.
+**	MR_STEP_ERROR_AFTER:	entry_layout has valid stack trace info,
+**				but its caller does not.
 **
-**	The meaning of the return value for MR_stack_walk_step is
-**	described in its type definition above.  If an error is
-**	encountered, problem_ptr will be set to a string representation
-**	of the error.
+**	If a MR_stack_walk_step encounters a problem, it will set problem_ptr
+**	to point to a string representation of the error.
 */
 
 typedef enum {
-	STEP_ERROR_BEFORE,      /* the current entry_layout has no valid info */
-	STEP_ERROR_AFTER,       /* the current entry_layout has valid info,
-				   but the next one does not */
-	STEP_OK                 /* both have valid info */
+	MR_STEP_ERROR_BEFORE,
+	MR_STEP_ERROR_AFTER,
+	MR_STEP_OK
 } MR_Stack_Walk_Step_Result;
 
 extern  MR_Stack_Walk_Step_Result
Index: runtime/mercury_tabling.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tabling.c,v
retrieving revision 1.42
diff -u -b -r1.42 mercury_tabling.c
--- runtime/mercury_tabling.c	2001/05/31 06:00:16	1.42
+++ runtime/mercury_tabling.c	2001/08/08 05:28:01
@@ -1102,7 +1102,7 @@
 
     #ifndef MR_HIGHLEVEL_CODE
 		if (MR_tablestackdebug) {
-			MR_dump_nondet_stack_from_layout(stdout, MR_maxfr);
+			MR_dump_nondet_stack(stdout, MR_maxfr);
 		}
     #endif
 	}
@@ -1956,7 +1956,7 @@
 
 MR_define_extern_entry(MR_table_nondet_commit);
 MR_BEGIN_MODULE(table_nondet_commit_module)
-	MR_init_entry_ai(MR_table_nondet_commit);
+	MR_init_entry_an(MR_table_nondet_commit);
 MR_BEGIN_CODE
 MR_define_entry(MR_table_nondet_commit);
 	MR_commit_cut();
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.35
diff -u -b -r1.35 mercury_trace_base.c
--- runtime/mercury_trace_base.c	2001/06/15 04:46:23	1.35
+++ runtime/mercury_trace_base.c	2001/08/08 05:24:34
@@ -351,8 +351,8 @@
 MR_define_extern_entry(MR_do_trace_redo_fail_deep);
 
 MR_BEGIN_MODULE(MR_trace_labels_module)
-	MR_init_entry_ai(MR_do_trace_redo_fail_shallow);
-	MR_init_entry_ai(MR_do_trace_redo_fail_deep);
+	MR_init_entry_an(MR_do_trace_redo_fail_shallow);
+	MR_init_entry_an(MR_do_trace_redo_fail_deep);
 MR_BEGIN_CODE
 
 MR_define_entry(MR_do_trace_redo_fail_shallow);
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.90
diff -u -b -r1.90 mercury_wrapper.c
--- runtime/mercury_wrapper.c	2001/07/04 06:01:53	1.90
+++ runtime/mercury_wrapper.c	2001/08/08 05:28:05
@@ -188,6 +188,9 @@
 
 char	*(*MR_address_of_trace_getline)(const char *, FILE *, FILE *);
 char	*(*MR_address_of_trace_get_command)(const char *, FILE *, FILE *);
+const char *
+	(*MR_address_of_trace_browse_all_on_level)(FILE *,
+		const MR_Label_Layout *, MR_Word *, MR_Word *, int);
 
 #ifdef	MR_USE_EXTERNAL_DEBUGGER
 void	(*MR_address_of_trace_init_external)(void);
@@ -1400,12 +1403,14 @@
 MR_declare_label(global_success);
 MR_declare_label(global_fail);
 MR_declare_label(all_done);
+MR_declare_label(wrapper_not_reached);
 
 MR_BEGIN_MODULE(interpreter_module)
-	MR_init_entry_ai(MR_do_interpreter);
-	MR_init_label_ai(global_success);
-	MR_init_label_ai(global_fail);
-	MR_init_label_ai(all_done);
+	MR_init_entry_an(MR_do_interpreter);
+	MR_init_label_an(global_success);
+	MR_init_label_an(global_fail);
+	MR_init_label_an(all_done);
+	MR_init_label_an(wrapper_not_reached);
 MR_BEGIN_CODE
 
 MR_define_entry(MR_do_interpreter);
@@ -1415,6 +1420,7 @@
 	MR_stackvar(3) = (MR_Word) MR_maxfr;
 	MR_stackvar(4) = (MR_Word) MR_curfr;
 
+	MR_succip = MR_LABEL(wrapper_not_reached);
 	MR_mkframe("interpreter", 1, MR_LABEL(global_fail));
 
 	MR_nondet_stack_trace_bottom = MR_maxfr;
@@ -1486,6 +1492,9 @@
 #ifndef	USE_GCC_NONLOCAL_GOTOS
 	return 0;
 #endif
+
+MR_define_label(wrapper_not_reached);
+	MR_fatal_error("reached wrapper_not_reached");
 MR_END_MODULE
 
 #endif
Index: runtime/mercury_wrapper.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.h,v
retrieving revision 1.43
diff -u -b -r1.43 mercury_wrapper.h
--- runtime/mercury_wrapper.h	2001/05/31 06:00:18	1.43
+++ runtime/mercury_wrapper.h	2001/05/31 06:11:07
@@ -111,6 +111,17 @@
 				FILE *, FILE *);
 
 /*
+** MR_trace_browse_all_on_level() is defined in trace/mercury_trace_vars.c
+** but may be called from runtime/mercury_stack_trace.c. As we can not do
+** direct calls from runtime/ to trace/, we do an indirect call via the
+** function pointer MR_address_of_trace_browse_all_on_level.
+*/
+
+extern	const char *	(*MR_address_of_trace_browse_all_on_level)(FILE *,
+				const MR_Label_Layout *, MR_Word *, MR_Word *,
+				int);
+
+/*
 ** MR_trace_init_external() and MR_trace_final_external() are defined 
 ** in trace/mercury_trace_external.c but are called in
 ** runtime/mercury_trace_base.c. As we can not do direct calls from
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
Index: tests/debugger/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/Mmakefile,v
retrieving revision 1.53
diff -u -b -r1.53 Mmakefile
--- tests/debugger/Mmakefile	2001/05/31 06:00:21	1.53
+++ tests/debugger/Mmakefile	2001/08/08 07:17:32
@@ -36,6 +36,7 @@
 	interpreter			\
 	loopcheck			\
 	multi_parameter			\
+	nondet_stack			\
 	output_term_dep			\
 	polymorphic_output		\
 	resume_typeinfos		\
@@ -217,6 +218,11 @@
 
 queens.out: queens queens.inp
 	$(MDB) ./queens < queens.inp > queens.out 2>&1
+
+nondet_stack.out: nondet_stack nondet_stack.inp
+	$(MDB) ./nondet_stack < nondet_stack.inp 2>&1 | \
+		sed 's/nondet_stack.m:[0-9]*/nondet_stack.m:NNNN/g' | \
+		> nondet_stack.out 2>&1
 
 resume_typeinfos.out: resume_typeinfos resume_typeinfos.inp
 	$(MDB) ./resume_typeinfos < resume_typeinfos.inp 2>&1 | \
Index: tests/debugger/nondet_stack.exp
===================================================================
RCS file: nondet_stack.exp
diff -N nondet_stack.exp
--- /dev/null	Fri Dec  1 02:25:58 2000
+++ nondet_stack.exp	Wed Aug  8 15:31:40 2001
@@ -0,0 +1,806 @@
+       1:      1  1 CALL pred nondet_stack:main/2-0 (cc_multi) nondet_stack.m:19
+mdb> echo on
+Command echo enabled.
+mdb> context none
+Contexts will not be printed.
+mdb> register --quiet
+mdb> goto 21
+      21:     10  6 SWTC pred nondet_stack:qperm/2-0 (nondet) s1;
+mdb> nondet_stack
+non 135: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 135 
+ succip: unnamed label
+ succfr: non 103 
+non 122: temp
+ redoip: label UNKNOWN
+ redofr: non 116 
+non 119: temp
+ redoip: unnamed label
+ redofr: non 116 
+non 116: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 116 
+ succip: unnamed label
+ succfr: non 103 
+non 103: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 103 
+ succip: unnamed label
+ succfr: non  71 
+non  90: temp
+ redoip: label UNKNOWN
+ redofr: non  84 
+non  87: temp
+ redoip: unnamed label
+ redofr: non  84 
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+non  58: temp
+ redoip: label UNKNOWN
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> stack_regs
+sp = det  14 
+curfr = non 135
+maxfr = non 135
+mdb> nondet_stack -d
+non 135: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 135 
+ succip: unnamed label
+ succfr: non 103 
+ on main nondet branch non 135
+       HeadVar__1             [4, 5]
+non 122: temp
+ redoip: label UNKNOWN
+ redofr: non 116 
+non 119: temp
+ redoip: unnamed label
+ redofr: non 116 
+non 116: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 116 
+ succip: unnamed label
+ succfr: non 103 
+ top frame of a nondet side branch non 116
+       HeadVar__2             [3, 4, 5]
+non 103: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 103 
+ succip: unnamed label
+ succfr: non  71 
+ on main nondet branch non 135
+       HeadVar__1             [3, 4, 5]
+       U                      3
+       Z                      [4, 5]
+non  90: temp
+ redoip: label UNKNOWN
+ redofr: non  84 
+non  87: temp
+ redoip: unnamed label
+ redofr: non  84 
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+ top frame of a nondet side branch non  84
+       HeadVar__2             [2, 3, 4, 5]
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+ on main nondet branch non 135
+       HeadVar__1             [2, 3, 4, 5]
+       U                      2
+       Z                      [3, 4, 5]
+non  58: temp
+ redoip: label UNKNOWN
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+ top frame of a nondet side branch non  52
+       HeadVar__2             [1, 2, 3, 4, 5]
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+ on main nondet branch non 135
+       HeadVar__1             [1, 2, 3, 4, 5]
+       U                      1
+       Z                      [2, 3, 4, 5]
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+ on main nondet branch non 135
+       HeadVar__1             [1, 2, 3, 4, 5]
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> goto 38
+      38:     15  3 CALL pred nondet_stack:safe/1-0 (semidet)
+mdb> nondet_stack
+non 217: temp
+ redoip: label UNKNOWN
+ redofr: non  39 
+non 214: temp
+ redoip: label UNKNOWN
+ redofr: non  71 
+non 211: temp
+ redoip: label UNKNOWN
+ redofr: non 103 
+non 208: temp
+ redoip: label UNKNOWN
+ redofr: non 135 
+non 205: temp
+ redoip: label UNKNOWN
+ redofr: non 167 
+non 202: temp
+ redoip: label UNKNOWN
+ redofr: non 199 
+non 199: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 199 
+ succip: unnamed label
+ succfr: non 167 
+non 186: temp
+ redoip: label UNKNOWN
+ redofr: non 180 
+non 183: temp
+ redoip: unnamed label
+ redofr: non 180 
+non 180: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 180 
+ succip: unnamed label
+ succfr: non 167 
+non 167: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 167 
+ succip: unnamed label
+ succfr: non 135 
+non 154: temp
+ redoip: label UNKNOWN
+ redofr: non 148 
+non 151: temp
+ redoip: unnamed label
+ redofr: non 148 
+non 148: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 148 
+ succip: unnamed label
+ succfr: non 135 
+non 135: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 135 
+ succip: unnamed label
+ succfr: non 103 
+non 122: temp
+ redoip: label UNKNOWN
+ redofr: non 116 
+non 119: temp
+ redoip: unnamed label
+ redofr: non 116 
+non 116: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 116 
+ succip: unnamed label
+ succfr: non 103 
+non 103: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 103 
+ succip: unnamed label
+ succfr: non  71 
+non  90: temp
+ redoip: label UNKNOWN
+ redofr: non  84 
+non  87: temp
+ redoip: unnamed label
+ redofr: non  84 
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+non  58: temp
+ redoip: label UNKNOWN
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> stack_regs
+sp = det  21 
+curfr = non  26
+maxfr = non 217
+mdb> nondet_stack -d
+non 217: temp
+ redoip: label UNKNOWN
+ redofr: non  39 
+non 214: temp
+ redoip: label UNKNOWN
+ redofr: non  71 
+non 211: temp
+ redoip: label UNKNOWN
+ redofr: non 103 
+non 208: temp
+ redoip: label UNKNOWN
+ redofr: non 135 
+non 205: temp
+ redoip: label UNKNOWN
+ redofr: non 167 
+non 202: temp
+ redoip: label UNKNOWN
+ redofr: non 199 
+non 199: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 199 
+ succip: unnamed label
+ succfr: non 167 
+ top frame of a nondet side branch non 199
+       HeadVar__1             []
+non 186: temp
+ redoip: label UNKNOWN
+ redofr: non 180 
+non 183: temp
+ redoip: unnamed label
+ redofr: non 180 
+non 180: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 180 
+ succip: unnamed label
+ succfr: non 167 
+ top frame of a nondet side branch non 180
+       HeadVar__2             [5]
+non 167: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 167 
+ succip: unnamed label
+ succfr: non 135 
+ internal frame on nondet side branch non 199
+       HeadVar__1             [5]
+       U                      5
+       Z                      []
+non 154: temp
+ redoip: label UNKNOWN
+ redofr: non 148 
+non 151: temp
+ redoip: unnamed label
+ redofr: non 148 
+non 148: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 148 
+ succip: unnamed label
+ succfr: non 135 
+ top frame of a nondet side branch non 148
+       HeadVar__2             [4, 5]
+non 135: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 135 
+ succip: unnamed label
+ succfr: non 103 
+ internal frame on nondet side branch non 199
+       HeadVar__1             [4, 5]
+       U                      4
+       Z                      [5]
+non 122: temp
+ redoip: label UNKNOWN
+ redofr: non 116 
+non 119: temp
+ redoip: unnamed label
+ redofr: non 116 
+non 116: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 116 
+ succip: unnamed label
+ succfr: non 103 
+ top frame of a nondet side branch non 116
+       HeadVar__2             [3, 4, 5]
+non 103: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 103 
+ succip: unnamed label
+ succfr: non  71 
+ internal frame on nondet side branch non 199
+       HeadVar__1             [3, 4, 5]
+       U                      3
+       Z                      [4, 5]
+non  90: temp
+ redoip: label UNKNOWN
+ redofr: non  84 
+non  87: temp
+ redoip: unnamed label
+ redofr: non  84 
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+ top frame of a nondet side branch non  84
+       HeadVar__2             [2, 3, 4, 5]
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+ internal frame on nondet side branch non 199
+       HeadVar__1             [2, 3, 4, 5]
+       U                      2
+       Z                      [3, 4, 5]
+non  58: temp
+ redoip: label UNKNOWN
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+ top frame of a nondet side branch non  52
+       HeadVar__2             [1, 2, 3, 4, 5]
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+ internal frame on nondet side branch non 199
+       HeadVar__1             [1, 2, 3, 4, 5]
+       U                      1
+       Z                      [2, 3, 4, 5]
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+ on main nondet branch non  26
+       HeadVar__1             [1, 2, 3, 4, 5]
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> break test
+ 0: + stop  interface pred nondet_stack:test/2-0 (nondet)
+mdb> continue
+     674:    141  2 CALL pred nondet_stack:test/2-0 (nondet)
+mdb> nondet_stack
+non 284: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non 284 
+ succip: unnamed label
+ succfr: non  10 
+non 272: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non 268: temp
+ redoip: label UNKNOWN
+ redofr: non  26 
+non 265: temp
+ redoip: label UNKNOWN
+ redofr: non  39 
+non 262: temp
+ redoip: label UNKNOWN
+ redofr: non  71 
+non 259: temp
+ redoip: label UNKNOWN
+ redofr: non 119 
+non 256: temp
+ redoip: label UNKNOWN
+ redofr: non 183 
+non 253: temp
+ redoip: label UNKNOWN
+ redofr: non 215 
+non 250: temp
+ redoip: label UNKNOWN
+ redofr: non 247 
+non 247: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 247 
+ succip: unnamed label
+ succfr: non 215 
+non 234: temp
+ redoip: label UNKNOWN
+ redofr: non 228 
+non 231: temp
+ redoip: unnamed label
+ redofr: non 228 
+non 228: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 228 
+ succip: unnamed label
+ succfr: non 215 
+non 215: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 215 
+ succip: unnamed label
+ succfr: non 183 
+non 202: temp
+ redoip: label UNKNOWN
+ redofr: non 196 
+non 199: temp
+ redoip: unnamed label
+ redofr: non 196 
+non 196: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 196 
+ succip: unnamed label
+ succfr: non 183 
+non 183: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 183 
+ succip: unnamed label
+ succfr: non 119 
+non 170: temp
+ redoip: label UNKNOWN
+ redofr: non 132 
+non 167: temp
+ redoip: label UNKNOWN
+ redofr: non 145 
+non 164: temp
+ redoip: label UNKNOWN
+ redofr: non 158 
+non 161: temp
+ redoip: unnamed label
+ redofr: non 158 
+non 158: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 158 
+ succip: unnamed label
+ succfr: non 145 
+non 145: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 145 
+ succip: unnamed label
+ succfr: non 132 
+non 132: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 132 
+ succip: unnamed label
+ succfr: non 119 
+non 119: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 119 
+ succip: unnamed label
+ succfr: non  71 
+non 106: temp
+ redoip: label UNKNOWN
+ redofr: non  84 
+non 103: temp
+ redoip: label UNKNOWN
+ redofr: non  97 
+non 100: temp
+ redoip: unnamed label
+ redofr: non  97 
+non  97: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  97 
+ succip: unnamed label
+ succfr: non  84 
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+non  58: temp
+ redoip: label UNKNOWN
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> stack_regs
+sp = det  14 
+curfr = non 284
+maxfr = non 284
+mdb> nondet_stack -d
+non 284: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non 284 
+ succip: unnamed label
+ succfr: non  10 
+ on main nondet branch non 284
+       HeadVar__1             [1, 3, 5, 2, 4]
+non 272: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non 268: temp
+ redoip: label UNKNOWN
+ redofr: non  26 
+non 265: temp
+ redoip: label UNKNOWN
+ redofr: non  39 
+non 262: temp
+ redoip: label UNKNOWN
+ redofr: non  71 
+non 259: temp
+ redoip: label UNKNOWN
+ redofr: non 119 
+non 256: temp
+ redoip: label UNKNOWN
+ redofr: non 183 
+non 253: temp
+ redoip: label UNKNOWN
+ redofr: non 215 
+non 250: temp
+ redoip: label UNKNOWN
+ redofr: non 247 
+non 247: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 247 
+ succip: unnamed label
+ succfr: non 215 
+ top frame of a nondet side branch non 247
+       HeadVar__1             []
+non 234: temp
+ redoip: label UNKNOWN
+ redofr: non 228 
+non 231: temp
+ redoip: unnamed label
+ redofr: non 228 
+non 228: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 228 
+ succip: unnamed label
+ succfr: non 215 
+ top frame of a nondet side branch non 228
+       HeadVar__2             [4]
+non 215: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 215 
+ succip: unnamed label
+ succfr: non 183 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [4]
+       U                      4
+       Z                      []
+non 202: temp
+ redoip: label UNKNOWN
+ redofr: non 196 
+non 199: temp
+ redoip: unnamed label
+ redofr: non 196 
+non 196: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 196 
+ succip: unnamed label
+ succfr: non 183 
+ top frame of a nondet side branch non 196
+       HeadVar__2             [2, 4]
+non 183: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 183 
+ succip: unnamed label
+ succfr: non 119 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [2, 4]
+       U                      2
+       Z                      [4]
+non 170: temp
+ redoip: label UNKNOWN
+ redofr: non 132 
+non 167: temp
+ redoip: label UNKNOWN
+ redofr: non 145 
+non 164: temp
+ redoip: label UNKNOWN
+ redofr: non 158 
+non 161: temp
+ redoip: unnamed label
+ redofr: non 158 
+non 158: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 158 
+ succip: unnamed label
+ succfr: non 145 
+ top frame of a nondet side branch non 158
+       HeadVar__2             [5]
+non 145: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 145 
+ succip: unnamed label
+ succfr: non 132 
+ internal frame on nondet side branch non 158
+       HeadVar__2             [4, 5]
+non 132: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 132 
+ succip: unnamed label
+ succfr: non 119 
+ internal frame on nondet side branch non 158
+       HeadVar__2             [2, 4, 5]
+non 119: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 119 
+ succip: unnamed label
+ succfr: non  71 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [2, 4, 5]
+       U                      5
+       Z                      [2, 4]
+non 106: temp
+ redoip: label UNKNOWN
+ redofr: non  84 
+non 103: temp
+ redoip: label UNKNOWN
+ redofr: non  97 
+non 100: temp
+ redoip: unnamed label
+ redofr: non  97 
+non  97: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  97 
+ succip: unnamed label
+ succfr: non  84 
+ top frame of a nondet side branch non  97
+       HeadVar__2             [3, 4, 5]
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+ internal frame on nondet side branch non  97
+       HeadVar__2             [2, 3, 4, 5]
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [2, 3, 4, 5]
+       U                      3
+       Z                      [2, 4, 5]
+non  58: temp
+ redoip: label UNKNOWN
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+ top frame of a nondet side branch non  52
+       HeadVar__2             [1, 2, 3, 4, 5]
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [1, 2, 3, 4, 5]
+       U                      1
+       Z                      [2, 3, 4, 5]
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [1, 2, 3, 4, 5]
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> continue -S
+[2, 5, 3, 1, 4]
Index: tests/debugger/nondet_stack.exp2
===================================================================
RCS file: nondet_stack.exp2
diff -N nondet_stack.exp2
--- /dev/null	Fri Dec  1 02:25:58 2000
+++ nondet_stack.exp2	Wed Aug  8 15:37:50 2001
@@ -0,0 +1,806 @@
+       1:      1  1 CALL pred nondet_stack:main/2-0 (cc_multi) nondet_stack.m:19
+mdb> echo on
+Command echo enabled.
+mdb> context none
+Contexts will not be printed.
+mdb> register --quiet
+mdb> goto 21
+      21:     10  6 SWTC pred nondet_stack:qperm/2-0 (nondet) s1;
+mdb> nondet_stack
+non 135: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 135 
+ succip: unnamed label
+ succfr: non 103 
+non 122: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 116 
+non 119: temp
+ redoip: unnamed label
+ redofr: non 116 
+non 116: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 116 
+ succip: unnamed label
+ succfr: non 103 
+non 103: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 103 
+ succip: unnamed label
+ succfr: non  71 
+non  90: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  84 
+non  87: temp
+ redoip: unnamed label
+ redofr: non  84 
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+non  58: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> stack_regs
+sp = det  14 
+curfr = non 135
+maxfr = non 135
+mdb> nondet_stack -d
+non 135: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 135 
+ succip: unnamed label
+ succfr: non 103 
+ on main nondet branch non 135
+       HeadVar__1             [4, 5]
+non 122: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 116 
+non 119: temp
+ redoip: unnamed label
+ redofr: non 116 
+non 116: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 116 
+ succip: unnamed label
+ succfr: non 103 
+ top frame of a nondet side branch non 116
+       HeadVar__2             [3, 4, 5]
+non 103: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 103 
+ succip: unnamed label
+ succfr: non  71 
+ on main nondet branch non 135
+       HeadVar__1             [3, 4, 5]
+       U                      3
+       Z                      [4, 5]
+non  90: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  84 
+non  87: temp
+ redoip: unnamed label
+ redofr: non  84 
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+ top frame of a nondet side branch non  84
+       HeadVar__2             [2, 3, 4, 5]
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+ on main nondet branch non 135
+       HeadVar__1             [2, 3, 4, 5]
+       U                      2
+       Z                      [3, 4, 5]
+non  58: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+ top frame of a nondet side branch non  52
+       HeadVar__2             [1, 2, 3, 4, 5]
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+ on main nondet branch non 135
+       HeadVar__1             [1, 2, 3, 4, 5]
+       U                      1
+       Z                      [2, 3, 4, 5]
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+ on main nondet branch non 135
+       HeadVar__1             [1, 2, 3, 4, 5]
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> goto 38
+      38:     15  3 CALL pred nondet_stack:safe/1-0 (semidet)
+mdb> nondet_stack
+non 217: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  39 
+non 214: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  71 
+non 211: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 103 
+non 208: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 135 
+non 205: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 167 
+non 202: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 199 
+non 199: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 199 
+ succip: unnamed label
+ succfr: non 167 
+non 186: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 180 
+non 183: temp
+ redoip: unnamed label
+ redofr: non 180 
+non 180: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 180 
+ succip: unnamed label
+ succfr: non 167 
+non 167: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 167 
+ succip: unnamed label
+ succfr: non 135 
+non 154: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 148 
+non 151: temp
+ redoip: unnamed label
+ redofr: non 148 
+non 148: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 148 
+ succip: unnamed label
+ succfr: non 135 
+non 135: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 135 
+ succip: unnamed label
+ succfr: non 103 
+non 122: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 116 
+non 119: temp
+ redoip: unnamed label
+ redofr: non 116 
+non 116: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 116 
+ succip: unnamed label
+ succfr: non 103 
+non 103: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 103 
+ succip: unnamed label
+ succfr: non  71 
+non  90: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  84 
+non  87: temp
+ redoip: unnamed label
+ redofr: non  84 
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+non  58: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> stack_regs
+sp = det  21 
+curfr = non  26
+maxfr = non 217
+mdb> nondet_stack -d
+non 217: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  39 
+non 214: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  71 
+non 211: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 103 
+non 208: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 135 
+non 205: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 167 
+non 202: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 199 
+non 199: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 199 
+ succip: unnamed label
+ succfr: non 167 
+ top frame of a nondet side branch non 199
+       HeadVar__1             []
+non 186: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 180 
+non 183: temp
+ redoip: unnamed label
+ redofr: non 180 
+non 180: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 180 
+ succip: unnamed label
+ succfr: non 167 
+ top frame of a nondet side branch non 180
+       HeadVar__2             [5]
+non 167: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 167 
+ succip: unnamed label
+ succfr: non 135 
+ internal frame on nondet side branch non 199
+       HeadVar__1             [5]
+       U                      5
+       Z                      []
+non 154: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 148 
+non 151: temp
+ redoip: unnamed label
+ redofr: non 148 
+non 148: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 148 
+ succip: unnamed label
+ succfr: non 135 
+ top frame of a nondet side branch non 148
+       HeadVar__2             [4, 5]
+non 135: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 135 
+ succip: unnamed label
+ succfr: non 103 
+ internal frame on nondet side branch non 199
+       HeadVar__1             [4, 5]
+       U                      4
+       Z                      [5]
+non 122: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 116 
+non 119: temp
+ redoip: unnamed label
+ redofr: non 116 
+non 116: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 116 
+ succip: unnamed label
+ succfr: non 103 
+ top frame of a nondet side branch non 116
+       HeadVar__2             [3, 4, 5]
+non 103: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 103 
+ succip: unnamed label
+ succfr: non  71 
+ internal frame on nondet side branch non 199
+       HeadVar__1             [3, 4, 5]
+       U                      3
+       Z                      [4, 5]
+non  90: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  84 
+non  87: temp
+ redoip: unnamed label
+ redofr: non  84 
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+ top frame of a nondet side branch non  84
+       HeadVar__2             [2, 3, 4, 5]
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+ internal frame on nondet side branch non 199
+       HeadVar__1             [2, 3, 4, 5]
+       U                      2
+       Z                      [3, 4, 5]
+non  58: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+ top frame of a nondet side branch non  52
+       HeadVar__2             [1, 2, 3, 4, 5]
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+ internal frame on nondet side branch non 199
+       HeadVar__1             [1, 2, 3, 4, 5]
+       U                      1
+       Z                      [2, 3, 4, 5]
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+ on main nondet branch non  26
+       HeadVar__1             [1, 2, 3, 4, 5]
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> break test
+ 0: + stop  interface pred nondet_stack:test/2-0 (nondet)
+mdb> continue
+     674:    141  2 CALL pred nondet_stack:test/2-0 (nondet)
+mdb> nondet_stack
+non 284: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non 284 
+ succip: unnamed label
+ succfr: non  10 
+non 272: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non 268: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  26 
+non 265: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  39 
+non 262: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  71 
+non 259: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 119 
+non 256: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 183 
+non 253: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 215 
+non 250: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 247 
+non 247: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 247 
+ succip: unnamed label
+ succfr: non 215 
+non 234: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 228 
+non 231: temp
+ redoip: unnamed label
+ redofr: non 228 
+non 228: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 228 
+ succip: unnamed label
+ succfr: non 215 
+non 215: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 215 
+ succip: unnamed label
+ succfr: non 183 
+non 202: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 196 
+non 199: temp
+ redoip: unnamed label
+ redofr: non 196 
+non 196: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 196 
+ succip: unnamed label
+ succfr: non 183 
+non 183: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 183 
+ succip: unnamed label
+ succfr: non 119 
+non 170: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 132 
+non 167: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 145 
+non 164: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 158 
+non 161: temp
+ redoip: unnamed label
+ redofr: non 158 
+non 158: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 158 
+ succip: unnamed label
+ succfr: non 145 
+non 145: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 145 
+ succip: unnamed label
+ succfr: non 132 
+non 132: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 132 
+ succip: unnamed label
+ succfr: non 119 
+non 119: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 119 
+ succip: unnamed label
+ succfr: non  71 
+non 106: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  84 
+non 103: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  97 
+non 100: temp
+ redoip: unnamed label
+ redofr: non  97 
+non  97: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  97 
+ succip: unnamed label
+ succfr: non  84 
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+non  58: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> stack_regs
+sp = det  14 
+curfr = non 284
+maxfr = non 284
+mdb> nondet_stack -d
+non 284: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non 284 
+ succip: unnamed label
+ succfr: non  10 
+ on main nondet branch non 284
+       HeadVar__1             [1, 3, 5, 2, 4]
+non 272: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non 268: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  26 
+non 265: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  39 
+non 262: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  71 
+non 259: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 119 
+non 256: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 183 
+non 253: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 215 
+non 250: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 247 
+non 247: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 247 
+ succip: unnamed label
+ succfr: non 215 
+ top frame of a nondet side branch non 247
+       HeadVar__1             []
+non 234: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 228 
+non 231: temp
+ redoip: unnamed label
+ redofr: non 228 
+non 228: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 228 
+ succip: unnamed label
+ succfr: non 215 
+ top frame of a nondet side branch non 228
+       HeadVar__2             [4]
+non 215: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 215 
+ succip: unnamed label
+ succfr: non 183 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [4]
+       U                      4
+       Z                      []
+non 202: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 196 
+non 199: temp
+ redoip: unnamed label
+ redofr: non 196 
+non 196: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 196 
+ succip: unnamed label
+ succfr: non 183 
+ top frame of a nondet side branch non 196
+       HeadVar__2             [2, 4]
+non 183: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 183 
+ succip: unnamed label
+ succfr: non 119 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [2, 4]
+       U                      2
+       Z                      [4]
+non 170: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 132 
+non 167: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 145 
+non 164: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non 158 
+non 161: temp
+ redoip: unnamed label
+ redofr: non 158 
+non 158: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 158 
+ succip: unnamed label
+ succfr: non 145 
+ top frame of a nondet side branch non 158
+       HeadVar__2             [5]
+non 145: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 145 
+ succip: unnamed label
+ succfr: non 132 
+ internal frame on nondet side branch non 158
+       HeadVar__2             [4, 5]
+non 132: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 132 
+ succip: unnamed label
+ succfr: non 119 
+ internal frame on nondet side branch non 158
+       HeadVar__2             [2, 4, 5]
+non 119: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non 119 
+ succip: unnamed label
+ succfr: non  71 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [2, 4, 5]
+       U                      5
+       Z                      [2, 4]
+non 106: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  84 
+non 103: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  97 
+non 100: temp
+ redoip: unnamed label
+ redofr: non  97 
+non  97: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  97 
+ succip: unnamed label
+ succfr: non  84 
+ top frame of a nondet side branch non  97
+       HeadVar__2             [3, 4, 5]
+non  84: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  84 
+ succip: unnamed label
+ succfr: non  71 
+ internal frame on nondet side branch non  97
+       HeadVar__2             [2, 3, 4, 5]
+non  71: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  71 
+ succip: unnamed label
+ succfr: non  39 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [2, 3, 4, 5]
+       U                      3
+       Z                      [2, 4, 5]
+non  58: temp
+ redoip: entry label MR_do_trace_redo_fail_deep
+ redofr: non  52 
+non  55: temp
+ redoip: unnamed label
+ redofr: non  52 
+non  52: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  52 
+ succip: unnamed label
+ succfr: non  39 
+ top frame of a nondet side branch non  52
+       HeadVar__2             [1, 2, 3, 4, 5]
+non  39: ordinary, 13 words
+ redoip: unnamed label
+ redofr: non  39 
+ succip: unnamed label
+ succfr: non  26 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [1, 2, 3, 4, 5]
+       U                      1
+       Z                      [2, 3, 4, 5]
+non  26: ordinary, 12 words
+ redoip: unnamed label
+ redofr: non  26 
+ succip: unnamed label
+ succfr: non  10 
+ internal frame on nondet side branch non 247
+       HeadVar__1             [1, 2, 3, 4, 5]
+non  14: temp
+ redoip: label UNKNOWN
+ redofr: non  10 
+ detfr: det  14  
+non  10: ordinary, 6 words
+ redoip: label global_fail
+ redofr: non  10 
+ succip: label wrapper_not_reached
+ succfr: non   4 
+mdb> continue -S
+[2, 5, 3, 1, 4]
Index: tests/debugger/nondet_stack.inp
===================================================================
RCS file: nondet_stack.inp
diff -N nondet_stack.inp
--- /dev/null	Fri Dec  1 02:25:58 2000
+++ nondet_stack.inp	Tue Jan 30 13:13:16 2001
@@ -0,0 +1,17 @@
+echo on
+context none
+register --quiet
+goto 21
+nondet_stack
+stack_regs
+nondet_stack -d
+goto 38
+nondet_stack
+stack_regs
+nondet_stack -d
+break test
+continue
+nondet_stack
+stack_regs
+nondet_stack -d
+continue -S
Index: tests/debugger/nondet_stack.m
===================================================================
RCS file: nondet_stack.m
diff -N nondet_stack.m
--- /dev/null	Fri Dec  1 02:25:58 2000
+++ nondet_stack.m	Wed Jan 31 00:00:58 2001
@@ -0,0 +1,116 @@
+% This is a test case designed to exercise the command "nondet_stack -d".
+
+:- module nondet_stack.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io__state, io__state).
+:- mode main(di, uo) is cc_multi.
+
+:- implementation.
+
+:- import_module list, int.
+
+main -->
+	( { data(Data), queen(Data, Out), test(Out, _) } ->
+		print_list(Out)
+	;
+		io__write_string("No solution\n")
+	).
+
+:- pred data(list(int)).
+:- mode data(out) is det.
+
+data([1,2,3,4,5]).
+
+:- pred test(list(int), int).
+:- mode test(in, out) is nondet.
+
+test([H | T], X) :-
+	(
+		H = 2,
+		X = 2
+	;
+		H = 3,
+		( X = 3 ; X = 4 )
+	),
+	T = [5 | _].
+
+:- pred queen(list(int), list(int)).
+:- mode queen(in, out) is nondet.
+
+queen(Data, Out) :-
+	qperm(Data, Out),
+	safe(Out).
+
+:- pred qperm(list(T), list(T)).
+:- mode qperm(in, out) is nondet.
+
+qperm([], []).
+qperm([X|Y], K) :-
+	qdelete(U, [X|Y], Z),
+	K = [U|V],
+	qperm(Z, V).
+
+:- pred qdelete(T, list(T), list(T)).
+:- mode qdelete(out, in, out) is nondet.
+
+qdelete(A, [A|L], L).
+qdelete(X, [A|Z], [A|R]) :-
+	qdelete(X, Z, R).
+
+:- pred safe(list(int)).
+:- mode safe(in) is semidet.
+
+safe([]).
+safe([N|L]) :-
+	nodiag(N, 1, L),
+	safe(L).
+
+:- pred nodiag(int, int, list(int)).
+:- mode nodiag(in, in, in) is semidet.
+
+nodiag(_, _, []).
+nodiag(B, D, [N|L]) :-
+	NmB is N - B,
+	BmN is B - N,
+	( D = NmB ->
+		fail
+	; D = BmN ->
+		fail
+	;
+		true
+	),
+	D1 is D + 1,
+	nodiag(B, D1, L).
+
+:- pred print_list(list(int), io__state, io__state).
+:- mode print_list(in, di, uo) is det.
+
+print_list(Xs) -->
+	(
+		{ Xs = [] }
+	->
+		io__write_string("[]\n")
+	;
+		io__write_string("["),
+		print_list_2(Xs),
+		io__write_string("]\n")
+	).
+
+:- pred print_list_2(list(int), io__state, io__state).
+:- mode print_list_2(in, di, uo) is det.
+
+print_list_2([]) --> [].
+print_list_2([X|Xs]) --> 
+	io__write_int(X),
+	(
+		{ Xs = [] }
+	->
+		[]
+	;
+		io__write_string(", "),
+		print_list_2(Xs)
+	).
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.44
diff -u -b -r1.44 mercury_trace.c
--- trace/mercury_trace.c	2001/07/03 15:22:18	1.44
+++ trace/mercury_trace.c	2001/07/09 05:01:46
@@ -814,6 +814,11 @@
 
 	event_info->MR_max_mr_num = max(event_info->MR_max_mr_num, arg_max);
 	*jumpaddr = level_layout->MR_sle_code_addr;
+#ifdef	MR_DEBUG_RETRY
+	printf("jumpaddr is ");
+	MR_print_label(stdout, *jumpaddr);
+	printf("\n");
+#endif
 
 	/*
 	** Overriding MR_trace_call_seqno etc is not enough, because
@@ -969,7 +974,7 @@
 	for (i = 0; i < ancestor_level; i++) {
 		result = MR_stack_walk_step(level_layout, &return_label_layout,
 				base_sp_ptr, base_curfr_ptr, problem);
-		if (result != STEP_OK || return_label_layout == NULL) {
+		if (result != MR_STEP_OK || return_label_layout == NULL) {
 			if (*problem == NULL) {
 				*problem = "not that many ancestors";
 			} else if (streq(*problem, "reached unknown label")) {
Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.59
diff -u -b -r1.59 mercury_trace_external.c
--- trace/mercury_trace_external.c	2001/07/05 08:05:34	1.59
+++ trace/mercury_trace_external.c	2001/07/09 05:01:46
@@ -669,10 +669,10 @@
 				** printlabel(), so we would need to define new
 				** fprintf() and printlabel() and pass them
 				** down as parameters of
-				** MR_dump_nondet_stack_from_layout() (as we do
+				** MR_dump_nondet_stack() (as we do
 				** with MR_dump_stack_record_print()).
 				*/						
-				MR_dump_nondet_stack_from_layout(stdout,
+				MR_dump_nondet_stack(stdout,
 					MR_saved_maxfr(saved_regs));
 				MR_send_message_to_socket("ok");
 				break;
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.106
diff -u -b -r1.106 mercury_trace_internal.c
--- trace/mercury_trace_internal.c	2001/08/07 02:16:05	1.106
+++ trace/mercury_trace_internal.c	2001/08/07 02:26:39
@@ -1978,10 +1978,29 @@
 		}
 #endif	/* MR_TRACE_HISTOGRAM */
 	} else if (streq(words[0], "nondet_stack")) {
-		if (word_count == 1) {
+		bool	detailed;
+
+		detailed = FALSE;
+		if (! MR_trace_options_detailed(&detailed,
+			&words, &word_count, "browsing", "nondet_stack"))
+		{
+			; /* the usage message has already been printed */
+		} else if (word_count == 1) {
 			MR_trace_init_modules();
+			if (detailed) {
+				int	saved_level;
+
+				saved_level = MR_trace_current_level();
 			MR_dump_nondet_stack_from_layout(MR_mdb_out,
+					MR_saved_maxfr(saved_regs),
+					layout,
+					MR_saved_sp(saved_regs),
+					MR_saved_curfr(saved_regs));
+				MR_trace_set_level(saved_level);
+			} else {
+				MR_dump_nondet_stack(MR_mdb_out,
 				MR_saved_maxfr(saved_regs));
+			}
 		} else {
 			MR_trace_usage("developer", "nondet_stack");
 		}
Index: trace/mercury_trace_vars.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_vars.c,v
retrieving revision 1.26
diff -u -b -r1.26 mercury_trace_vars.c
--- trace/mercury_trace_vars.c	2001/05/31 06:00:26	1.26
+++ trace/mercury_trace_vars.c	2001/06/13 08:21:29
@@ -239,6 +239,31 @@
 	MR_Word				*base_curfr;
 	const MR_Label_Layout		*top_layout;
 	const MR_Label_Layout		*level_layout;
+
+	problem = NULL;
+	top_layout = MR_point.MR_point_top_layout;
+	base_sp = MR_saved_sp(MR_point.MR_point_top_saved_regs);
+	base_curfr = MR_saved_curfr(MR_point.MR_point_top_saved_regs);
+	level_layout = MR_find_nth_ancestor(top_layout, ancestor_level,
+			&base_sp, &base_curfr, &problem);
+
+	if (level_layout != NULL) {
+		return MR_trace_set_level_from_layout(level_layout,
+				base_sp, base_curfr, ancestor_level);
+	} else {
+		if (problem == NULL) {
+			MR_fatal_error("MR_find_nth_ancestor failed "
+					"without reporting a problem");
+		}
+
+		return problem;
+	}
+}
+
+const char *
+MR_trace_set_level_from_layout(const MR_Label_Layout *level_layout,
+	MR_Word *base_sp, MR_Word *base_curfr, int ancestor_level)
+{
 	const MR_Proc_Layout		*entry;
 	MR_Word				*valid_saved_regs;
 	int				var_count;
@@ -258,28 +283,12 @@
 	const char			*filename;
 	int				linenumber;
 
-	problem = NULL;
-	top_layout = MR_point.MR_point_top_layout;
-	base_sp = MR_saved_sp(MR_point.MR_point_top_saved_regs);
-	base_curfr = MR_saved_curfr(MR_point.MR_point_top_saved_regs);
-	level_layout = MR_find_nth_ancestor(top_layout, ancestor_level,
-			&base_sp, &base_curfr, &problem);
-
-	if (level_layout != NULL) {
 		entry = level_layout->MR_sll_entry;
 		if (! MR_PROC_LAYOUT_HAS_EXEC_TRACE(entry)) {
 			return "this procedure does not have "
 				"debugging information";
 		}
-	} else {
-		if (problem == NULL) {
-			MR_fatal_error("MR_find_nth_ancestor failed "
-					"without reporting a problem");
-		}
 
-		return problem;
-	}
-
 	if (! MR_has_valid_var_count(level_layout)) {
 		return "there is no information about live variables";
 	}
@@ -325,8 +334,9 @@
 		return "there are no names for the live variables";
 	}
 
-	if (ancestor_level == 0 &&
-			MR_point.MR_point_top_port != MR_PORT_EXCEPTION)
+	if (MR_saved_curfr(MR_point.MR_point_top_saved_regs) == base_curfr
+		&& MR_saved_sp(MR_point.MR_point_top_saved_regs) == base_sp
+		&& MR_point.MR_point_top_port != MR_PORT_EXCEPTION)
 	{
 		valid_saved_regs = MR_point.MR_point_top_saved_regs;
 	} else {
@@ -834,6 +844,22 @@
 	}
 
 	return NULL;
+}
+
+const char *
+MR_trace_browse_all_on_level(FILE *out, const MR_Label_Layout *level_layout,
+	MR_Word *base_sp, MR_Word *base_curfr, int ancestor_level)
+{
+	const char	*problem;
+
+	problem = MR_trace_set_level_from_layout(level_layout,
+			base_sp, base_curfr, ancestor_level);
+	if (problem != NULL) {
+		return problem;
+	}
+
+	return MR_trace_browse_all(out, MR_trace_print,
+		MR_BROWSE_DEFAULT_FORMAT);
 }
 
 /* ML_arg() is defined in std_util.m */
Index: trace/mercury_trace_vars.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_vars.h,v
retrieving revision 1.12
diff -u -b -r1.12 mercury_trace_vars.h
--- trace/mercury_trace_vars.h	2001/02/13 08:28:28	1.12
+++ trace/mercury_trace_vars.h	2001/02/16 04:22:06
@@ -10,10 +10,11 @@
 ** MR_trace_init_point_vars to initialize this module's data structures
 ** to reflect the variables that are live at that event. During the processing
 ** of the various debugger commands while at that event, the debugger may
-** call MR_trace_set_level zero or more times to change this module's notion
-** of the "current" set of variables to refer instead to the variables that
-** are live at the return address in a given ancestor. This module maintains
-** its own record of what the current ancestor level is; the enquiry function
+** call MR_trace_set_level or its MR_trace_set_level_from_layout variant
+** zero or more times to change this module's notion of the "current" set
+** of variables to refer instead to the variables that are live at the
+** return address in a given ancestor. This module maintains its own record
+** of what the current ancestor level is; the enquiry function
 ** MR_trace_current_level returns this information, while enquiry function
 ** MR_trace_current_level_details returns information about this level.
 **
@@ -60,6 +61,10 @@
 				const MR_Label_Layout *top_layout,
 				MR_Word *saved_regs, MR_Trace_Port port);
 extern	const char	*MR_trace_set_level(int ancestor_level);
+extern	const char	*MR_trace_set_level_from_layout(
+				const MR_Label_Layout *level_layout,
+				MR_Word *base_sp, MR_Word *base_curfr,
+				int ancestor_level);
 extern	int		MR_trace_current_level(void);
 extern	void		MR_trace_current_level_details(
 				const MR_Proc_Layout **entry_ptr,
@@ -136,5 +141,16 @@
 
 extern	const char 	*MR_trace_browse_all(FILE *out, MR_Browser browser,
 				MR_Browse_Format format);
+
+/*
+** Sets the current set of variables to be ones live at the program point
+** referred to by level_layout, base_sp and base_curfr arguments, and then
+** prints them all.
+*/
+
+extern	const char	*MR_trace_browse_all_on_level(FILE *out,
+				const MR_Label_Layout *level_layout,
+				MR_Word *base_sp, MR_Word *base_curfr,
+				int ancestor_level);
 
 #endif	/* MERCURY_TRACE_VARS_H */
cvs diff: Diffing util
Index: util/mkinit.c
===================================================================
RCS file: /home/mercury1/repository/mercury/util/mkinit.c,v
retrieving revision 1.77
diff -u -b -r1.77 mkinit.c
--- util/mkinit.c	2001/05/31 06:00:27	1.77
+++ util/mkinit.c	2001/05/31 06:11:20
@@ -293,6 +293,8 @@
 	"	MR_register_module_layout = MR_register_module_layout_real;\n"
 	"	MR_address_of_trace_getline = MR_trace_getline;\n"
 	"	MR_address_of_trace_get_command = MR_trace_get_command;\n"
+	"	MR_address_of_trace_browse_all_on_level =\n"
+	"		MR_trace_browse_all_on_level;\n"
 	"	MR_address_of_trace_interrupt_handler =\n"
 	"		MR_trace_interrupt_handler;\n"
 	"  #ifdef MR_USE_EXTERNAL_DEBUGGER\n"
@@ -304,6 +306,7 @@
 	"	MR_register_module_layout = NULL;\n"
 	"	MR_address_of_trace_getline = NULL;\n"
 	"	MR_address_of_trace_get_command = NULL;\n"
+	"	MR_address_of_trace_browse_all_on_level = NULL;\n"
 	"	MR_address_of_trace_interrupt_handler = NULL;\n"
 	"  #ifdef MR_USE_EXTERNAL_DEBUGGER\n"
 	"	MR_address_of_trace_init_external = NULL;\n"
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list