[m-rev.] For review: changes to declarative debugger (Part 2)

Ian MacLarty maclarty at cs.mu.OZ.AU
Wed Sep 29 14:14:20 AEST 2004


Index: browser/mdb.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/mdb.m,v
retrieving revision 1.14
diff -u -r1.14 mdb.m
--- browser/mdb.m	9 Aug 2004 03:05:20 -0000	1.14
+++ browser/mdb.m	26 Sep 2004 05:59:09 -0000
@@ -28,6 +28,7 @@
 :- implementation.
 
 :- include_module declarative_analyser.
+:- include_module declarative_edt.
 :- include_module declarative_oracle.
 :- include_module declarative_tree.
 :- include_module declarative_user.
Index: browser/program_representation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/program_representation.m,v
retrieving revision 1.11
diff -u -r1.11 program_representation.m
--- browser/program_representation.m	27 Oct 2003 06:00:32 -0000	1.11
+++ browser/program_representation.m	28 Sep 2004 02:44:13 -0000
@@ -33,7 +33,7 @@
 
 :- interface.
 
-:- import_module char, list, std_util.
+:- import_module char, list, std_util, bool.
 
 	% A representation of the goal we execute.  These need to be
 	% generated statically and stored inside the executable.
@@ -123,6 +123,11 @@
 			string,			% name of called pred's module
 			string,			% name of the called pred
 			list(var_rep)		% the call's arguments
+		)
+	;	builtin_call_rep(
+			string,			% name of called pred's module
+			string,			% name of the called pred
+			list(var_rep)		% the call's arguments
 		).
 
 :- type var_rep	==	int.
@@ -145,11 +150,25 @@
 	%
 :- func atomic_goal_generates_event(atomic_goal_rep) = maybe(list(var_rep)).
 
+	% If the given goal generates internal events directly then this
+	% function will return yes and no otherwise. 
+	%
+:- func goal_generates_internal_event(goal_rep) = bool.
+
 	% call_is_primitive(ModuleName, PredName): succeeds iff a call to the
 	% named predicate behaves like a primitive operation, in the sense that
 	% it does not generate events.
 :- pred call_is_primitive(string::in, string::in) is semidet.
 
+	% The atomic goals module, name and arity
+:- type atomic_goal_id 
+	---> atomic_goal_id(string, string, int).
+
+	% Can we find out the atomic goals name, module and arity from
+	% its atomic_goal_rep?  If so return them, otherwise return no.
+:- func atomic_goal_identifiable(atomic_goal_rep) = 
+	maybe(atomic_goal_id).
+
 %-----------------------------------------------------------------------------%
 
 	% The following three types are derived from compiler/hlds_goal.m.
@@ -192,7 +211,12 @@
 :- type arg_pos
 	--->	user_head_var(int)	% Nth in the list of arguments after
 					% filtering out non-user-visible vars.
-	;	any_head_var(int).	% Nth in the list of all arguments.
+	;	any_head_var(int)	% Nth in the list of all arguments.
+			
+			% (M-N+1)th argument in the list of all arguments,
+			% where N is the value of the int in the constructor
+			% and M is the total number of arguments.
+	;	any_head_var_from_back(int).
 
 	% A particular subterm within a term is represented by a term_path.
 	% This is the list of argument positions that need to be followed
@@ -220,6 +244,7 @@
 atomic_goal_generates_event(pragma_foreign_code_rep(_)) = no.
 atomic_goal_generates_event(higher_order_call_rep(_, Args)) = yes(Args).
 atomic_goal_generates_event(method_call_rep(_, _, Args)) = yes(Args).
+atomic_goal_generates_event(builtin_call_rep(_, _, _)) = no.
 atomic_goal_generates_event(plain_call_rep(ModuleName, PredName, Args)) =
 	( call_is_primitive(ModuleName, PredName) ->
 		% These calls behave as primitives and do not generate events.
@@ -238,7 +263,40 @@
 		ModuleName = "profiling_builtin"
 	;
 		ModuleName = "term_size_prof_builtin"
+	;
+	%
+	% The following are also treated as primitive since
+	% compiler generated predicate events are not 
+	% included in the annotated trace at the moment.
+	%
+		PredName = "__Unify__"
+	;
+		PredName = "__Index__"
+	;
+		PredName = "__Compare__"
 	).
+
+goal_generates_internal_event(conj_rep(_)) = no.
+goal_generates_internal_event(disj_rep(_)) = yes.
+goal_generates_internal_event(switch_rep(_)) = yes.
+goal_generates_internal_event(ite_rep(_, _, _)) = yes.
+goal_generates_internal_event(negation_rep(_)) = yes.
+goal_generates_internal_event(some_rep(_, _)) = no.
+% Atomic goals may generate interface events, not internal events.
+goal_generates_internal_event(atomic_goal_rep(_, _, _, _, _)) = no.
+
+atomic_goal_identifiable(unify_construct_rep(_, _, _)) = no.
+atomic_goal_identifiable(unify_deconstruct_rep(_, _, _)) = no.
+atomic_goal_identifiable(unify_assign_rep(_, _)) = no.
+atomic_goal_identifiable(unify_simple_test_rep(_, _)) = no.
+atomic_goal_identifiable(unsafe_cast_rep(_, _)) = no.
+atomic_goal_identifiable(pragma_foreign_code_rep(_)) = no.
+atomic_goal_identifiable(higher_order_call_rep(_, _)) = no.
+atomic_goal_identifiable(method_call_rep(_, _, _)) = no.
+atomic_goal_identifiable(builtin_call_rep(Module, Name, Args)) = 
+	yes(atomic_goal_id(Module, Name, length(Args))).
+atomic_goal_identifiable(plain_call_rep(Module, Name, Args)) = 
+	yes(atomic_goal_id(Module, Name, length(Args))).
 
 :- pragma export(proc_rep_type = out, "ML_proc_rep_type").
 
Index: compiler/prog_rep.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_rep.m,v
retrieving revision 1.26
diff -u -r1.26 prog_rep.m
--- compiler/prog_rep.m	14 Jun 2004 04:16:31 -0000	1.26
+++ compiler/prog_rep.m	2 Sep 2004 01:39:55 -0000
@@ -225,14 +225,21 @@
 		DetismRep, FilenameRep, LinenoRep, ChangedVarsRep),
 	Rep = atomic_goal_rep(DetismRep, FilenameRep, LinenoRep,
 		ChangedVarsRep, AtomicGoalRep).
-prog_rep__represent_goal_expr(call(PredId, _, Args, _, _, _),
+prog_rep__represent_goal_expr(call(PredId, _, Args, Builtin, _, _),
 		GoalInfo, InstMap0, Info, Rep) :-
 	module_info_pred_info(Info ^ module_info, PredId, PredInfo),
 	ModuleSymName = pred_info_module(PredInfo),
 	prog_out__sym_name_to_string(ModuleSymName, ModuleName),
 	PredName = pred_info_name(PredInfo),
 	list__map(term__var_to_int, Args, ArgsRep),
-	AtomicGoalRep = plain_call_rep(ModuleName, PredName, ArgsRep),
+	(
+		Builtin = not_builtin
+	->
+		AtomicGoalRep = plain_call_rep(ModuleName, PredName, ArgsRep)
+	;
+		AtomicGoalRep = builtin_call_rep(ModuleName, PredName, 
+			ArgsRep)
+	),
 	prog_rep__represent_atomic_goal(GoalInfo, InstMap0, Info,
 		DetismRep, FilenameRep, LinenoRep, ChangedVarsRep),
 	Rep = atomic_goal_rep(DetismRep, FilenameRep, LinenoRep,
Index: compiler/trace_params.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trace_params.m,v
retrieving revision 1.17
diff -u -r1.17 trace_params.m
--- compiler/trace_params.m	23 May 2004 22:16:44 -0000	1.17
+++ compiler/trace_params.m	2 Sep 2004 01:39:55 -0000
@@ -149,16 +149,16 @@
 
 convert_trace_level("minimum", no,  no,  yes(none)).
 convert_trace_level("minimum", yes, no,  yes(shallow)).
-convert_trace_level("minimum", _,   yes, yes(deep)).
+convert_trace_level("minimum", _,   yes, yes(decl_rep)).
 convert_trace_level("shallow", _,   no,  yes(shallow)).
 convert_trace_level("shallow", _,   yes, no).
 convert_trace_level("deep",    _,   no,  yes(deep)).
 convert_trace_level("deep",    _,   yes, no).
-convert_trace_level("decl",    _,   _,   yes(deep)).
+convert_trace_level("decl",    _,   _,   yes(decl_rep)).
 convert_trace_level("rep",     _,   _,   yes(decl_rep)).
 convert_trace_level("default", no,  no,  yes(none)).
 convert_trace_level("default", yes, no,  yes(deep)).
-convert_trace_level("default", _,   yes, yes(deep)).
+convert_trace_level("default", _,   yes, yes(decl_rep)).
 
 eff_trace_level(PredInfo, ProcInfo, TraceLevel) = EffTraceLevel :-
 	(
Index: tests/debugger/declarative/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mercury.options,v
retrieving revision 1.8
diff -u -r1.8 Mercury.options
--- tests/debugger/declarative/Mercury.options	30 May 2003 07:41:27 -0000	1.8
+++ tests/debugger/declarative/Mercury.options	28 Sep 2004 08:14:12 -0000
@@ -1,11 +1,4 @@
-
-MCFLAGS-deep_sub=--trace deep --suppress-trace context
-MCFLAGS-dependency=--trace rep
-MCFLAGS-dependency2=--trace rep
-MCFLAGS-input_term_dep=--trace rep
-MCFLAGS-output_term_dep=--trace rep
+MCFLAGS-deep_sub=--trace rep --suppress-trace context
 MCFLAGS-shallow_2=--trace shallow
-MCFLAGS-special_term_dep=--trace rep
 MCFLAGS-tabled_read_decl=--trace rep --trace-table-io-all
-MCFLAGS-unsafe_cast=--trace rep
 MCFLAGS-untraced_subgoal_sub=--trace minimum
Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.64
diff -u -r1.64 Mmakefile
--- tests/debugger/declarative/Mmakefile	7 Jul 2004 05:26:16 -0000	1.64
+++ tests/debugger/declarative/Mmakefile	28 Sep 2004 07:26:33 -0000
@@ -10,16 +10,20 @@
 	args			\
 	backtrack		\
 	big			\
+	binary_search		\
 	browse_arg		\
 	catch			\
+	closure_dependency	\
 	comp_gen		\
 	confirm_abort		\
 	deep_warning		\
 	dependency		\
 	dependency2		\
 	empty_command		\
+	explicit_subtree	\
 	family			\
 	filter			\
+	find_origin		\
 	func_call		\
 	gcf			\
 	higher_order		\
@@ -27,12 +31,15 @@
 	ho3			\
 	ho4			\
 	ho5			\
+	ignore			\
 	if_then_else		\
+	inadmissible		\
 	input_term_dep		\
 	io_stream_test		\
 	ite_2			\
 	lpe_example		\
 	mapinit			\
+	mismatch_on_call	\
 	negation		\
 	neg_conj		\
 	oracle_db		\
@@ -40,39 +47,69 @@
 	pd			\
 	propositional		\
 	queens			\
+	remember_modes		\
 	revise			\
 	revise_2		\
-	shallow			\
 	small			\
 	solutions		\
 	special_term_dep	\
+	skip			\
 	tabled_read_decl	\
 	throw			\
-	unsafe_cast		\
 	trust			\
-	remember_modes
+	unsafe_cast		
 
 # The following should not be run in `debug' or `mm' grades.
 #
 NONDEBUG_DECLARATIVE_PROGS=	\
 	untraced_subgoal
 
+# The following should only be run when the library is compiled in
+# decldebug grade.
+#
+DECLDEBUG_DECLARATIVE_PROGS=	\
+	builtin_call_rep
+	
+# The following should not be run in decldebug grades.
+#
+NONDECLDEBUG_DECLARATIVE_PROGS=	\
+	shallow			
+
+	
 NONWORKING_DECLARATIVE_PROGS=	\
 
-# Some of the test cases require a different input in debug grades,
-# so we set INP to the appropriate extension to use for those tests.
-# All other tests ignore this variable.
+# Some of the test cases require a different input in debug or decldebug
+# grades, so we set DEBUG_INP and DECLDEBUG_INP to the appropriate extension to
+# use for those tests.  All other tests ignore these variables.
+# Test cases that require different input for each of the non-debug, debug and
+# decldebug grades should use the DECLDEBUG_INP variable and should have their
+# input extensions as .inp, .inp2 and .inp3 for the non-debug, debug and
+# decldebug grades respectively.
+# Test cases that require different input for the debug and non-debug grades,
+# but can use the same input for the debug and decldebug grades should use the
+# DEBUG_INP variable and use the extensions .inp and .inp2 for their non-debug
+# and debug/decldebug input files respectively.
 #
 ifneq "$(findstring .debug,$(GRADE))" ""
-    PROGS_2=$(DECLARATIVE_PROGS)
-    INP=inp2
+    PROGS_2=$(DECLARATIVE_PROGS) $(NONDECLDEBUG_DECLARATIVE_PROGS)
+    DEBUG_INP=inp2
+    DECLDEBUG_INP=inp2
 else
-    ifneq "$(findstring mm,$(GRADE))" ""
-        PROGS_2=$(DECLARATIVE_PROGS)
-        INP=inp
+    ifneq "$(findstring .decldebug,$(GRADE))" ""
+        PROGS_2=$(DECLARATIVE_PROGS) $(DECLDEBUG_DECLARATIVE_PROGS)
+        DEBUG_INP=inp2
+        DECLDEBUG_INP=inp3
     else
-        PROGS_2=$(DECLARATIVE_PROGS) $(NONDEBUG_DECLARATIVE_PROGS)
-        INP=inp
+        ifneq "$(findstring mm,$(GRADE))" ""
+            PROGS_2=$(DECLARATIVE_PROGS) $(NONDECLDEBUG_DECLARATIVE_PROGS)
+            DEBUG_INP=inp
+            DECLDEBUG_INP=inp
+        else
+            PROGS_2=$(DECLARATIVE_PROGS) $(NONDEBUG_DECLARATIVE_PROGS) \
+	    	$(NONDECLDEBUG_DECLARATIVE_PROGS)
+            DEBUG_INP=inp
+            DECLDEBUG_INP=inp
+        endif
     endif
 endif
 
@@ -140,16 +177,28 @@
 big.out: big big.inp
 	$(MDB_STD) ./big < big.inp > big.out 2>&1
 
+binary_search.out: binary_search binary_search.$(DEBUG_INP)
+	$(MDB_STD) ./binary_search < binary_search.$(DEBUG_INP) \
+		> binary_search.out 2>&1
+
 browse_arg.out: browse_arg browse_arg.inp
 	$(MDB) ./browse_arg < browse_arg.inp > browse_arg.out 2>&1
 
+builtin_call_rep.out: builtin_call_rep builtin_call_rep.inp
+	$(MDB_STD) ./builtin_call_rep  < builtin_call_rep.inp \
+		> builtin_call_rep.out 2>&1
+
 # We need to pipe the output through sed to avoid hard-coding dependencies on
 # particular line numbers in the standard library source code.
-catch.out: catch catch.$(INP)
-	$(MDB) ./catch < catch.$(INP) 2>&1 | \
+catch.out: catch catch.$(DECLDEBUG_INP)
+	$(MDB) ./catch < catch.$(DECLDEBUG_INP) 2>&1 | \
 		sed -e 's/exception.m:[0-9]*/exception.m:NNNN/g' \
 		> catch.out 2>&1
 
+closure_dependency.out: closure_dependency closure_dependency.$(DEBUG_INP)
+	$(MDB_STD) ./closure_dependency  < closure_dependency.$(DEBUG_INP) \
+		> closure_dependency.out 2>&1
+
 comp_gen.out: comp_gen comp_gen.inp
 	$(MDB) ./comp_gen < comp_gen.inp > comp_gen.out 2>&1
 
@@ -168,12 +217,20 @@
 empty_command.out: empty_command empty_command.inp
 	$(MDB) ./empty_command < empty_command.inp > empty_command.out 2>&1
 
+explicit_subtree.out: explicit_subtree explicit_subtree.inp
+	$(MDB_STD) ./explicit_subtree < explicit_subtree.inp \
+		> explicit_subtree.out 2>&1
+
 family.out: family family.inp
 	$(MDB) ./family < family.inp > family.out 2>&1
 
 filter.out: filter filter.inp
 	$(MDB_STD) ./filter < filter.inp > filter.out 2>&1
 
+find_origin.out: find_origin find_origin.$(DECLDEBUG_INP)
+	$(MDB_STD) ./find_origin < find_origin.$(DECLDEBUG_INP) \
+		> find_origin.out 2>&1
+
 func_call.out: func_call func_call.inp
 	$(MDB) ./func_call < func_call.inp > func_call.out 2>&1
 
@@ -202,6 +259,14 @@
 if_then_else.out: if_then_else if_then_else.inp
 	$(MDB_STD) ./if_then_else < if_then_else.inp > if_then_else.out 2>&1
 
+ignore.out: ignore ignore.$(DEBUG_INP)
+	$(MDB_STD) ./ignore < ignore.$(DEBUG_INP) \
+		> ignore.out 2>&1
+
+inadmissible.out: inadmissible inadmissible.$(DEBUG_INP)
+	$(MDB_STD) ./inadmissible < inadmissible.$(DEBUG_INP) \
+		> inadmissible.out 2>&1
+
 input_term_dep.out: input_term_dep input_term_dep.inp
 	$(MDB_STD) ./input_term_dep < input_term_dep.inp \
 		> input_term_dep.out 2>&1
@@ -219,6 +284,10 @@
 mapinit.out: mapinit mapinit.inp
 	$(MDB) ./mapinit < mapinit.inp > mapinit.out 2>&1
 
+mismatch_on_call.out: mismatch_on_call mismatch_on_call.inp
+	$(MDB_STD) ./mismatch_on_call < mismatch_on_call.inp \
+		> mismatch_on_call.out 2>&1
+
 neg_conj.out: neg_conj neg_conj.inp
 	$(MDB) ./neg_conj < neg_conj.inp > neg_conj.out 2>&1
 
@@ -241,8 +310,12 @@
 queens.out: queens queens.inp
 	$(MDB) ./queens < queens.inp > queens.out 2>&1
 
+remember_modes.out: remember_modes remember_modes.inp
+	$(MDB_STD) ./remember_modes < remember_modes.inp \
+			> remember_modes.out 2>&1
+
 revise.out: revise revise.inp
-	$(MDB) ./revise < revise.inp > revise.out 2>&1
+	$(MDB_STD) ./revise < revise.inp > revise.out 2>&1
 
 revise_2.out: revise_2 revise_2.inp
 	$(MDB) ./revise_2 < revise_2.inp > revise_2.out 2>&1
@@ -255,8 +328,8 @@
 
 # We need to pipe the output through sed to avoid hard-coding dependencies on
 # particular line numbers in the standard library source code.
-solutions.out: solutions solutions.$(INP)
-	$(MDB) ./solutions < solutions.$(INP) 2>&1 | \
+solutions.out: solutions solutions.$(DECLDEBUG_INP)
+	$(MDB) ./solutions < solutions.$(DECLDEBUG_INP) 2>&1 | \
 		sed -e 's/std_util.m:[0-9]*/std_util.m:NNNN/g' \
 		> solutions.out 2>&1
 
@@ -264,6 +337,9 @@
 	$(MDB_STD) ./special_term_dep < special_term_dep.inp \
 		> special_term_dep.out 2>&1
 
+skip.out: skip skip.inp
+	$(MDB_STD) ./skip < skip.inp > skip.out 2>&1
+
 tabled_read_decl.out: tabled_read_decl tabled_read_decl.inp
 	$(MDB_STD) ./tabled_read_decl < tabled_read_decl.inp \
 		> tabled_read_decl.out 2>&1
@@ -275,18 +351,14 @@
 		sed -e 's/exception.m:[0-9]*/exception.m:NNNN/g' | \
 		sed -e '/EXCP/s/).*/)/' > throw.out 2>&1
 
+trust.out: trust trust.$(DEBUG_INP)
+	$(MDB_STD) ./trust < trust.$(DEBUG_INP) > trust.out 2>&1
+
 unsafe_cast.out: unsafe_cast unsafe_cast.inp
 	$(MDB) ./unsafe_cast < unsafe_cast.inp > unsafe_cast.out 2>&1
 
 untraced_subgoal.out: untraced_subgoal untraced_subgoal.inp
 	$(MDB) ./untraced_subgoal < untraced_subgoal.inp \
 			> untraced_subgoal.out 2>&1
-
-trust.out: trust trust.inp
-	$(MDB_STD) ./trust < trust.inp > trust.out 2>&1
-
-remember_modes.out: remember_modes remember_modes.inp
-	$(MDB_STD) ./remember_modes < remember_modes.inp \
-			> remember_modes.out 2>&1
 
 #-----------------------------------------------------------------------------#
Index: tests/debugger/declarative/binary_search.exp
===================================================================
RCS file: tests/debugger/declarative/binary_search.exp
diff -N tests/debugger/declarative/binary_search.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/binary_search.exp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,115 @@
+      E1:     C1  1 CALL pred binary_search.main/2-0 (det) binary_search.m:15
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> step
+      E2:     C2  2 CALL pred binary_search.silly_even/2-0 (det)
+mdb> finish
+      E3:     C2  2 EXIT pred binary_search.silly_even/2-0 (det)
+mdb> dd
+silly_even(1001, yes)
+Valid? b 2
+browser> mark
+silly_even(0, yes)
+Valid? y
+sillier_even(500, yes)
+Valid? y
+sillier_even(769, yes)
+Valid? n
+silly_even(655, yes)
+Valid? n
+sillier_even(598, yes)
+Valid? y
+sillier_even(625, yes)
+Valid? n
+silly_even(612, yes)
+Valid? y
+silly_even(619, yes)
+Valid? n
+sillier_even(616, yes)
+Valid? y
+silly_even(618, yes)
+Valid? y
+Found incorrect contour:
+silly_even(619, yes)
+Is this a bug? y
+      E4:     C3 321 EXIT pred binary_search.silly_even/2-0 (det)
+mdb> trust binary_search_1
+Trusting module binary_search_1
+mdb> retry 320
+      E1:     C1  1 CALL pred binary_search.main/2-0 (det)
+mdb> 
+      E2:     C2  2 CALL pred binary_search.silly_even/2-0 (det)
+mdb> f
+      E3:     C2  2 EXIT pred binary_search.silly_even/2-0 (det)
+mdb> dd
+silly_even(1001, yes)
+Valid? b 2
+browser> mark
+silly_even(404, yes)
+Valid? y
+silly_even(741, yes)
+Valid? n
+silly_even(677, yes)
+Valid? n
+silly_even(645, yes)
+Valid? n
+silly_even(629, yes)
+Valid? n
+silly_even(621, yes)
+Valid? n
+Found incorrect contour:
+silly_even(619, yes)
+Is this a bug? y
+      E4:     C3 321 EXIT pred binary_search.silly_even/2-0 (det)
+mdb> break add1s
+ 0: + stop  interface pred binary_search.add1s/2-0 (det)
+mdb> continue
+yes      E5:     C4  2 CALL pred binary_search.add1s/2-0 (det)
+mdb> f
+      E6:     C5  3 CALL pred binary_search.add1s/2-0 (det)
+      E7:     C6  4 CALL pred binary_search.add1s/2-0 (det)
+      E8:     C7  5 CALL pred binary_search.add1s/2-0 (det)
+      E9:     C8  6 CALL pred binary_search.add1s/2-0 (det)
+     E10:     C9  7 CALL pred binary_search.add1s/2-0 (det)
+     E11:    C10  8 CALL pred binary_search.add1s/2-0 (det)
+     E12:    C11  9 CALL pred binary_search.add1s/2-0 (det)
+     E13:    C12 10 CALL pred binary_search.add1s/2-0 (det)
+     E14:    C13 11 CALL pred binary_search.add1s/2-0 (det)
+     E15:    C14 12 CALL pred binary_search.add1s/2-0 (det)
+     E16:    C14 12 EXIT pred binary_search.add1s/2-0 (det)
+     E17:    C13 11 EXIT pred binary_search.add1s/2-0 (det)
+     E18:    C12 10 EXIT pred binary_search.add1s/2-0 (det)
+     E19:    C11  9 EXIT pred binary_search.add1s/2-0 (det)
+     E20:    C10  8 EXIT pred binary_search.add1s/2-0 (det)
+     E21:     C9  7 EXIT pred binary_search.add1s/2-0 (det)
+     E22:     C8  6 EXIT pred binary_search.add1s/2-0 (det)
+     E23:     C7  5 EXIT pred binary_search.add1s/2-0 (det)
+     E24:     C6  4 EXIT pred binary_search.add1s/2-0 (det)
+     E25:     C5  3 EXIT pred binary_search.add1s/2-0 (det)
+     E26:     C4  2 EXIT pred binary_search.add1s/2-0 (det)
+mdb> dd
+add1s([1, 2, 3, 4, 5, 6, 7, 8, ...], [|]/2)
+Valid? b 2
+browser> cd 2/2/2/2/2/2/2
+browser> ls
+[9, 10, 11]
+browser> cd 2/2/1
+browser> ls
+11
+browser> mark
+add1s([10], [11])
+Valid? y
+add1s([6, 7, 8, 9, 10], [7, 8, ...])
+Valid? y
+add1s([3, 4, 5, 6, 7, 8, 9, 10], [|]/2)
+Valid? n
+add1s([4, 5, 6, 7, 8, 9, 10], [5, ...])
+Valid? n
+add1s([5, 6, 7, 8, 9, 10], [6, ...])
+Valid? n
+Found incorrect contour:
+add1s([5, 6, 7, 8, 9, 10], [6, ...])
+Is this a bug? y
+     E22:     C8  6 EXIT pred binary_search.add1s/2-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/binary_search.exp2
===================================================================
RCS file: tests/debugger/declarative/binary_search.exp2
diff -N tests/debugger/declarative/binary_search.exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/binary_search.exp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,107 @@
+      E1:     C1  1 CALL pred binary_search.main/2-0 (det) binary_search.m:15
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> 
+      E2:     C2  2 CALL pred binary_search.silly_even/2-0 (det)
+mdb> f
+      E3:     C2  2 EXIT pred binary_search.silly_even/2-0 (det)
+mdb> dd
+silly_even(1001, yes)
+Valid? b 2
+browser> mark
+silly_even(0, yes)
+Valid? y
+sillier_even(500, yes)
+Valid? y
+sillier_even(769, yes)
+Valid? n
+silly_even(655, yes)
+Valid? n
+sillier_even(598, yes)
+Valid? y
+sillier_even(625, yes)
+Valid? n
+silly_even(612, yes)
+Valid? y
+silly_even(619, yes)
+Valid? n
+sillier_even(616, yes)
+Valid? y
+silly_even(618, yes)
+Valid? y
+>(619, 0)
+Valid? y
+Call =<(619, 600)
+No solutions.
+Complete? y
+mod(619, 3) = 1
+Valid? y
+-(619, 1) = 618
+Valid? y
+Found incorrect contour:
+silly_even(619, yes)
+Is this a bug? y
+      E4:     C3 321 EXIT pred binary_search.silly_even/2-0 (det)
+mdb> trust int
+Trusting module int
+mdb> trust binary_search_1
+Trusting module binary_search_1
+mdb> retry 319
+      E2:     C2  2 CALL pred binary_search.silly_even/2-0 (det)
+mdb> finish
+      E3:     C2  2 EXIT pred binary_search.silly_even/2-0 (det)
+mdb> dd
+silly_even(1001, yes)
+Valid? b 2
+browser> mark
+silly_even(404, yes)
+Valid? y
+silly_even(741, yes)
+Valid? n
+silly_even(677, yes)
+Valid? n
+silly_even(645, yes)
+Valid? n
+silly_even(629, yes)
+Valid? n
+silly_even(621, yes)
+Valid? n
+Found incorrect contour:
+silly_even(619, yes)
+Is this a bug? y
+      E4:     C3 321 EXIT pred binary_search.silly_even/2-0 (det)
+mdb> untrust 0
+mdb> untrust 0
+mdb> break add1s
+ 0: + stop  interface pred binary_search.add1s/2-0 (det)
+mdb> c
+yes      E5:     C4  2 CALL pred binary_search.add1s/2-0 (det)
+mdb> delete 0
+ 0: E stop  interface pred binary_search.add1s/2-0 (det)
+mdb> finish
+      E6:     C4  2 EXIT pred binary_search.add1s/2-0 (det)
+mdb> dd
+add1s([1, 2, 3, 4, 5, 6, 7, 8, ...], [|]/2)
+Valid? b 2
+browser> cd 2/2/2/2/2/2/2/2/2/1
+browser> ls
+11
+browser> mark
++(10, 1) = 11
+Valid? y
+add1s([6, 7, 8, 9, 10], [7, 8, ...])
+Valid? y
+add1s([3, 4, 5, 6, 7, 8, 9, 10], [|]/2)
+Valid? n
+add1s([4, 5, 6, 7, 8, 9, 10], [5, ...])
+Valid? n
+add1s([5, 6, 7, 8, 9, 10], [6, ...])
+Valid? n
++(5, 1) = 6
+Valid? y
+Found incorrect contour:
+add1s([5, 6, 7, 8, 9, 10], [6, ...])
+Is this a bug? y
+      E7:     C5  6 EXIT pred binary_search.add1s/2-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/binary_search.inp
===================================================================
RCS file: tests/debugger/declarative/binary_search.inp
diff -N tests/debugger/declarative/binary_search.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/binary_search.inp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,50 @@
+register --quiet
+context none
+echo on
+step
+finish
+dd
+b 2
+mark
+y
+y
+n
+n
+y
+n
+y
+n
+y
+y
+y
+trust binary_search_1
+retry 320
+
+f
+dd
+b 2
+mark
+y
+n
+n
+n
+n
+n
+y
+break add1s
+continue
+f
+dd
+b 2
+cd 2/2/2/2/2/2/2
+ls
+cd 2/2/1
+ls
+mark
+y
+y
+n
+n
+n
+y
+quit -y
Index: tests/debugger/declarative/binary_search.inp2
===================================================================
RCS file: tests/debugger/declarative/binary_search.inp2
diff -N tests/debugger/declarative/binary_search.inp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/binary_search.inp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,56 @@
+register --quiet
+context none
+echo on
+
+f
+dd
+b 2
+mark
+y
+y
+n
+n
+y
+n
+y
+n
+y
+y
+y
+y
+y
+y
+y
+trust int
+trust binary_search_1
+retry 319
+finish
+dd
+b 2
+mark
+y
+n
+n
+n
+n
+n
+y
+untrust 0
+untrust 0
+break add1s
+c
+delete 0
+finish
+dd
+b 2
+cd 2/2/2/2/2/2/2/2/2/1
+ls
+mark
+y
+y
+n
+n
+n
+y
+y
+quit -y
Index: tests/debugger/declarative/binary_search.m
===================================================================
RCS file: tests/debugger/declarative/binary_search.m
diff -N tests/debugger/declarative/binary_search.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/binary_search.m	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,52 @@
+:- module binary_search.
+
+:- interface.
+
+:- import_module io, bool, int.
+
+:- pred main(io::di, io::uo) is det.
+
+:- pred silly_even(int::in, bool::out) is det.
+
+:- implementation.
+
+:- import_module binary_search_1, list.
+
+main(!IO) :-
+	binary_search.silly_even(1001, A),
+	write(A, !IO),
+	add1s([1,2,3,4,5,6,7,8,9,10], L),
+	write(L, !IO),
+	nl(!IO).
+
+silly_even(N, R) :- 
+	(
+		N > 0
+	->
+		(
+			(N =< 600 , N >= 405 ; N mod 3 = 0)
+		->
+			binary_search_1.sillier_even(N, R)
+		;
+			(
+				N = 619
+			->
+				binary_search.silly_even(N-1, R)
+			;
+				binary_search.silly_even(N-2, R)
+			)
+		)
+	;
+		(
+			N = 0
+		->
+			R = yes
+		;
+			R = no
+		)
+	).
+
+:- pred add1s(list(int)::in, list(int)::out) is det.
+
+add1s([], []).
+add1s([H0 | T0], [H0+1 | T]) :- add1s(T0, T).
Index: tests/debugger/declarative/binary_search_1.m
===================================================================
RCS file: tests/debugger/declarative/binary_search_1.m
diff -N tests/debugger/declarative/binary_search_1.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/binary_search_1.m	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,20 @@
+:- module binary_search_1.
+
+:- interface.
+
+:- import_module bool, int.
+
+:- pred sillier_even(int::in, bool::out) is det.
+
+:- implementation.
+
+:- import_module binary_search.
+
+sillier_even(N, R) :- 
+	(
+		not (N =< 600, N >= 405 ; N mod 3 = 0)
+	->
+		binary_search.silly_even(N, R)
+	;
+		binary_search_1.sillier_even(N-2, R)
+	).
Index: tests/debugger/declarative/builtin_call_rep.exp
===================================================================
RCS file: tests/debugger/declarative/builtin_call_rep.exp
diff -N tests/debugger/declarative/builtin_call_rep.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/builtin_call_rep.exp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,25 @@
+      E1:     C1  1 CALL pred builtin_call_rep.main/2-0 (det) builtin_call_rep.m:13
+mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> step
+      E2:     C2  2 CALL func int.+/2-0 (det)
+mdb> print proc_body
+	proc_rep([1, 2, 3], atomic_goal_rep(det_rep, "int.m", 82, [3], builtin_call_rep/3))
+mdb> browse proc_body
+browser> cd 2
+browser> ls
+atomic_goal_rep(det_rep, "int.m", 82, [3], builtin_call_rep("int", "+", [1, 2, 3]))
+browser> quit
+mdb> f
+      E3:     C2  2 EXIT func int.+/2-0 (det)
+mdb> dd
++(1, 2) = 3
+Valid? b 3
+browser> mark
+Found incorrect contour:
++(1, 2) = 3
+Is this a bug? y
+      E3:     C2  2 EXIT func int.+/2-0 (det)
+mdb> c
+3
Index: tests/debugger/declarative/builtin_call_rep.inp
===================================================================
RCS file: tests/debugger/declarative/builtin_call_rep.inp
diff -N tests/debugger/declarative/builtin_call_rep.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/builtin_call_rep.inp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,14 @@
+context none
+echo on
+step
+print proc_body
+browse proc_body
+cd 2
+ls
+quit
+f
+dd
+b 3
+mark
+y
+c
Index: tests/debugger/declarative/builtin_call_rep.m
===================================================================
RCS file: tests/debugger/declarative/builtin_call_rep.m
diff -N tests/debugger/declarative/builtin_call_rep.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/builtin_call_rep.m	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,18 @@
+:- module builtin_call_rep.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module int.
+
+main(!IO) :-
+	A = 1,
+	B = 2,
+	X = A+B,
+	write_int(X, !IO),
+	nl(!IO).
Index: tests/debugger/declarative/catch.exp3
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/catch.exp3,v
retrieving revision 1.1
diff -u -r1.1 catch.exp3
--- tests/debugger/declarative/catch.exp3	18 Mar 2003 16:38:47 -0000	1.1
+++ tests/debugger/declarative/catch.exp3	28 Sep 2004 06:26:01 -0000
@@ -1,40 +1,52 @@
        1:      1  1 CALL pred catch.main/2-0 (cc_multi) catch.m:8
+mdb> mdb> Contexts will not be printed.
 mdb> echo on
 Command echo enabled.
-mdb> register --quiet
 mdb> break p
  0: + stop  interface pred catch.p/2-0 (cc_multi)
 mdb> continue
-       2:      2  2 CALL pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:9)
+       2:      2  2 CALL pred catch.p/2-0 (cc_multi)
 mdb> finish
-mdb: warning: reached label with no stack layout info
-This may result in some exception events
-being omitted from the trace.
-       7:      2  2 EXIT pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:9)
+      34:      2  2 EXIT pred catch.p/2-0 (cc_multi)
 mdb> dd
-mdb: warning: reached label with no stack layout info
-This may result in some exception events
-being omitted from the trace.
 p(1, exception(univ_cons("q: bad input")))
+Valid? n
+try(q(1), exception(univ_cons("q: bad input")))
+Valid? no
+get_determinism(q(1), det)
+Valid? yes
+try(det, q(1), exception(univ_cons("q: bad input")))
+Valid? no
+catch_impl(IntroducedFrom__pred__try__430__6(int, q(1)), wrap_exception(int), exception(univ_cons("q: bad input")))
 Valid? no
 Sorry, the diagnosis cannot continue because it requires support for
 the following: code that catches exceptions.
 The debugger is a work in progress, and this is not supported in the
 current version.
-       7:      2  2 EXIT pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:9)
+      32:      6  4 EXIT pred exception.try/3-0 (cc_multi)
+mdb> continue
+      34:      2  2 EXIT pred catch.p/2-0 (cc_multi)
 mdb> continue
 exception(univ_cons("q: bad input"))
-       8:      4  2 CALL pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:12)
+    1373:    524  2 CALL pred catch.p/2-0 (cc_multi)
 mdb> finish
-      13:      4  2 EXIT pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:12)
+    1397:    524  2 EXIT pred catch.p/2-0 (cc_multi)
 mdb> dd
 p(2, succeeded(2))
 Valid? no
-q(2, 2)
-Valid? yes
+try(q(2), succeeded(2))
+Valid? no
+get_determinism(q(2), det)
+Valid? no
+cc_multi_equal(_, det)
+Valid? no
 Found incorrect contour:
-p(2, succeeded(2))
+cc_multi_equal(_, det)
+Is this a bug? no
+cc_multi_equal(_, det)
+Valid? [no] yes
+Found incorrect contour:
+get_determinism(q(2), det)
 Is this a bug? yes
-      13:      4  2 EXIT pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:12)
-mdb> continue
-succeeded(2)
+    1379:    526  4 EXIT pred exception.get_determinism/2-0 (cc_multi)
+mdb> quit -y
Index: tests/debugger/declarative/catch.inp3
===================================================================
RCS file: tests/debugger/declarative/catch.inp3
diff -N tests/debugger/declarative/catch.inp3
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/catch.inp3	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,24 @@
+register --quiet
+context none
+echo on
+break p
+continue
+finish
+dd
+n
+no
+yes
+no
+no
+continue
+continue
+finish
+dd
+no
+no
+no
+no
+no
+yes
+yes
+quit -y
Index: tests/debugger/declarative/closure_dependency.exp
===================================================================
RCS file: tests/debugger/declarative/closure_dependency.exp
diff -N tests/debugger/declarative/closure_dependency.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/closure_dependency.exp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,82 @@
+      E1:     C1  1 CALL pred closure_dependency.main/2-0 (det) closure_dependency.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> step
+      E2:     C2  2 CALL pred closure_dependency.a/3-0 (det)
+mdb> f
+      E3:     C2  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> dd
+a(0, [100, 0], t(p([0])))
+Valid? b 2
+browser> mark
+c(t(p([0])), 100, [100, 0])
+Valid? n
+p([0], 100, [100, 0])
+Valid? b 1
+browser> mark
+Found inadmissible call:
+Parent c(t(p([0])), 100, _)
+Call p([0], 100, _)
+Is this a bug? y
+      E4:     C3  3 EXIT pred closure_dependency.c/3-0 (det)
+mdb> break a
+ 0: + stop  interface pred closure_dependency.a/3-0 (det)
+mdb> c
+      E3:     C2  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> c
+      E5:     C4  2 CALL pred closure_dependency.a/3-0 (det)
+mdb> f
+      E6:     C4  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> dd
+a(1, [100, 1], t(p([1])))
+Valid? b 2
+browser> mark
+c(t(p([1])), 100, [100, 1])
+Valid? n
+p([1], 100, [100, 1])
+Valid? b 2
+browser> mark
+Found inadmissible call:
+Parent c(t(p([1])), 100, _)
+Call p([1], 100, _)
+Is this a bug? y
+      E7:     C5  3 EXIT pred closure_dependency.c/3-0 (det)
+mdb> c
+      E6:     C4  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> c
+      E8:     C6  2 CALL pred closure_dependency.a/3-0 (det)
+mdb> f
+      E9:     C6  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> dd
+a(2, [100, 2], t(p([2])))
+Valid? b 2
+browser> mark
+c(t(p([2])), 100, [100, 2])
+Valid? n
+p([2], 100, [100, 2])
+Valid? b 3
+browser> mark
+Found incorrect contour:
+p([2], 100, [100, 2])
+Is this a bug? y
+     E10:     C7  4 EXIT pred closure_dependency.p/3-0 (det)
+mdb> c
+      E9:     C6  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> c
+     E11:     C8  2 CALL pred closure_dependency.a/3-0 (det)
+mdb> f
+     E12:     C8  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> dd
+a(3, [100, 3], t(p([3])))
+Valid? b 3
+browser> ls
+t(p([3]))
+browser> mark
+d([3], t(p([3])))
+Valid? n
+Found incorrect contour:
+d([3], t(p([3])))
+Is this a bug? y
+     E13:     C9  3 EXIT pred closure_dependency.d/2-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/closure_dependency.exp2
===================================================================
RCS file: tests/debugger/declarative/closure_dependency.exp2
diff -N tests/debugger/declarative/closure_dependency.exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/closure_dependency.exp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,85 @@
+      E1:     C1  1 CALL pred closure_dependency.main/2-0 (det) closure_dependency.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> break a
+ 0: + stop  interface pred closure_dependency.a/3-0 (det)
+mdb> c
+      E2:     C2  2 CALL pred closure_dependency.a/3-0 (det)
+mdb> f
+      E3:     C2  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> dd
+a(0, [100, 0], t(p([0])))
+Valid? browse
+browser> cd 3/1
+browser> ls
+p([0])
+browser> mark
+d([0], t(p([0])))
+Valid? browse
+browser> mark
+Found incorrect contour:
+d([0], t(p([0])))
+Is this a bug? y
+      E4:     C3  3 EXIT pred closure_dependency.d/2-0 (det)
+mdb> c
+      E3:     C2  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> c
+      E5:     C4  2 CALL pred closure_dependency.a/3-0 (det)
+mdb> f
+      E6:     C4  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> dd
+a(1, [100, 1], t(p([1])))
+Valid? b 2
+browser> mark
+p([1], 100, [100, 1])
+Valid? b
+browser> cd 1
+browser> mark
+b(1, [1])
+Valid? n
+Found incorrect contour:
+b(1, [1])
+Is this a bug? y
+      E7:     C5  3 EXIT pred closure_dependency.b/2-0 (det)
+mdb> c
+      E6:     C4  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> c
+      E8:     C6  2 CALL pred closure_dependency.a/3-0 (det)
+mdb> f
+      E9:     C6  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> dd
+a(2, [100, 2], t(p([2])))
+Valid? b 2
+browser> mark
+p([2], 100, [100, 2])
+Valid? b 2
+browser> mark
+e(2, 100)
+Valid? n
+Found incorrect contour:
+e(2, 100)
+Is this a bug? y
+     E10:     C7  3 EXIT pred closure_dependency.e/2-0 (det)
+mdb> c
+      E9:     C6  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> c
+     E11:     C8  2 CALL pred closure_dependency.a/3-0 (det)
+mdb> f
+     E12:     C8  2 EXIT pred closure_dependency.a/3-0 (det)
+mdb> dd
+a(3, [100, 3], t(p([3])))
+Valid? b 2
+browser> mark
+p([3], 100, [100, 3])
+Valid? b
+browser> cd 3
+browser> cd 2
+browser> ls
+[3]
+browser> mark
+Found incorrect contour:
+p([3], 100, [100, 3])
+Is this a bug? y
+     E13:     C9  4 EXIT pred closure_dependency.p/3-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/closure_dependency.inp
===================================================================
RCS file: tests/debugger/declarative/closure_dependency.inp
diff -N tests/debugger/declarative/closure_dependency.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/closure_dependency.inp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,43 @@
+register --quiet
+context none
+echo on
+step
+f
+dd
+b 2
+mark
+n
+b 1
+mark
+y
+break a
+c
+c
+f
+dd
+b 2
+mark
+n
+b 2
+mark
+y
+c
+c
+f
+dd
+b 2
+mark
+n
+b 3
+mark
+y
+c
+c
+f
+dd
+b 3
+ls
+mark
+n
+y
+quit -y
Index: tests/debugger/declarative/closure_dependency.inp2
===================================================================
RCS file: tests/debugger/declarative/closure_dependency.inp2
diff -N tests/debugger/declarative/closure_dependency.inp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/closure_dependency.inp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,48 @@
+register --quiet
+context none
+echo on
+break a
+c
+f
+dd
+browse
+cd 3/1
+ls
+mark
+browse
+mark
+y
+c
+c
+f
+dd
+b 2
+mark
+b
+cd 1
+mark
+n
+y
+c
+c
+f
+dd
+b 2
+mark
+b 2
+mark
+n
+y
+c
+c
+f
+dd
+b 2
+mark
+b
+cd 3
+cd 2
+ls
+mark
+y
+quit -y
Index: tests/debugger/declarative/closure_dependency.m
===================================================================
RCS file: tests/debugger/declarative/closure_dependency.m
diff -N tests/debugger/declarative/closure_dependency.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/closure_dependency.m	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,57 @@
+:- module closure_dependency.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module list.
+
+main(!IO) :-
+	a(0, _, P),
+	a(1, X, _),
+	a(2, Y, _),
+	a(3, Z, _),
+	write(P, !IO),
+	write(X, !IO),
+	write(Y, !IO),
+	write(Z, !IO),
+	nl(!IO).
+
+:- type t(T) --->
+	t(pred(T, list(T))).
+
+:- inst t ---> t(pred(in, out) is det).
+
+:- pred a(int::in, list(int)::out, t(int)::out(t)) is det.
+
+a(X, Y, T) :-
+	b(X, Z),
+	e(X, W),
+	d(Z, T),
+	c(T, W, Y).
+
+:- pred b(int::in, list(int)::out) is det.
+
+b(X, [X]).
+
+:- pred e(int::in, int::out) is det.
+
+e(_, 100).
+
+:- pred c(t(int), int, list(int)).
+:- mode c(in(t), in, out) is det.
+
+c(t(P), X, Y) :-
+	P(X, Y).
+	
+:- pred p(list(int)::in, int::in, list(int)::out) is det.
+
+p(X, Y, [Y | X]).
+
+:- pred d(list(int)::in, t(int)::out(t)) is det.
+
+d(X, t(p(X))).
Index: tests/debugger/declarative/confirm_abort.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/confirm_abort.exp,v
retrieving revision 1.2
diff -u -r1.2 confirm_abort.exp
--- tests/debugger/declarative/confirm_abort.exp	17 Jan 2003 05:57:00 -0000	1.2
+++ tests/debugger/declarative/confirm_abort.exp	28 Sep 2004 06:26:01 -0000
@@ -42,11 +42,15 @@
 Is this a bug? abort
        5:      2  2 EXIT pred confirm_abort.p/1-0 (det) confirm_abort.m:15 (confirm_abort.m:8)
 mdb> dd
+p(27)
+Valid? [no] n
 Found incorrect contour:
 q(27)
 Is this a bug? a
        5:      2  2 EXIT pred confirm_abort.p/1-0 (det) confirm_abort.m:15 (confirm_abort.m:8)
 mdb> dd
+p(27)
+Valid? [no] n
 Found incorrect contour:
 q(27)
 Is this a bug? y
Index: tests/debugger/declarative/confirm_abort.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/confirm_abort.inp,v
retrieving revision 1.1
diff -u -r1.1 confirm_abort.inp
--- tests/debugger/declarative/confirm_abort.inp	4 Nov 2002 00:58:58 -0000	1.1
+++ tests/debugger/declarative/confirm_abort.inp	28 Sep 2004 06:26:01 -0000
@@ -11,7 +11,9 @@
 ?
 abort
 dd
+n
 a
 dd
+n
 y
 quit -y
Index: tests/debugger/declarative/dependency.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/dependency.exp,v
retrieving revision 1.4
diff -u -r1.4 dependency.exp
--- tests/debugger/declarative/dependency.exp	20 Oct 2003 07:29:44 -0000	1.4
+++ tests/debugger/declarative/dependency.exp	28 Sep 2004 06:26:01 -0000
@@ -49,7 +49,7 @@
 Valid? browse 1
 browser> ^2^1
 browser> mark
-Origin: output(r, any_head_var(4), [1])
+Origin: output(r, any_head_var_from_back(1), [1])
 r(1, [3, 4], 3 - 4)
 Valid? browse 2
 browser> print
@@ -85,7 +85,7 @@
 Valid? browse 1
 browser> ^2^2^2^2^1
 browser> mark
-Origin: output(r, any_head_var(4), [1])
+Origin: output(r, any_head_var_from_back(1), [1])
 r(1, [3, 4], 3 - 4)
 Valid? abort
 Diagnosis aborted.
Index: tests/debugger/declarative/dependency2.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/dependency2.exp,v
retrieving revision 1.4
diff -u -r1.4 dependency2.exp
--- tests/debugger/declarative/dependency2.exp	17 Jan 2003 05:57:00 -0000	1.4
+++ tests/debugger/declarative/dependency2.exp	28 Sep 2004 06:26:01 -0000
@@ -13,7 +13,7 @@
 Valid? browse 1
 browser> ^2^1
 browser> mark
-Origin: output(r, any_head_var(4), [1])
+Origin: output(r, any_head_var_from_back(1), [1])
 r(1, [3, 4], 3 - 4)
 Valid? browse 2
 browser> print
@@ -25,8 +25,9 @@
 Origin: primitive_op("dependency2.m", 29)
 q(no)
 Valid? yes
-Found incorrect contour:
-test([1, 3, 6, 1, 3])
+Found inadmissible call:
+Parent test(_)
+Call r(1, [3, 4], _)
 Is this a bug? yes
       18:      3  2 EXIT pred dependency2.test/1-0 (cc_multi) dependency2.m:19 (dependency2.m:13)
 mdb> continue
Index: tests/debugger/declarative/explicit_subtree.exp
===================================================================
RCS file: tests/debugger/declarative/explicit_subtree.exp
diff -N tests/debugger/declarative/explicit_subtree.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/explicit_subtree.exp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,37 @@
+      E1:     C1  1 CALL pred explicit_subtree.main/2-0 (det) explicit_subtree.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> step
+      E2:     C2  2 CALL pred explicit_subtree.p/2-0 (det)
+mdb> finish
+      E3:     C2  2 EXIT pred explicit_subtree.p/2-0 (det)
+mdb> dd
+p(110, 230)
+Valid? b 2
+browser> mark
+q(0, 230, 230)
+Valid? n
+Found incorrect contour:
+q(0, 230, 230)
+Is this a bug? n
+q(0, 230, 230)
+Valid? [no] y
+q(100, 10, 110)
+Valid? y
+q(200, 30, 230)
+Valid? y
+Found incorrect contour:
+p(110, 230)
+Is this a bug? n
+p(110, 230)
+Valid? b 1
+browser> mark
+q(0, 110, 110)
+Valid? n
+Found incorrect contour:
+q(0, 110, 110)
+Is this a bug? y
+      E4:     C3 103 EXIT pred explicit_subtree.q/3-0 (det)
+mdb> continue
+{110, 230}
Index: tests/debugger/declarative/explicit_subtree.exp2
===================================================================
RCS file: tests/debugger/declarative/explicit_subtree.exp2
diff -N tests/debugger/declarative/explicit_subtree.exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/explicit_subtree.exp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,37 @@
+      E1:     C1  1 CALL pred explicit_subtree.main/2-0 (det) explicit_subtree.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> step
+      E2:     C2  2 CALL pred explicit_subtree.p/2-0 (det)
+mdb> finish
+      E3:     C2  2 EXIT pred explicit_subtree.p/2-0 (det)
+mdb> dd
+p(110, 230)
+Valid? b 2
+browser> mark
++(229, 1) = 230
+Valid? n
+Found incorrect contour:
++(229, 1) = 230
+Is this a bug? n
++(229, 1) = 230
+Valid? [no] y
+q(100, 10, 110)
+Valid? y
+q(200, 30, 230)
+Valid? y
+Found incorrect contour:
+p(110, 230)
+Is this a bug? n
+p(110, 230)
+Valid? b 1
+browser> mark
++(109, 1) = 110
+Valid? n
+Found incorrect contour:
++(109, 1) = 110
+Is this a bug? y
+      E4:     C3 103 EXIT func int.+/2-0 (det)
+mdb> continue
+{110, 230}
Index: tests/debugger/declarative/explicit_subtree.inp
===================================================================
RCS file: tests/debugger/declarative/explicit_subtree.inp
diff -N tests/debugger/declarative/explicit_subtree.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/explicit_subtree.inp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,19 @@
+register --quiet
+context none
+echo on
+step
+finish
+dd
+b 2
+mark
+n
+n
+y
+y
+y
+n
+b 1
+mark
+n
+y
+continue
Index: tests/debugger/declarative/explicit_subtree.m
===================================================================
RCS file: tests/debugger/declarative/explicit_subtree.m
diff -N tests/debugger/declarative/explicit_subtree.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/explicit_subtree.m	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,31 @@
+:- module explicit_subtree.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module int, list.
+
+main(!IO) :-
+	p(X, Y),
+	write({X, Y}, !IO),
+	nl(!IO).
+
+:- pred p(int::out, int::out) is det.
+
+p(X, Y) :- q(100, 10, X),q(200, 30, Y).
+
+:- pred q(int::in, int::in, int::out) is det.
+
+q(A, B, C) :-
+	(
+		A =< 0
+	->
+		B = C
+	;
+		q(A-1, B+1, C)
+	).
Index: tests/debugger/declarative/family.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/family.exp,v
retrieving revision 1.3
diff -u -r1.3 family.exp
--- tests/debugger/declarative/family.exp	17 Jan 2003 05:57:00 -0000	1.3
+++ tests/debugger/declarative/family.exp	28 Sep 2004 06:26:01 -0000
@@ -64,10 +64,12 @@
 mdb> dd
 half_siblings(b, a)
 Valid? no
+siblings(b, a)
+Valid? yes
 Found partially uncovered atom:
 common_father(_, _)
 Is this a bug? yes
-     401:     70  4 FAIL pred family.common_father/2-0 (nondet) family.m:58 (family.m:77)
+     348:     59  4 FAIL pred family.common_father/2-0 (nondet) family.m:58 (family.m:77)
 mdb> continue
      530:      2  2 EXIT pred family.half_siblings/2-0 (nondet) family.m:82 (family.m:9)
 mdb> continue
@@ -83,5 +85,5 @@
 Found partially uncovered atom:
 common_father(_, _)
 Is this a bug? yes
-     401:     70  4 FAIL pred family.common_father/2-0 (nondet) family.m:58 (family.m:77)
+      86:     15  4 FAIL pred family.common_father/2-0 (nondet) family.m:58 (family.m:77)
 mdb> quit -y
Index: tests/debugger/declarative/family.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/family.inp,v
retrieving revision 1.1
diff -u -r1.1 family.inp
--- tests/debugger/declarative/family.inp	1 Oct 2000 17:03:38 -0000	1.1
+++ tests/debugger/declarative/family.inp	28 Sep 2004 06:26:01 -0000
@@ -26,6 +26,7 @@
 dd
 no
 yes
+yes
 continue
 continue
 finish
Index: tests/debugger/declarative/find_origin.exp
===================================================================
RCS file: tests/debugger/declarative/find_origin.exp
diff -N tests/debugger/declarative/find_origin.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/find_origin.exp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,75 @@
+      E1:     C1  1 CALL pred find_origin.main/2-0 (det) find_origin.m:26
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> 
+      E2:     C2  2 CALL pred find_origin.monotest/2-0 (det)
+mdb> f
+      E3:     C2  2 EXIT pred find_origin.monotest/2-0 (det)
+mdb> dd
+monotest(t(101), 1)
+Valid? b 1
+browser> mark
+monotest4(t(101), t(101))
+Valid? n
+Call IntroducedFrom__pred__monotest4__86__1(t(101), t(3))
+No solutions.
+Complete? y
+IntroducedFrom__pred__monotest4__86__1(t(101), t(101))
+Valid? y
+Call IntroducedFrom__pred__monotest4__86__1(t(101), t(2))
+No solutions.
+Complete? y
+Call IntroducedFrom__pred__monotest4__86__1(t(101), t(1))
+No solutions.
+Complete? y
+Found incorrect contour:
+monotest4(t(101), t(101))
+Is this a bug? y
+      E4:     C3  3 EXIT pred find_origin.monotest4/2-0 (det)
+mdb> break polytest
+ 0: + stop  interface pred find_origin.polytest/3-0 (det)
+mdb> c
+      E5:     C4  2 CALL pred find_origin.polytest/3-0 (det)
+mdb> f
+      E6:     C4  2 EXIT pred find_origin.polytest/3-0 (det)
+mdb> dd
+polytest("hello", u("hello"), 5)
+Valid? b 2
+browser> mark
+polytest4(u("hello"), u("hello"))
+Valid? browse
+browser> set format pretty
+browser> p
+find_origin.polytest4(u("hello"), u("hello"))
+browser> quit
+polytest4(u("hello"), u("hello"))
+Valid? no
+IntroducedFrom__pred__polytest4__148__2(u(string), u(u("hello")), u(u("hello")))
+Valid? y
+Call IntroducedFrom__pred__polytest4__148__2(u(string), u(u("hello")), v(u("hello")))
+No solutions.
+Complete? y
+Found incorrect contour:
+polytest4(u("hello"), u("hello"))
+Is this a bug? y
+      E7:     C5  3 EXIT pred find_origin.polytest4/2-0 (det)
+mdb> delete 0
+ 0: E stop  interface pred find_origin.polytest/3-0 (det)
+mdb> break tracetest
+ 0: + stop  interface pred find_origin.tracetest/2-0 (det)
+mdb> c
+      E8:     C6  2 CALL pred find_origin.tracetest/2-0 (det)
+mdb> f
+      E9:     C6  2 EXIT pred find_origin.tracetest/2-0 (det)
+mdb> dd
+tracetest(t(101), -2)
+Valid? b 1
+browser> mark
+tracetest1(t(101))
+Valid? n
+Found incorrect contour:
+tracetest1(t(101))
+Is this a bug? y
+     E10:     C7  3 EXIT pred find_origin.tracetest1/1-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/find_origin.exp2
===================================================================
RCS file: tests/debugger/declarative/find_origin.exp2
diff -N tests/debugger/declarative/find_origin.exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/find_origin.exp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,80 @@
+      E1:     C1  1 CALL pred find_origin.main/2-0 (det) find_origin.m:26
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> 
+      E2:     C2  2 CALL pred find_origin.monotest/2-0 (det)
+mdb> f
+      E3:     C2  2 EXIT pred find_origin.monotest/2-0 (det)
+mdb> dd
+monotest(t(101), 1)
+Valid? b 1
+browser> mark
+filter(IntroducedFrom__pred__monotest4__86__1(t(101)), [t(1), t(2), t(101), t(3)], [t(101)])
+Valid? n
+Call IntroducedFrom__pred__monotest4__86__1(t(101), t(3))
+No solutions.
+Complete? y
+IntroducedFrom__pred__monotest4__86__1(t(101), t(101))
+Valid? y
+Call IntroducedFrom__pred__monotest4__86__1(t(101), t(2))
+No solutions.
+Complete? y
+Call IntroducedFrom__pred__monotest4__86__1(t(101), t(1))
+No solutions.
+Complete? y
+Found incorrect contour:
+filter(IntroducedFrom__pred__monotest4__86__1(t(101)), [t(1), t(2), t(101), t(3)], [t(101)])
+Is this a bug? y
+      E4:     C3  4 EXIT pred list.filter/3-0 (det)
+mdb> break polytest
+ 0: + stop  interface pred find_origin.polytest/3-0 (det)
+mdb> c
+      E5:     C4  2 CALL pred find_origin.polytest/3-0 (det)
+mdb> f
+      E6:     C4  2 EXIT pred find_origin.polytest/3-0 (det)
+mdb> dd
+polytest("hello", u("hello"), 5)
+Valid? b 2
+browser> mark
+filter(IntroducedFrom__pred__polytest4__148__2(u(string), u(u/1)), [v(u/1), v(u/1), v(u/1), u(u/1)], [u/1])
+Valid? browse
+browser> set format pretty
+browser> p
+list.filter(
+  IntroducedFrom__pred__polytest4__148__2(u(string), u(u("hello"))), 
+  [|](
+    v(u("hello")), 
+    [|](v(u("hello")), [|](v(u("hello")), [|](u(u("hello")), [])))), 
+  [|](u(u("hello")), []))
+browser> quit
+filter(IntroducedFrom__pred__polytest4__148__2(u(string), u(u/1)), [v(u/1), v(u/1), v(u/1), u(u/1)], [u/1])
+Valid? no
+IntroducedFrom__pred__polytest4__148__2(u(string), u(u("hello")), u(u("hello")))
+Valid? y
+Call IntroducedFrom__pred__polytest4__148__2(u(string), u(u("hello")), v(u("hello")))
+No solutions.
+Complete? y
+Found incorrect contour:
+filter(IntroducedFrom__pred__polytest4__148__2(u(string), u(u/1)), [v(u/1), v(u/1), v(u/1), u(u/1)], [u/1])
+Is this a bug? y
+      E7:     C5  4 EXIT pred list.filter/3-0 (det)
+mdb> delete 0
+ 0: E stop  interface pred find_origin.polytest/3-0 (det)
+mdb> break tracetest
+ 0: + stop  interface pred find_origin.tracetest/2-0 (det)
+mdb> c
+      E8:     C6  2 CALL pred find_origin.tracetest/2-0 (det)
+mdb> f
+      E9:     C6  2 EXIT pred find_origin.tracetest/2-0 (det)
+mdb> dd
+tracetest(t(101), -2)
+Valid? b 1
+browser> mark
+tracetest1(t(101))
+Valid? n
+Found incorrect contour:
+tracetest1(t(101))
+Is this a bug? y
+     E10:     C7  3 EXIT pred find_origin.tracetest1/1-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/find_origin.exp3
===================================================================
RCS file: tests/debugger/declarative/find_origin.exp3
diff -N tests/debugger/declarative/find_origin.exp3
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/find_origin.exp3	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,55 @@
+      E1:     C1  1 CALL pred find_origin.main/2-0 (det) find_origin.m:26
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> step
+      E2:     C2  2 CALL pred find_origin.monotest/2-0 (det)
+mdb> finish
+      E3:     C2  2 EXIT pred find_origin.monotest/2-0 (det)
+mdb> dd
+monotest(t(101), 1)
+Valid? b 1
+browser> mark
+monotest1(t(101))
+Valid? n
+Found incorrect contour:
+monotest1(t(101))
+Is this a bug? y
+      E4:     C3  4 CALL pred list.reverse/2-0 (det)
+mdb> break polytest
+ 0: + stop  interface pred find_origin.polytest/3-0 (det)
+mdb> c
+      E5:     C4  2 CALL pred find_origin.polytest/3-0 (det)
+mdb> f
+      E6:     C4  2 EXIT pred find_origin.polytest/3-0 (det)
+mdb> dd
+polytest("hello", u("hello"), 5)
+Valid? b 2
+browser> mark
+polytest1("hello", u("hello"))
+Valid? n
+Found incorrect contour:
+polytest1("hello", u("hello"))
+Is this a bug? y
+      E7:     C5  3 EXIT pred find_origin.polytest1/2-0 (det)
+mdb> c
+      E6:     C4  2 EXIT pred find_origin.polytest/3-0 (det)
+mdb> delete 0
+ 0: E stop  interface pred find_origin.polytest/3-0 (det)
+mdb> break tracetest
+ 0: + stop  interface pred find_origin.tracetest/2-0 (det)
+mdb> c
+      E8:     C6  2 CALL pred find_origin.tracetest/2-0 (det)
+mdb> f
+      E9:     C6  2 EXIT pred find_origin.tracetest/2-0 (det)
+mdb> dd
+tracetest(t(101), -2)
+Valid? b 1
+browser> mark
+tracetest1(t(101))
+Valid? n
+Found incorrect contour:
+tracetest1(t(101))
+Is this a bug? y
+     E10:     C7  3 EXIT pred find_origin.tracetest1/1-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/find_origin.inp
===================================================================
RCS file: tests/debugger/declarative/find_origin.inp
diff -N tests/debugger/declarative/find_origin.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/find_origin.inp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,38 @@
+register --quiet
+context none
+echo on
+
+f
+dd
+b 1
+mark
+n
+y
+y
+y
+y
+y
+break polytest
+c
+f
+dd
+b 2
+mark
+browse
+set format pretty
+p
+quit
+no
+y
+y
+y
+delete 0
+break tracetest
+c
+f
+dd
+b 1
+mark
+n
+y
+quit -y
Index: tests/debugger/declarative/find_origin.inp2
===================================================================
RCS file: tests/debugger/declarative/find_origin.inp2
diff -N tests/debugger/declarative/find_origin.inp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/find_origin.inp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,38 @@
+register --quiet
+context none
+echo on
+
+f
+dd
+b 1
+mark
+n
+y
+y
+y
+y
+y
+break polytest
+c
+f
+dd
+b 2
+mark
+browse
+set format pretty
+p
+quit
+no
+y
+y
+y
+delete 0
+break tracetest
+c
+f
+dd
+b 1
+mark
+n
+y
+quit -y
Index: tests/debugger/declarative/find_origin.inp3
===================================================================
RCS file: tests/debugger/declarative/find_origin.inp3
diff -N tests/debugger/declarative/find_origin.inp3
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/find_origin.inp3	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,29 @@
+register --quiet
+context none
+echo on
+step
+finish
+dd
+b 1
+mark
+n
+y
+break polytest
+c
+f
+dd
+b 2
+mark
+n
+y
+c
+delete 0
+break tracetest
+c
+f
+dd
+b 1
+mark
+n
+y
+quit -y
Index: tests/debugger/declarative/find_origin.m
===================================================================
RCS file: tests/debugger/declarative/find_origin.m
diff -N tests/debugger/declarative/find_origin.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/find_origin.m	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,224 @@
+:- module find_origin.
+
+%
+% Tests 4 cases of dependency tracking : 
+%   1. When the subterm is an input and the origin is the output of a sibling.
+%   2. When the subterm is an input and the origin is the input from the 
+%      parent.
+%   3. When the subterm is an output and the origin is an input argument of the
+%      same procedure.
+%   4. When the subterm is an output and the origin is an output of a child.
+%   
+% These 4 cases are tested with a monomorphic predicate and a polymorphic 
+% predicate.
+% 
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module int, list.
+
+main(!IO) :-
+	monotest(X, _),
+	polytest("hello", Y, Z),
+	tracetest(U, V),
+	write(U, !IO),
+	write(V, !IO),
+	write(X, !IO),
+	write(Y, !IO),
+	write(Z, !IO).
+
+:- type t ---> t(int).
+
+:- pred monotest(t::out, int::out) is det.
+
+monotest(B, I) :-
+	make_int(I),
+	monotest1(C),
+	C = t(X),
+	(
+		X > 0
+	->
+		monotest2(C, D)
+	;
+		C = D
+	),
+	D = t(Y),
+	(
+		Y =< 0
+	->
+		D = E
+	;
+		monotest3(D, E)
+	),
+	monotest4(E, B).
+
+:- pred monotest1(t::out) is det.
+
+monotest1(t(101)).
+
+:- pred monotest2(t::in, t::out) is det.
+
+monotest2(A, A).
+
+:- pred monotest3(t::in, t::out) is det.
+
+monotest3(A, B) :-
+	L = [A, t(1), t(2)],
+	reverse(L, LR),
+	(
+		LR = [_, _, E]
+	->
+		B = E
+	;
+		B = t(1)
+	).
+
+:- pred monotest4(t::in, t::out) is det.
+
+monotest4(A, B) :-
+	L = [t(1), t(2), A, t(3)],
+	filter(unify(A), L, L1),
+	(
+		L1 = [C]
+	->
+		B = C
+	;
+		B = t(4)
+	).
+
+:- type u(T) ---> u(T); v(T).
+
+:- pred polytest(T::in, u(T)::out, int::out) is det.
+
+polytest(A, B, I) :-
+	make_int(I1),
+	polytest1(A, C),
+	(
+		C = u(_)
+	->
+		polytest2(C, D)
+	;
+		C = D
+	),
+	I2 = 2 + I1 * 2,
+	(
+		D = v(X),
+		u(X) = E,
+		I3 = I2 + 2
+	;
+		D = u(_),
+		I3 = I1 + 2,
+		polytest3(D, E)
+	),
+	I4 = I3 mod 3 + I1,
+	polytest4(E, B),
+	I = I4 * 5.
+
+:- pred polytest1(T::in, u(T)::out) is det.
+
+polytest1(X, u(X)).
+
+:- pred polytest2(T::in, T::out) is det.
+
+polytest2(A, A).
+
+:- pred polytest3(T::in, T::out) is det.
+
+polytest3(A, B) :-
+	L = [A, A, A],
+	reverse(L, LR),
+	(
+		LR = [_, _, E]
+	->
+		B = E
+	;
+		B = A
+	).
+
+:- pred polytest4(T::in, T::out) is det.
+
+polytest4(A, B) :-
+	L = [v(A), v(A), v(A), u(A)],
+	filter(unify(u(A)), L, L1),
+	(
+		L1 = [u(C)]
+	->
+		B = C
+	;
+		B = A
+	).
+
+:- pred tracetest(t::out, int::out) is det.
+
+tracetest(B, I) :-
+	make_int(I0),
+	tracetest1(C),
+	I1 = I0 - 5,
+	(
+		I0 > 0
+	->
+		tracetest2(C, D),
+		I2 = I1 + 6
+	;
+		C = D,
+		I2 = I0 + 9
+	),
+	I3 = I2 + I0 + I1,
+	I4 = I3 * 2,
+	(
+		I0 =< 0
+	->
+		D = E,
+		I6 = I4 + 2
+	;
+		I5 = I4 + 3,
+		tracetest3(D, E),
+		I6 = I5 - 5
+	),
+	I7 = I6 + 1,
+	tracetest4(E, B),
+	I = I7 + 1.
+
+:- pred tracetest1(t::out) is det.
+
+tracetest1(t(101)).
+
+:- pred tracetest2(t::in, t::out) is det.
+
+tracetest2(A, A).
+
+:- pred tracetest3(t::in, t::out) is det.
+
+tracetest3(A, B) :-
+	L = [t(1), t(2), A],
+	(
+		L = [_, _, E],
+		E = A
+	->
+		B = E
+	;
+		B = t(1)
+	).
+
+:- pred tracetest4(t::in, t::out) is det.
+
+tracetest4(A, B) :-
+	L = [t(1), t(2), A, t(3)],
+	(
+		L = [_, _, C, _],
+		C = A
+	->
+		B = C
+	;
+		B = t(4)
+	).
+
+:- pred make_int(int::out) is det.
+
+make_int(1).
Index: tests/debugger/declarative/ho5.exp3
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/ho5.exp3,v
retrieving revision 1.1
diff -u -r1.1 ho5.exp3
--- tests/debugger/declarative/ho5.exp3	18 Mar 2003 16:38:47 -0000	1.1
+++ tests/debugger/declarative/ho5.exp3	28 Sep 2004 06:26:01 -0000
@@ -5,9 +5,9 @@
 mdb> break p
  0: + stop  interface pred ho5.p/2-0 (det)
 mdb> continue
-       2:      2  2 CALL pred ho5.p/2-0 (det) ho5.m:18
+      12:      9  7 CALL pred ho5.p/2-0 (det) ho5.m:18 (exception.m:NNNN)
 mdb> finish
-       9:      2  2 EXCP pred ho5.p/2-0 (det) c2; ho5.m:18
+      25:      9  7 EXCP pred ho5.p/2-0 (det) c2; ho5.m:18 (exception.m:NNNN)
 mdb> dd
 Call p(1, _)
 Throws zero
@@ -21,15 +21,12 @@
 p(1, _)
 zero
 Is this a bug? yes
-       9:      2  2 EXCP pred ho5.p/2-0 (det) c2; ho5.m:18
+      25:      9  7 EXCP pred ho5.p/2-0 (det) c2; ho5.m:18 (exception.m:NNNN)
 mdb> continue
-mdb: warning: reached label with no stack layout info
-This may result in some exception events
-being omitted from the trace.
 exception(univ_cons('<<function>>'))
-      10:      5  2 CALL pred ho5.p/2-0 (det) ho5.m:18
+    1603:    608  7 CALL pred ho5.p/2-0 (det) ho5.m:18 (exception.m:NNNN)
 mdb> finish
-      17:      5  2 EXCP pred ho5.p/2-0 (det) c2; ho5.m:18
+    1616:    608  7 EXCP pred ho5.p/2-0 (det) c2; ho5.m:18 (exception.m:NNNN)
 mdb> dd
 Call p(2, _)
 Throws zero
@@ -40,9 +37,6 @@
 p(2, _)
 zero
 Is this a bug? yes
-      17:      5  2 EXCP pred ho5.p/2-0 (det) c2; ho5.m:18
+    1616:    608  7 EXCP pred ho5.p/2-0 (det) c2; ho5.m:18 (exception.m:NNNN)
 mdb> continue
-mdb: warning: reached label with no stack layout info
-This may result in some exception events
-being omitted from the trace.
 exception(univ_cons('<<function>>'))
Index: tests/debugger/declarative/ignore.exp
===================================================================
RCS file: tests/debugger/declarative/ignore.exp
diff -N tests/debugger/declarative/ignore.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/ignore.exp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,47 @@
+      E1:     C1  1 CALL pred ignore.main/2-0 (det) ignore.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> trust ignore_1
+Trusting module ignore_1
+mdb> step
+      E2:     C2  2 CALL pred ignore.p/1-0 (det)
+mdb> finish
+      E3:     C2  2 EXIT pred ignore.p/1-0 (det)
+mdb> dd
+p(15)
+Valid? b 1
+browser> mark
+q(1, 0) = 1
+Valid? n
+Found incorrect contour:
+q(1, 0) = 1
+Is this a bug? y
+      E4:     C3  4 EXIT func ignore.q/2-0 (det)
+mdb> break 15
+ 0: + stop  linenumber ignore.m:15
+mdb> continue
+      E5:     C4  2 CALL pred ignore.p/1-0 (det)
+mdb> finish
+      E6:     C4  2 EXIT pred ignore.p/1-0 (det)
+mdb> dd
+p(15)
+Valid? n
+Found incorrect contour:
+q(1, 0) = 1
+Is this a bug? n
+q(1, 0) = 1
+Valid? [no] y
+q(2, 1) = 3
+Valid? y
+q(3, 3) = 6
+Valid? y
+q(4, 6) = 10
+Valid? y
+q(5, 10) = 15
+Valid? y
+Found incorrect contour:
+p(15)
+Is this a bug? y
+      E6:     C4  2 EXIT pred ignore.p/1-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/ignore.exp2
===================================================================
RCS file: tests/debugger/declarative/ignore.exp2
diff -N tests/debugger/declarative/ignore.exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/ignore.exp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,44 @@
+      E1:     C1  1 CALL pred ignore.main/2-0 (det) ignore.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> trust int
+Trusting module int
+mdb> trust ignore_1
+Trusting module ignore_1
+mdb> step
+      E2:     C2  2 CALL pred ignore.p/1-0 (det)
+mdb> finish
+      E3:     C2  2 EXIT pred ignore.p/1-0 (det)
+mdb> dd
+p(15)
+Valid? b 1
+browser> mark
+q(5, 10) = 15
+Valid? n
+Found incorrect contour:
+q(5, 10) = 15
+Is this a bug? y
+      E4:     C3  8 EXIT func ignore.q/2-0 (det)
+mdb> break 15
+ 0: + stop  linenumber ignore.m:15
+mdb> continue
+      E5:     C4  2 CALL pred ignore.p/1-0 (det)
+mdb> finish
+      E6:     C4  2 EXIT pred ignore.p/1-0 (det)
+mdb> dd
+p(15)
+Valid? n
+q(1, 0) = 1
+Valid? y
+q(2, 1) = 3
+Valid? y
+q(3, 3) = 6
+Valid? y
+q(4, 6) = 10
+Valid? y
+Found incorrect contour:
+q(5, 10) = 15
+Is this a bug? y
+      E7:     C5  8 EXIT func ignore.q/2-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/ignore.inp
===================================================================
RCS file: tests/debugger/declarative/ignore.inp
diff -N tests/debugger/declarative/ignore.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/ignore.inp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,24 @@
+register --quiet
+context none
+echo on
+trust ignore_1
+step
+finish
+dd
+b 1
+mark
+n
+y
+break 15
+continue
+finish
+dd
+n
+n
+y
+y
+y
+y
+y
+y
+quit -y
Index: tests/debugger/declarative/ignore.inp2
===================================================================
RCS file: tests/debugger/declarative/ignore.inp2
diff -N tests/debugger/declarative/ignore.inp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/ignore.inp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,23 @@
+register --quiet
+context none
+echo on
+trust int
+trust ignore_1
+step
+finish
+dd
+b 1
+mark
+n
+y
+break 15
+continue
+finish
+dd
+n
+y
+y
+y
+y
+y
+quit -y
Index: tests/debugger/declarative/ignore.m
===================================================================
RCS file: tests/debugger/declarative/ignore.m
diff -N tests/debugger/declarative/ignore.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/ignore.m	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,25 @@
+:- module ignore.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module ignore_1, int, list.
+
+main(!IO) :-
+	p(X),
+	p(Y),
+	write_int(X+Y, !IO),
+	nl(!IO).
+
+:- pred p(int::out) is det.
+
+p(ignore_1.fold(q, [1, 2, 3, 4, 5], 0)).
+
+:- func q(int, int) = int.
+
+q(X, Y) = X+Y.
Index: tests/debugger/declarative/ignore_1.m
===================================================================
RCS file: tests/debugger/declarative/ignore_1.m
diff -N tests/debugger/declarative/ignore_1.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/ignore_1.m	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,12 @@
+:- module ignore_1.
+
+:- interface.
+
+:- import_module list.
+
+:- func fold(func(T, T) = T, list(T), T) = T.
+
+:- implementation.
+
+fold(_, [], X) = X.
+fold(F, [H|T], X0) = fold(F, T, F(H, X0)).
Index: tests/debugger/declarative/inadmissible.exp
===================================================================
RCS file: tests/debugger/declarative/inadmissible.exp
diff -N tests/debugger/declarative/inadmissible.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/inadmissible.exp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,40 @@
+      E1:     C1  1 CALL pred inadmissible.main/2-0 (det) inadmissible.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> break gtmax
+ 0: + stop  interface pred inadmissible.gtmax/2-0 (semidet)
+mdb> continue
+      E2:     C2  2 CALL pred inadmissible.gtmax/2-0 (semidet)
+mdb> finish
+      E3:     C2  2 EXIT pred inadmissible.gtmax/2-0 (semidet)
+mdb> dd
+gtmax(2, [2, 3, 1])
+Valid? no
+list_to_set([2, 3, 1], [2, 3, 1])
+Valid? yes
+oset_max([2, 3, 1], 1)
+Valid? inadmissible
+Found inadmissible call:
+Parent gtmax(2, [2, 3, 1])
+Call oset_max([2, 3, 1], _)
+Is this a bug? yes
+      E3:     C2  2 EXIT pred inadmissible.gtmax/2-0 (semidet)
+mdb> dd
+gtmax(2, [2, 3, 1])
+Valid? [no] 
+Found inadmissible call:
+Parent gtmax(2, [2, 3, 1])
+Call oset_max([2, 3, 1], _)
+Is this a bug? no
+gtmax(2, [2, 3, 1])
+Valid? [no] no
+list_to_set([2, 3, 1], [2, 3, 1])
+Valid? [yes] 
+oset_max([2, 3, 1], 1)
+Valid? [inadmissible] yes
+Found incorrect contour:
+gtmax(2, [2, 3, 1])
+Is this a bug? yes
+      E3:     C2  2 EXIT pred inadmissible.gtmax/2-0 (semidet)
+mdb> quit -y
Index: tests/debugger/declarative/inadmissible.exp2
===================================================================
RCS file: tests/debugger/declarative/inadmissible.exp2
diff -N tests/debugger/declarative/inadmissible.exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/inadmissible.exp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,42 @@
+      E1:     C1  1 CALL pred inadmissible.main/2-0 (det) inadmissible.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> trust int
+Trusting module int
+mdb> break gtmax
+ 0: + stop  interface pred inadmissible.gtmax/2-0 (semidet)
+mdb> continue
+      E2:     C2  2 CALL pred inadmissible.gtmax/2-0 (semidet)
+mdb> finish
+      E3:     C2  2 EXIT pred inadmissible.gtmax/2-0 (semidet)
+mdb> dd
+gtmax(2, [2, 3, 1])
+Valid? no
+list_to_set([2, 3, 1], [2, 3, 1])
+Valid? yes
+oset_max([2, 3, 1], 1)
+Valid? inadmissible
+Found inadmissible call:
+Parent gtmax(2, [2, 3, 1])
+Call oset_max([2, 3, 1], _)
+Is this a bug? yes
+      E3:     C2  2 EXIT pred inadmissible.gtmax/2-0 (semidet)
+mdb> dd
+gtmax(2, [2, 3, 1])
+Valid? [no] 
+Found inadmissible call:
+Parent gtmax(2, [2, 3, 1])
+Call oset_max([2, 3, 1], _)
+Is this a bug? no
+gtmax(2, [2, 3, 1])
+Valid? [no] no
+list_to_set([2, 3, 1], [2, 3, 1])
+Valid? [yes] 
+oset_max([2, 3, 1], 1)
+Valid? [inadmissible] yes
+Found incorrect contour:
+gtmax(2, [2, 3, 1])
+Is this a bug? yes
+      E3:     C2  2 EXIT pred inadmissible.gtmax/2-0 (semidet)
+mdb> quit -y
Index: tests/debugger/declarative/inadmissible.inp
===================================================================
RCS file: tests/debugger/declarative/inadmissible.inp
diff -N tests/debugger/declarative/inadmissible.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/inadmissible.inp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,19 @@
+register --quiet
+context none
+echo on
+break gtmax
+continue
+finish
+dd
+no
+yes
+inadmissible
+yes
+dd
+
+no
+no
+
+yes
+yes
+quit -y
Index: tests/debugger/declarative/inadmissible.inp2
===================================================================
RCS file: tests/debugger/declarative/inadmissible.inp2
diff -N tests/debugger/declarative/inadmissible.inp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/inadmissible.inp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,20 @@
+register --quiet
+context none
+echo on
+trust int
+break gtmax
+continue
+finish
+dd
+no
+yes
+inadmissible
+yes
+dd
+
+no
+no
+
+yes
+yes
+quit -y
Index: tests/debugger/declarative/inadmissible.m
===================================================================
RCS file: tests/debugger/declarative/inadmissible.m
diff -N tests/debugger/declarative/inadmissible.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/inadmissible.m	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,51 @@
+:- module inadmissible.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module int, list.
+
+main(!IO) :-
+	(
+		gtmax(2, [2,3,1])
+	->
+		write_string("max", !IO)
+	;
+		write_string("not max", !IO)
+	),
+	nl(!IO).
+
+:- pred gtmax(int::in, list(int)::in) is semidet.
+
+gtmax(A, As) :-
+	list_to_set(As, SA),
+	oset_max(SA, Max),
+	A > Max.
+
+:- pred ltmax(int::in, list(int)::in) is semidet.
+
+ltmax(A, As) :-
+	list_to_set(As, SA),
+	oset_max(SA, Max),
+	A < Max.
+
+:- pred list_to_set(list(int)::in, list(int)::out) is det.
+
+list_to_set(As, S) :- S = As.
+
+:- pred list_to_oset(list(int)::in, list(int)::out) is det.
+
+list_to_oset(As, S) :- sort(int_comp, As, S).
+
+:- pred oset_max(list(int)::in, int::out) is nondet.
+
+oset_max(S, M) :- append(_, [M], S).
+
+:- pred int_comp(int::in, int::in, comparison_result::out) is det.
+
+int_comp(A, B, R) :- compare(R, A, B).
Index: tests/debugger/declarative/ingore.exp
===================================================================
RCS file: tests/debugger/declarative/ingore.exp
diff -N tests/debugger/declarative/ingore.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/ingore.exp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,53 @@
+      E1:     C1  1 CALL pred ignore.main/2-0 (det) ignore.m:13
+mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> trust int
+Registering debuggable procedures... mdb: there is no such module, predicate or function.
+done.
+There are 2 debuggable modules, with a total of 4 procedures.
+mdb> trust ignore_1
+Trusting module ignore_1
+mdb> step
+      E2:     C2  2 CALL pred ignore.p/1-0 (det)
+mdb> finish
+      E3:     C2  2 EXIT pred ignore.p/1-0 (det)
+mdb> dd
+p(15)
+Valid? b 1
+browser> mark
+q(1, 0) = 1
+Valid? n
+Found incorrect contour:
+q(1, 0) = 1
+Is this a bug? y
+      E4:     C3  8 CALL func ignore_1.fold/3-0 (det)
+mdb> retry 7
+      E1:     C1  1 CALL pred ignore.main/2-0 (det)
+mdb> step
+      E2:     C2  2 CALL pred ignore.p/1-0 (det)
+mdb> finish
+      E3:     C2  2 EXIT pred ignore.p/1-0 (det)
+mdb> dd
+p(15)
+Valid? n
+Found incorrect contour:
+q(1, 0) = 1
+Is this a bug? n
+q(1, 0) = 1
+Valid? [no] y
+p(15)
+Valid? [no] n
+q(2, 1) = 3
+Valid? y
+q(3, 3) = 6
+Valid? y
+q(4, 6) = 10
+Valid? y
+q(5, 10) = 15
+Valid? y
+Found incorrect contour:
+p(15)
+Is this a bug? y
+      E3:     C2  2 EXIT pred ignore.p/1-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/input_term_dep.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/input_term_dep.exp,v
retrieving revision 1.5
diff -u -r1.5 input_term_dep.exp
--- tests/debugger/declarative/input_term_dep.exp	17 Jan 2003 05:57:01 -0000	1.5
+++ tests/debugger/declarative/input_term_dep.exp	28 Sep 2004 06:26:01 -0000
@@ -25,8 +25,9 @@
 Valid? yes
 pb(8)
 Valid? yes
-Found incorrect contour:
-p(5, 8, 13)
+Found inadmissible call:
+Parent p(_, _, _)
+Call pc(5, _)
 Is this a bug? yes
       E3:     C2  3 EXIT pred input_term_dep.p/3-0 (det) input_term_dep.m:33 (input_term_dep.m:22)
 mdb> continue
@@ -40,13 +41,12 @@
 q([[2, 3], [], [1]])
 Valid? browse 1
 browser> mark 1/2
-qc([[2, ...], [], [1]], [[2, ...], [], [1]])
-Valid? browse 1
-browser> mark 1/2
 qa([[1], [2, 3]])
 Valid? yes
 qb([])
 Valid? yes
+qc([[2, ...], [], [1]], [[2, ...], [], [1]])
+Valid? yes
 Found incorrect contour:
 q([[2, 3], [], [1]])
 Is this a bug? yes
@@ -67,8 +67,9 @@
 Valid? yes
 rb(3)
 Valid? yes
-Found incorrect contour:
-r(1, 33)
+Found inadmissible call:
+Parent r(1, _)
+Call rc(3, _)
 Is this a bug? yes
       E7:     C4  3 EXIT pred input_term_dep.r/2-0 (det) input_term_dep.m:111 (input_term_dep.m:93)
 mdb> continue
@@ -90,8 +91,9 @@
 Valid? yes
 sb(7)
 Valid? yes
-Found incorrect contour:
-s(1)
+Found inadmissible call:
+Parent s(1)
+Call sc(7)
 Is this a bug? yes
       E9:     C5  3 EXIT pred input_term_dep.s/1-0 (semidet) input_term_dep.m:146 (input_term_dep.m:135)
 mdb> continue
Index: tests/debugger/declarative/input_term_dep.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/input_term_dep.inp,v
retrieving revision 1.1
diff -u -r1.1 input_term_dep.inp
--- tests/debugger/declarative/input_term_dep.inp	23 Apr 2001 16:26:31 -0000	1.1
+++ tests/debugger/declarative/input_term_dep.inp	28 Sep 2004 06:26:01 -0000
@@ -19,8 +19,7 @@
 dd
 browse 1
 mark 1/2
-browse 1
-mark 1/2
+yes
 yes
 yes
 yes
Index: tests/debugger/declarative/lpe_example.exp3
===================================================================
RCS file: tests/debugger/declarative/lpe_example.exp3
diff -N tests/debugger/declarative/lpe_example.exp3
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/lpe_example.exp3	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,69 @@
+       1:      1  1 CALL pred lpe_example.main/2-0 (det) lpe_example.m:8
+mdb> echo on
+Command echo enabled.
+mdb> context none
+Contexts will not be printed.
+mdb> register --quiet
+mdb> break p
+ 0: + stop  interface pred lpe_example.p/2-0 (nondet)
+mdb> continue
+      12:      8  5 CALL pred lpe_example.p/2-0 (nondet)
+mdb> finish
+      22:      8  5 EXIT pred lpe_example.p/2-0 (nondet)
+mdb> dd
+p(1, 13)
+Valid? no
+q(3)
+Valid? yes
+r(3, 13)
+Valid? yes
+Found incorrect contour:
+p(1, 13)
+Is this a bug? yes
+      22:      8  5 EXIT pred lpe_example.p/2-0 (nondet)
+mdb> continue
+      39:      8  5 REDO pred lpe_example.p/2-0 (nondet)
+mdb> finish
+      45:      8  5 EXIT pred lpe_example.p/2-0 (nondet)
+mdb> dd
+p(1, 23)
+Valid? no
+r(3, 23)
+Valid? yes
+Found incorrect contour:
+p(1, 23)
+Is this a bug? yes
+      45:      8  5 EXIT pred lpe_example.p/2-0 (nondet)
+mdb> continue
+      62:      8  5 REDO pred lpe_example.p/2-0 (nondet)
+mdb> finish
+      66:      8  5 EXIT pred lpe_example.p/2-0 (nondet)
+mdb> dd
+p(1, 3)
+Valid? no
+Found incorrect contour:
+p(1, 3)
+Is this a bug? yes
+      66:      8  5 EXIT pred lpe_example.p/2-0 (nondet)
+mdb> continue
+      83:      8  5 REDO pred lpe_example.p/2-0 (nondet)
+mdb> finish
+      84:      8  5 FAIL pred lpe_example.p/2-0 (nondet)
+mdb> dd
+Call p(1, _)
+Solutions:
+	p(1, 13)
+	p(1, 23)
+	p(1, 3)
+Complete? no
+Call r(3, _)
+Solutions:
+	r(3, 13)
+	r(3, 23)
+Complete? yes
+Found partially uncovered atom:
+p(1, _)
+Is this a bug? yes
+      84:      8  5 FAIL pred lpe_example.p/2-0 (nondet)
+mdb> continue
+[3, 13, 23]
Index: tests/debugger/declarative/mismatch_on_call.exp
===================================================================
RCS file: tests/debugger/declarative/mismatch_on_call.exp
diff -N tests/debugger/declarative/mismatch_on_call.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/mismatch_on_call.exp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,19 @@
+      E1:     C1  1 CALL pred mismatch_on_call.main/2-0 (det) mismatch_on_call.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> 
+      E2:     C2  2 CALL pred mismatch_on_call.p/4-0 (det)
+mdb> f
+      E3:     C2  2 EXIT pred mismatch_on_call.p/4-0 (det)
+mdb> dd
+p(1, 2, 204, 202)
+Valid? b 4
+browser> mark
+q(102, 202)
+Valid? n
+Found incorrect contour:
+q(102, 202)
+Is this a bug? y
+      E4:     C3  4 EXIT pred mismatch_on_call.q/2-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/mismatch_on_call.exp2
===================================================================
RCS file: tests/debugger/declarative/mismatch_on_call.exp2
diff -N tests/debugger/declarative/mismatch_on_call.exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/mismatch_on_call.exp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,19 @@
+      E1:     C1  1 CALL pred mismatch_on_call.main/2-0 (det) mismatch_on_call.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> 
+      E2:     C2  2 CALL pred mismatch_on_call.p/4-0 (det)
+mdb> f
+      E3:     C2  2 EXIT pred mismatch_on_call.p/4-0 (det)
+mdb> dd
+p(1, 2, 204, 202)
+Valid? b 4
+browser> mark
++(102, 100) = 202
+Valid? n
+Found incorrect contour:
++(102, 100) = 202
+Is this a bug? y
+      E4:     C3  5 EXIT func int.+/2-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/mismatch_on_call.inp
===================================================================
RCS file: tests/debugger/declarative/mismatch_on_call.inp
diff -N tests/debugger/declarative/mismatch_on_call.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/mismatch_on_call.inp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,11 @@
+register --quiet
+context none
+echo on
+
+f
+dd
+b 4
+mark
+n
+y
+quit -y
Index: tests/debugger/declarative/mismatch_on_call.m
===================================================================
RCS file: tests/debugger/declarative/mismatch_on_call.m
diff -N tests/debugger/declarative/mismatch_on_call.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/mismatch_on_call.m	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,37 @@
+:- module mismatch_on_call.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module int.
+
+main(IO0, IO) :-
+	p(1,2,X,Y),
+	write_int(X, IO0, IO1),
+	write_int(Y, IO1, IO2),
+	nl(IO2, IO).
+
+:- pred p(int::in, int::in, int::out, int::out) is det.
+
+p(A,B,X,Y) :-
+	q(A, G),
+	E = A+2,
+	q(B, C),
+	r(E, C, F, Y),
+	X = G+F.
+
+:- pred r(int::in, int::in, int::out, int::out) is det.
+
+r(A, B, C, D) :-
+	q(A, C),
+	q(B, D).
+
+:- pred q(int::in, int::out) is det.
+
+q(X, X+100).
+
Index: tests/debugger/declarative/revise.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/revise.exp,v
retrieving revision 1.1
diff -u -r1.1 revise.exp
--- tests/debugger/declarative/revise.exp	3 Feb 2003 05:19:32 -0000	1.1
+++ tests/debugger/declarative/revise.exp	28 Sep 2004 06:26:01 -0000
@@ -1,13 +1,13 @@
-       1:      1  1 CALL pred revise.main/2-0 (cc_multi) revise.m:8
+      E1:     C1  1 CALL pred revise.main/2-0 (cc_multi) revise.m:8
+mdb> mdb> Contexts will not be printed.
 mdb> echo on
 Command echo enabled.
-mdb> register --quiet
 mdb> break p
  0: + stop  interface pred revise.p/2-0 (multi)
 mdb> continue
-       2:      2  2 CALL pred revise.p/2-0 (multi) revise.m:21 (revise.m:9)
+      E2:     C2  2 CALL pred revise.p/2-0 (multi)
 mdb> finish
-      14:      2  2 EXIT pred revise.p/2-0 (multi) revise.m:21 (revise.m:9)
+      E3:     C2  2 EXIT pred revise.p/2-0 (multi)
 mdb> dd
 p("foo", "foo")
 Valid? no
@@ -30,11 +30,11 @@
 p("foo", "foo")
 Is this a bug? no
 p("foo", "foo")
-Valid? [no] 
+Valid? [no] no
 q("foo", "foo")
 Valid? [yes] no
 Found incorrect contour:
 q("foo", "foo")
 Is this a bug? yes
-       4:      3  3 EXIT pred revise.q/2-0 (det) revise.m:23 (revise.m:21)
+      E4:     C3  3 EXIT pred revise.q/2-0 (det)
 mdb> quit -y
Index: tests/debugger/declarative/revise.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/revise.inp,v
retrieving revision 1.1
diff -u -r1.1 revise.inp
--- tests/debugger/declarative/revise.inp	3 Feb 2003 05:19:32 -0000	1.1
+++ tests/debugger/declarative/revise.inp	28 Sep 2004 06:26:01 -0000
@@ -1,5 +1,6 @@
-echo on
 register --quiet
+context none
+echo on
 break p
 continue
 finish
@@ -13,7 +14,7 @@
 yes
 yes
 no
-
+no
 no
 yes
 quit -y
Index: tests/debugger/declarative/skip.exp
===================================================================
RCS file: tests/debugger/declarative/skip.exp
diff -N tests/debugger/declarative/skip.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/skip.exp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,107 @@
+      E1:     C1  1 CALL pred skip.main/2-0 (det) skip.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> step
+      E2:     C2  2 CALL pred skip.a/2-0 (det)
+mdb> finish
+      E3:     C2  2 EXIT pred skip.a/2-0 (det)
+mdb> dd
+a(1, 70)
+Valid? skip
+b(1, 70)
+Valid? y
+c(70, 70)
+Valid? y
+d(70, 70)
+Valid? y
+a(1, 70)
+Valid? n
+Found incorrect contour:
+a(1, 70)
+Is this a bug? y
+      E3:     C2  2 EXIT pred skip.a/2-0 (det)
+mdb> trust b
+Trusting pred skip.b/2
+mdb> trust d
+Trusting pred skip.d/2
+mdb> step
+      E4:     C3  2 CALL pred skip.a/2-0 (det)
+mdb> finish
+      E5:     C3  2 EXIT pred skip.a/2-0 (det)
+mdb> dd
+a(2, 71)
+Valid? skip
+c(71, 71)
+Valid? skip
+e(71, 71)
+Valid? n
+Found incorrect contour:
+e(71, 71)
+Is this a bug? y
+      E6:     C4  4 EXIT pred skip.e/2-0 (det)
+mdb> untrust 0
+mdb> untrust 0
+mdb> trusted
+There are no trusted modules, predicates or functions.
+mdb> break a
+ 0: + stop  interface pred skip.a/2-0 (det)
+mdb> continue
+      E5:     C3  2 EXIT pred skip.a/2-0 (det)
+mdb> step
+      E7:     C5  2 CALL pred skip.a/2-0 (det)
+mdb> finish
+      E8:     C5  2 EXIT pred skip.a/2-0 (det)
+mdb> dd
+a(3, 72)
+Valid? n
+b(3, 72)
+Valid? y
+c(72, 72)
+Valid? n
+e(72, 72)
+Valid? 
+f(72, 72)
+Valid? 
+e(72, 72)
+Valid? skip
+f(72, 72)
+Valid? y
+e(72, 72)
+Valid? y
+Found incorrect contour:
+c(72, 72)
+Is this a bug? y
+      E9:     C6  3 EXIT pred skip.c/2-0 (det)
+mdb> dd
+c(72, 72)
+Valid? [no] a
+Diagnosis aborted.
+      E9:     C6  3 EXIT pred skip.c/2-0 (det)
+mdb> break a
+ 1: + stop  interface pred skip.a/2-0 (det)
+mdb> c
+      E8:     C5  2 EXIT pred skip.a/2-0 (det)
+mdb> retry
+      E7:     C5  2 CALL pred skip.a/2-0 (det)
+mdb> f
+      E8:     C5  2 EXIT pred skip.a/2-0 (det)
+mdb> dd
+a(3, 72)
+Valid? [no] 
+c(72, 72)
+Valid? [no] y
+d(72, 72)
+Valid? n
+Found incorrect contour:
+d(72, 72)
+Is this a bug? n
+d(72, 72)
+Valid? [no] skip
+d(72, 72)
+Valid? y
+Found incorrect contour:
+a(3, 72)
+Is this a bug? y
+      E8:     C5  2 EXIT pred skip.a/2-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/skip.exp2
===================================================================
RCS file: tests/debugger/declarative/skip.exp2
diff -N tests/debugger/declarative/skip.exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/skip.exp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,107 @@
+      E1:     C1  1 CALL pred skip.main/2-0 (det) skip.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> step
+      E2:     C2  2 CALL pred skip.a/2-0 (det)
+mdb> finish
+      E3:     C2  2 EXIT pred skip.a/2-0 (det)
+mdb> dd
+a(1, 70)
+Valid? skip
+b(1, 70)
+Valid? y
+c(70, 70)
+Valid? y
+d(70, 70)
+Valid? y
+a(1, 70)
+Valid? n
+Found incorrect contour:
+a(1, 70)
+Is this a bug? y
+      E3:     C2  2 EXIT pred skip.a/2-0 (det)
+mdb> trust b
+Trusting pred skip.b/2
+mdb> trust d
+Trusting pred skip.d/2
+mdb> step
+      E4:     C3  2 CALL pred skip.a/2-0 (det)
+mdb> finish
+      E5:     C3  2 EXIT pred skip.a/2-0 (det)
+mdb> dd
+a(2, 71)
+Valid? skip
+c(71, 71)
+Valid? skip
++(2, 69) = 71
+Valid? n
+Found incorrect contour:
++(2, 69) = 71
+Is this a bug? y
+      E6:     C4  4 EXIT func int.+/2-0 (det)
+mdb> untrust 0
+mdb> untrust 0
+mdb> trusted
+There are no trusted modules, predicates or functions.
+mdb> break a
+ 0: + stop  interface pred skip.a/2-0 (det)
+mdb> continue
+      E5:     C3  2 EXIT pred skip.a/2-0 (det)
+mdb> step
+      E7:     C5  2 CALL pred skip.a/2-0 (det)
+mdb> finish
+      E8:     C5  2 EXIT pred skip.a/2-0 (det)
+mdb> dd
+a(3, 72)
+Valid? n
+b(3, 72)
+Valid? y
+c(72, 72)
+Valid? n
+e(72, 72)
+Valid? 
+f(72, 72)
+Valid? 
+e(72, 72)
+Valid? skip
+f(72, 72)
+Valid? y
+e(72, 72)
+Valid? y
+Found incorrect contour:
+c(72, 72)
+Is this a bug? y
+      E9:     C6  3 EXIT pred skip.c/2-0 (det)
+mdb> dd
+c(72, 72)
+Valid? [no] a
+Diagnosis aborted.
+      E9:     C6  3 EXIT pred skip.c/2-0 (det)
+mdb> break a
+ 1: + stop  interface pred skip.a/2-0 (det)
+mdb> c
+      E8:     C5  2 EXIT pred skip.a/2-0 (det)
+mdb> retry
+      E7:     C5  2 CALL pred skip.a/2-0 (det)
+mdb> f
+      E8:     C5  2 EXIT pred skip.a/2-0 (det)
+mdb> dd
+a(3, 72)
+Valid? [no] 
+c(72, 72)
+Valid? [no] y
+d(72, 72)
+Valid? n
+Found incorrect contour:
+d(72, 72)
+Is this a bug? n
+d(72, 72)
+Valid? [no] skip
+d(72, 72)
+Valid? y
+Found incorrect contour:
+a(3, 72)
+Is this a bug? y
+      E8:     C5  2 EXIT pred skip.a/2-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/skip.inp
===================================================================
RCS file: tests/debugger/declarative/skip.inp
diff -N tests/debugger/declarative/skip.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/skip.inp	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,53 @@
+register --quiet
+context none
+echo on
+step
+finish
+dd
+skip
+y
+y
+y
+n
+y
+trust b
+trust d
+step
+finish
+dd
+skip
+skip
+n
+y
+untrust 0
+untrust 0
+trusted
+break a
+continue
+step
+finish
+dd
+n
+y
+n
+
+
+skip
+y
+y
+y
+dd
+a
+break a
+c
+retry
+f
+dd
+
+y
+n
+n
+skip
+y
+y
+quit -y
Index: tests/debugger/declarative/skip.m
===================================================================
RCS file: tests/debugger/declarative/skip.m
diff -N tests/debugger/declarative/skip.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/skip.m	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,42 @@
+:- module skip.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module int.
+
+main(!IO) :-
+	a(1, X),
+	a(2, Y),
+	a(3, Z),
+	write_int(X+Y+Z, !IO),
+	nl(!IO).
+
+:- pred a(int::in, int::out) is det.
+
+a(Y, X) :- b(Y, A), c(A, B), d(B, X).
+
+:- pred b(int::in, int::out) is det.
+
+b(X, X+69).
+
+:- pred c(int::in, int::out) is det.
+
+c(A, B) :- e(A, C), f(C, B).
+
+:- pred d(int::in, int::out) is det.
+
+d(X, X).
+
+:- pred e(int::in, int::out) is det.
+
+e(X, X).
+
+:- pred f(int::in, int::out) is det.
+
+f(X, X).
Index: tests/debugger/declarative/solutions.exp3
===================================================================
RCS file: tests/debugger/declarative/solutions.exp3
diff -N tests/debugger/declarative/solutions.exp3
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/solutions.exp3	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,39 @@
+       1:      1  1 CALL pred solutions.main/2-0 (det) solutions.m:8
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> trust int
+Trusting module int
+mdb> trust list
+Trusting module list
+mdb> trust std_util
+Trusting module std_util
+mdb> break p
+ 0: + stop  interface pred solutions.p/2-0 (det)
+mdb> continue
+       2:      2  2 CALL pred solutions.p/2-0 (det)
+mdb> finish
+     233:      2  2 EXIT pred solutions.p/2-0 (det)
+mdb> dd
+p(1, [1, 2, 3])
+Valid? no
+q(1, 1)
+Valid? yes
+q(1, 2)
+Valid? yesy
+Unknown command, 'h' for help.
+q(1, 2)
+Valid? yes
+q(1, 3)
+Valid? yes
+Call q(1, _)
+Solutions:
+	q(1, 1)
+	q(1, 2)
+	q(1, 3)
+Complete? yes
+Found incorrect contour:
+p(1, [1, 2, 3])
+Is this a bug? yes
+     233:      2  2 EXIT pred solutions.p/2-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/solutions.inp3
===================================================================
RCS file: tests/debugger/declarative/solutions.inp3
diff -N tests/debugger/declarative/solutions.inp3
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/solutions.inp3	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,18 @@
+register --quiet
+context none
+echo on
+trust int
+trust list
+trust std_util
+break p
+continue
+finish
+dd
+no
+yes
+yesy
+yes
+yes
+yes
+yes
+quit -y
Index: tests/debugger/declarative/special_term_dep.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/special_term_dep.exp,v
retrieving revision 1.3
diff -u -r1.3 special_term_dep.exp
--- tests/debugger/declarative/special_term_dep.exp	17 Jan 2003 05:57:02 -0000	1.3
+++ tests/debugger/declarative/special_term_dep.exp	28 Sep 2004 06:26:01 -0000
@@ -34,8 +34,9 @@
 browser> mark
 qa([1, 2])
 Valid? yes
-Found incorrect contour:
-q([1, 2], [3])
+Found inadmissible call:
+Parent q([1, 2], _)
+Call qb([1, 2], _)
 Is this a bug? yes
       E5:     C3  3 EXIT pred special_term_dep.q/2-0 (semidet) special_term_dep.m:61 (special_term_dep.m:50)
 mdb> continue
Index: tests/debugger/declarative/throw.exp3
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/throw.exp3,v
retrieving revision 1.1
diff -u -r1.1 throw.exp3
--- tests/debugger/declarative/throw.exp3	18 Mar 2003 16:38:47 -0000	1.1
+++ tests/debugger/declarative/throw.exp3	28 Sep 2004 06:26:01 -0000
@@ -7,9 +7,9 @@
 mdb> break q
  1: + stop  interface pred throw.q/1-0 (semidet)
 mdb> continue
-       2:      2  2 CALL pred throw.p/1-0 (cc_nondet) throw.m:20
+      13:      9  7 CALL pred throw.p/1-0 (cc_nondet) throw.m:20 (exception.m:NNNN)
 mdb> finish
-      31:      2  2 EXCP pred throw.p/1-0 (cc_nondet)
+      70:      9  7 EXCP pred throw.p/1-0 (cc_nondet)
 mdb> dd
 Call p(_)
 Throws "Too big"
@@ -23,15 +23,12 @@
 p(_)
 "Too big"
 Is this a bug? yes
-      31:      2  2 EXCP pred throw.p/1-0 (cc_nondet)
+      70:      9  7 EXCP pred throw.p/1-0 (cc_nondet)
 mdb> continue
-mdb: warning: reached label with no stack layout info
-This may result in some exception events
-being omitted from the trace.
 exception(univ_cons("Too big"))
-      32:      6  2 CALL pred throw.q/1-0 (semidet) throw.m:48
+    1210:    466  7 CALL pred throw.q/1-0 (semidet) throw.m:48 (exception.m:NNNN)
 mdb> finish
-      65:      6  2 EXCP pred throw.q/1-0 (semidet)
+    1267:    466  7 EXCP pred throw.q/1-0 (semidet)
 mdb> dd
 Call q(_)
 Throws "Too big"
@@ -45,9 +42,6 @@
 q(_)
 "Too big"
 Is this a bug? yes
-      65:      6  2 EXCP pred throw.q/1-0 (semidet)
+    1267:    466  7 EXCP pred throw.q/1-0 (semidet)
 mdb> continue
-mdb: warning: reached label with no stack layout info
-This may result in some exception events
-being omitted from the trace.
 exception(univ_cons("Too big"))
Index: tests/debugger/declarative/trust.exp2
===================================================================
RCS file: tests/debugger/declarative/trust.exp2
diff -N tests/debugger/declarative/trust.exp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/trust.exp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,81 @@
+      E1:     C1  1 CALL pred trust.main/2-0 (cc_multi) trust.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> trust trust_1.
+Ambiguous predicate or function specification. The matches are:
+0: pred trust_1.IntroducedFrom__pred__w_cmp__15__1/3
+1: pred trust_1.w_cmp/3
+
+Which predicate or function do you want to trust (0-1 or *)? *
+Trusting pred trust_1.IntroducedFrom__pred__w_cmp__15__1/3
+Trusting pred trust_1.w_cmp/3
+mdb> trusted
+Trusted Objects:
+0: pred trust_1.IntroducedFrom__pred__w_cmp__15__1/3
+1: pred trust_1.w_cmp/3
+mdb> untrust 1
+mdb> trusted
+Trusted Objects:
+0: pred trust_1.IntroducedFrom__pred__w_cmp__15__1/3
+mdb> untrust 0
+mdb> trusted
+There are no trusted modules, predicates or functions.
+mdb> trust trust_2
+Trusting module trust_2
+mdb> trust trust.
+Ambiguous predicate or function specification. The matches are:
+0: pred trust.dostuff/2
+1: pred trust.main/2
+
+Which predicate or function do you want to trust (0-1 or *)? 1
+Trusting pred trust.main/2
+mdb> trusted
+Trusted Objects:
+0: module trust_2
+1: pred trust.main/2
+mdb> trust trust_2
+Trusting module trust_2
+mdb> trusted
+Trusted Objects:
+0: module trust_2
+1: pred trust.main/2
+mdb> untrust 0
+mdb> trust trust_1
+Trusting module trust_1
+mdb> trust no_such_module
+mdb: there is no such module, predicate or function.
+mdb> trust trust_2.
+Trusting pred trust_2.concat/3
+mdb> trusted
+Trusted Objects:
+0: module trust_1
+1: pred trust.main/2
+2: pred trust_2.concat/3
+mdb> untrust 1
+mdb> trusted
+Trusted Objects:
+0: module trust_1
+1: pred trust_2.concat/3
+mdb> untrust 99
+mdb: no such trusted object
+mdb> step
+      E2:     C2  2 CALL pred trust.dostuff/2-0 (cc_multi)
+mdb> finish
+      E3:     C2  2 EXIT pred trust.dostuff/2-0 (cc_multi)
+mdb> dd
+dostuff(w("aaabbb"), '=')
+Valid? n
+++("aaa", "bbb") = "aaabbb"
+Valid? y
+to_upper("aaB") = "AAB"
+Valid? y
+to_upper("aAB") = "AAB"
+Valid? y
+Found incorrect contour:
+dostuff(w("aaabbb"), '=')
+Is this a bug? y
+      E3:     C2  2 EXIT pred trust.dostuff/2-0 (cc_multi)
+mdb> continue
+aaabbb
+'='
Index: tests/debugger/declarative/trust.inp2
===================================================================
RCS file: tests/debugger/declarative/trust.inp2
diff -N tests/debugger/declarative/trust.inp2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/trust.inp2	28 Sep 2004 06:26:01 -0000
@@ -0,0 +1,33 @@
+register --quiet
+context none
+echo on
+trust trust_1.
+*
+trusted
+untrust 1
+trusted
+untrust 0
+trusted
+trust trust_2
+trust trust.
+1
+trusted
+trust trust_2
+trusted
+untrust 0
+trust trust_1
+trust no_such_module
+trust trust_2.
+trusted
+untrust 1
+trusted
+untrust 99
+step
+finish
+dd
+n
+y
+y
+y
+y
+continue
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.71
diff -u -r1.71 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	20 Sep 2004 04:50:25 -0000	1.71
+++ trace/mercury_trace_declarative.c	28 Sep 2004 14:32:13 -0000
@@ -51,15 +51,6 @@
 #include <errno.h>
 
 /*
-** We only build the annotated trace for events down to a certain
-** depth.  The following macro gives the default depth limit (relative
-** to the starting depth).  In future it would be nice to dynamically
-** adjust this factor based on profiling information.
-*/
-
-#define MR_EDT_DEPTH_STEP_SIZE		30
-
-/*
 ** These macros are to aid debugging of the code which constructs
 ** the annotated trace.
 */
@@ -113,6 +104,26 @@
 static	MR_bool		MR_edt_inside;
 static	MR_Unsigned	MR_edt_start_seqno;
 static	MR_Unsigned	MR_edt_start_io_counter;
+static	MR_Unsigned	MR_edt_initial_depth;
+
+/*
+** The depth of the EDT is different from the call depth of the events,
+** since the call depth is not guaranteed to be the same for the children
+** of a call eventi - see comments in MR_trace_real in trace/mercury_trace.c.
+** We use the following variable to keep track of the EDT depth.
+*/
+
+static	MR_Integer	MR_edt_depth;
+
+/*
+** We only build the annotated trace for events down to a certain
+** depth.  MR_edt_depth_step_size gives the default depth limit (relative
+** to the starting depth).  This is doubled everytime a new part
+** of the annotated trace is built.  In future it would be nice to 
+** adjust this factor based on profiling information.  
+*/
+		
+static	int	MR_edt_depth_step_size = 3;
 
 /*
 ** The declarative debugger ignores modules that were not compiled with
@@ -202,11 +213,14 @@
 				MR_Word *saved_regs);
 static	const char	*MR_trace_start_collecting(MR_Unsigned event,
 				MR_Unsigned seqno, MR_Unsigned maxdepth,
+				MR_Unsigned initial_depth,
 				MR_Trace_Cmd_Info *cmd,
 				MR_Event_Info *event_info,
 				MR_Event_Details *event_details,
 				MR_Code **jumpaddr);
-static	MR_Code		*MR_trace_restart_decl_debug(MR_Unsigned event,
+static	MR_Code		*MR_trace_restart_decl_debug(
+				MR_Trace_Node call_preceding,
+				MR_Unsigned event,
 				MR_Unsigned seqno, MR_Trace_Cmd_Info *cmd,
 				MR_Event_Info *event_info,
 				MR_Event_Details *event_details);
@@ -239,6 +253,7 @@
 	MR_Trace_Node		trace;
 	MR_Event_Details	event_details;
 	MR_Integer		trace_suppress;
+	MR_Unsigned		depth_check_adjustment = 0;
 
 	entry = event_info->MR_event_sll->MR_sll_entry;
 	depth = event_info->MR_call_depth;
@@ -258,11 +273,47 @@
 		MR_fatal_error("layout has no execution tracing");
 	}
 
-	if (depth > MR_edt_max_depth) {
+	/*
+	** If this event is an interface event then increase or decrease 
+	** the EDT depth appropriately.
+	*/
+	if (event_info->MR_trace_port == MR_PORT_CALL 
+			|| event_info->MR_trace_port == MR_PORT_REDO) {
+		MR_edt_depth++;
+	}
+	if (event_info->MR_trace_port == MR_PORT_EXIT 
+			|| event_info->MR_trace_port == MR_PORT_FAIL
+			|| event_info->MR_trace_port == MR_PORT_EXCEPTION) {
+		/*
+		** The depth of the EXIT, FAIL or EXCP event is actually
+		** MR_edt_depth (not MR_edt_depth-1), however we need to 
+		** adjust the depth here for future events.  This 
+		** inconsistency is neutralised by adjusting the depth
+		** limit check by setting depth_check_adjustment.
+		*/
+		MR_edt_depth--;
+		depth_check_adjustment = 1;
+	}
+
+	if (MR_edt_depth + depth_check_adjustment > MR_edt_max_depth + 1) { 
 		/*
 		** We filter out events which are deeper than a certain
 		** limit given by MR_edt_max_depth.  These events are
 		** implicitly represented in the structure being built.
+		** Adding 1 to the depth limit ensures we get all the 
+		** interface events inside a call at the depth limit.
+		** We need these to build the correct contour.
+		** Note that interface events captured at max-depth + 1
+		** will have their at-depth-limit flag set to no.  This
+		** is not a problem, since the parent's flag will be yes,
+		** so there is no chance that the analyser could ask for the
+		** children of an interface event captured at max-depth + 1,
+		** without the annotated trace being rebuilt from the parent
+		** first.
+		** Adding depth_check_adjustment (which will be 1 for EXIT,
+		** FAIL and EXCP events and 0 otherwise) ensures that EXIT,
+		** FAIL and EXCP events have the same depth as their 
+		** corresponding CALL or REDO events.
 		*/
 		return NULL;
 	}
@@ -406,7 +457,7 @@
 	MR_Word				*base_sp;
 	MR_Word				*base_curfr;
 
-	if (event_info->MR_call_depth == MR_edt_max_depth) {
+	if (MR_edt_depth == MR_edt_max_depth) {
 		at_depth_limit = MR_TRUE;
 	} else {
 		at_depth_limit = MR_FALSE;
@@ -973,7 +1024,6 @@
 				&arg_value);
 		if (problem != NULL) {
 			/* this head variable is not live at this port */
-
 			MR_TRACE_CALL_MERCURY(
 				atom = MR_DD_add_trace_atom_arg_no_value(atom,
 					(MR_Word) hv + 1, hlds_num,
@@ -1149,10 +1199,16 @@
 	MR_trace_decl_mode = trace_mode;
 
 	MR_trace_decl_ensure_init();
-	depth_limit = event_info->MR_call_depth + MR_EDT_DEPTH_STEP_SIZE;
+	depth_limit = event_info->MR_call_depth + MR_edt_depth_step_size;
+	MR_edt_initial_depth = event_info->MR_call_depth;
+	MR_edt_depth = MR_edt_initial_depth;
+	
+	MR_trace_current_node = (MR_Trace_Node) NULL;
+	
 	message = MR_trace_start_collecting(event_info->MR_event_number,
-			event_info->MR_call_seqno, depth_limit, cmd, event_info,
-			event_details, jumpaddr);
+			event_info->MR_call_seqno, depth_limit,
+			MR_edt_initial_depth, cmd, event_info, event_details,
+			jumpaddr);
 
 	if (message == NULL) {
 		return MR_TRUE;
@@ -1167,7 +1223,8 @@
 }
 
 static	MR_Code *
-MR_trace_restart_decl_debug(MR_Unsigned event, MR_Unsigned seqno,
+MR_trace_restart_decl_debug(
+	MR_Trace_Node call_preceding, MR_Unsigned event, MR_Unsigned seqno,
 	MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
 	MR_Event_Details *event_details)
 {
@@ -1175,9 +1232,20 @@
 	const char		*message;
 	MR_Code			*jumpaddr;
 
-	depth_limit = MR_edt_max_depth + MR_EDT_DEPTH_STEP_SIZE;
+	depth_limit = MR_edt_max_depth + MR_edt_depth_step_size;
+	MR_edt_depth_step_size = MR_edt_depth_step_size*2;
+
+	/* 
+	** Set this to the preceding node, so the new subtree's parent is
+	** resolved correcly.
+	*/
+	MR_trace_current_node = call_preceding;
+
+	MR_edt_depth = MR_edt_initial_depth;
+
 	message = MR_trace_start_collecting(event, seqno, depth_limit,
-			cmd, event_info, event_details, &jumpaddr);
+			MR_edt_initial_depth, cmd, event_info, event_details, 
+			&jumpaddr);
 
 	if (message != NULL) {
 		fflush(MR_mdb_out);
@@ -1193,7 +1261,8 @@
 
 static	const char *
 MR_trace_start_collecting(MR_Unsigned event, MR_Unsigned seqno,
-	MR_Unsigned maxdepth, MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
+	MR_Unsigned maxdepth, MR_Unsigned initial_depth, 
+	MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
 	MR_Event_Details *event_details, MR_Code **jumpaddr)
 {
 	const char		*problem;
@@ -1202,7 +1271,8 @@
 	/*
 	** Go back to an event before the topmost call.
 	*/
-	retry_result = MR_trace_retry(event_info, event_details, 0,
+	retry_result = MR_trace_retry(event_info, event_details, 
+		event_info->MR_call_depth - initial_depth,
 		MR_RETRY_IO_ONLY_IF_SAFE,
 		MR_trace_decl_assume_all_io_is_tabled, &problem, NULL, NULL,
 		jumpaddr);
@@ -1213,7 +1283,7 @@
 			return "internal error: direct retry impossible";
 		}
 	}
-
+	
 	/*
 	** Clear any warnings.
 	*/
@@ -1228,7 +1298,6 @@
 	MR_edt_start_seqno = seqno;
 	MR_edt_start_io_counter = MR_io_tabling_counter;
 	MR_edt_max_depth = maxdepth;
-	MR_trace_current_node = (MR_Trace_Node) NULL;
 
 	/*
 	** Restore globals from the saved copies.
@@ -1236,7 +1305,7 @@
         MR_trace_call_seqno = event_details->MR_call_seqno;
 	MR_trace_call_depth = event_details->MR_call_depth;
 	MR_trace_event_number = event_details->MR_event_number;
-
+	
 	/*
 	** Single step through every event.
 	*/
@@ -1268,6 +1337,7 @@
 	MR_Unsigned		symptom_event;
 	MR_Unsigned		final_event;
 	MR_Unsigned		topmost_seqno;
+	MR_Trace_Node		call_preceding;
 	MercuryFile		stream;
 	MR_Integer		use_old_io_map;
 	MR_Unsigned		io_start;
@@ -1342,7 +1412,8 @@
 		no_bug_found = MR_DD_diagnoser_no_bug_found(response);
 		require_subtree = MR_DD_diagnoser_require_subtree(response,
 				(MR_Integer *) &final_event,
-				(MR_Integer *) &topmost_seqno);
+				(MR_Integer *) &topmost_seqno,
+				(MR_Trace_Node *) &call_preceding);
 	);
 
 	MR_trace_call_seqno = event_details->MR_call_seqno;
@@ -1376,7 +1447,8 @@
 		** Restart the declarative debugger with deeper
 		** depth limit.
 		*/
-		return MR_trace_restart_decl_debug(final_event, topmost_seqno,
+		return MR_trace_restart_decl_debug(call_preceding,
+				final_event, topmost_seqno,
 				cmd, event_info, event_details);
 	}
 
--------------------------------------------------------------------------
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