[m-rev.] for review: hiding events introduced by tabling

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Sep 2 15:22:29 AEST 2002


This is the third diff I have posted today that affects debugger test case
expected outputs.

Zoltan.

Estimated hours taken: 2

Hide the events associated with the goals inserted by tabling transformations,
since ordinary programmers shouldn't be exposed to the details of the
transformation. (A later diff will adjust the goal paths of the events
associated with the original code back to what they would have been without
the transformation.)

Add a new mdb command, unhide_events, that allows the programmer to expose
hidden events. This is intended for implementors only.

compiler/hlds_goal.m:
	Add a new goal feature, hide_debug_event. If a nonatomic goal has this
	feature, then the associated trace events will be hidden.

compiler/trace.m:
	Respect the new goal feature.

compiler/table_gen.m:
	Add the new goal feature to the compound goals created by tabling
	transformations.

compiler/code_gen.m:
compiler/dense_switch.m:
compiler/disj_gen.m:
compiler/ite_gen.m:
compiler/string_switch.m:
compiler/switch_gen.m:
compiler/tag_switch.m:
	Pass the required goal_info to trace.m, to allow it to hide events as
	required.

runtime/mercury_trace_base.[ch]:
	Add two global boolean variables. One says whether we are exposing
	hidden events, the other says whether we have ever exposed hidden
	events.

trace/mercury_trace.c:
	Hide hidden events, unless the programmer has asked for them to be
	exposed.

trace/mercury_trace_internal.c:
	Implement the unhide_events command.

	Make "dd" check whether we have ever exposed hidden events.

	Fix some unclear code in "print_optionals".

doc/user_guide.texi:
	Doument the unhide_events command.

doc/mdb_categories:
	Mention the unhide_events command.

tests/debugger/mdb_command_test.inp:
	Test the documentation of the unhide_events command.

cvs diff: Diffing .
cvs diff: Diffing bench
cvs diff: Diffing bench/progs
cvs diff: Diffing bench/progs/compress
cvs diff: Diffing bench/progs/icfp2000
cvs diff: Diffing bench/progs/icfp2001
cvs diff: Diffing bench/progs/nuc
cvs diff: Diffing bench/progs/ray
cvs diff: Diffing bench/progs/tree234
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.104
diff -u -b -r1.104 code_gen.m
--- compiler/code_gen.m	2002/08/05 02:31:32	1.104
+++ compiler/code_gen.m	2002/09/02 03:10:04
@@ -1157,8 +1157,8 @@
 	par_conj_gen__generate_par_conj(Goals, GoalInfo, CodeModel, Code).
 code_gen__generate_goal_2(disj(Goals), GoalInfo, CodeModel, Code) -->
 	disj_gen__generate_disj(CodeModel, Goals, GoalInfo, Code).
-code_gen__generate_goal_2(not(Goal), _GoalInfo, CodeModel, Code) -->
-	ite_gen__generate_negation(CodeModel, Goal, Code).
+code_gen__generate_goal_2(not(Goal), GoalInfo, CodeModel, Code) -->
+	ite_gen__generate_negation(CodeModel, Goal, GoalInfo, Code).
 code_gen__generate_goal_2(if_then_else(_Vars, Cond, Then, Else),
 		GoalInfo, CodeModel, Code) -->
 	ite_gen__generate_ite(CodeModel, Cond, Then, Else, GoalInfo, Code).
Index: compiler/dense_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dense_switch.m,v
retrieving revision 1.42
diff -u -b -r1.42 dense_switch.m
--- compiler/dense_switch.m	2002/03/28 03:42:52	1.42
+++ compiler/dense_switch.m	2002/09/02 00:52:38
@@ -17,7 +17,7 @@
 :- interface.
 
 :- import_module parse_tree__prog_data.
-:- import_module hlds__hlds_data, hlds__hlds_llds.
+:- import_module hlds__hlds_data, hlds__hlds_goal.
 :- import_module ll_backend__llds, ll_backend__code_info.
 :- import_module backend_libs__code_model.
 :- import_module backend_libs__switch_util, check_hlds__type_util.
@@ -36,7 +36,7 @@
 	% Generate code for a switch using a dense jump table.
 
 :- pred dense_switch__generate(cases_list, int, int, prog_var, code_model,
-	can_fail, store_map, label, branch_end, branch_end, code_tree,
+	can_fail, hlds_goal_info, label, branch_end, branch_end, code_tree,
 	code_info, code_info).
 :- mode dense_switch__generate(in, in, in, in, in, in, in, in,
 	in, out, out, in, out) is det.
@@ -53,7 +53,7 @@
 
 :- implementation.
 
-:- import_module hlds__hlds_goal, hlds__hlds_module.
+:- import_module hlds__hlds_goal, hlds__hlds_module, hlds__hlds_llds.
 :- import_module ll_backend__code_gen, ll_backend__trace.
 :- import_module backend_libs__builtin_ops.
 
@@ -126,7 +126,7 @@
 %---------------------------------------------------------------------------%
 
 dense_switch__generate(Cases, StartVal, EndVal, Var, CodeModel, CanFail,
-		StoreMap, EndLabel, MaybeEnd0, MaybeEnd, Code) -->
+		SwitchGoalInfo, EndLabel, MaybeEnd0, MaybeEnd, Code) -->
 		% Evaluate the variable which we are going to be switching on
 	code_info__produce_variable(Var, VarCode, Rval),
 		% If the case values start at some number other than 0,
@@ -151,8 +151,9 @@
 	),
 		% Now generate the jump table and the cases
 	dense_switch__generate_cases(Cases, StartVal, EndVal, CodeModel,
-			StoreMap, EndLabel, MaybeEnd0, MaybeEnd,
-			Labels, CasesCode),
+		SwitchGoalInfo, EndLabel, MaybeEnd0, MaybeEnd, Labels,
+		CasesCode),
+
 		% XXX
 		% We keep track of the code_info at the end of one of
 		% the non-fail cases.  We have to do this because 
@@ -167,13 +168,14 @@
 	{ Code = tree(VarCode, tree(RangeCheck, tree(DoJump, CasesCode))) }.
 
 :- pred dense_switch__generate_cases(cases_list, int, int,
-	code_model, store_map, label, branch_end, branch_end,
+	code_model, hlds_goal_info, label, branch_end, branch_end,
 	list(label), code_tree, code_info, code_info).
 :- mode dense_switch__generate_cases(in, in, in, in, in, in, in, out,
 	out, out, in, out) is det.
 
-dense_switch__generate_cases(Cases0, NextVal, EndVal, CodeModel, StoreMap,
-		EndLabel, MaybeEnd0, MaybeEnd, Labels, Code) -->
+dense_switch__generate_cases(Cases0, NextVal, EndVal, CodeModel,
+		SwitchGoalInfo, EndLabel, MaybeEnd0, MaybeEnd, Labels, Code)
+		-->
 	(
 		{ NextVal > EndVal }
 	->
@@ -186,7 +188,7 @@
 	;
 		code_info__get_next_label(ThisLabel),
 		dense_switch__generate_case(Cases0, NextVal, CodeModel,
-			StoreMap, Cases1, MaybeEnd0, MaybeEnd1,
+			SwitchGoalInfo, Cases1, MaybeEnd0, MaybeEnd1,
 			ThisCode, Comment),
 		{ LabelCode = node([
 			label(ThisLabel)
@@ -199,8 +201,8 @@
 			% generate the rest of the cases.
 		{ NextVal1 is NextVal + 1 },
 		dense_switch__generate_cases(Cases1, NextVal1, EndVal,
-			CodeModel, StoreMap, EndLabel, MaybeEnd1, MaybeEnd,
-			Labels1, OtherCasesCode),
+			CodeModel, SwitchGoalInfo, EndLabel,
+			MaybeEnd1, MaybeEnd, Labels1, OtherCasesCode),
 		{ Labels = [ThisLabel | Labels1] },
 		{ Code =
 			tree(LabelCode,
@@ -212,13 +214,13 @@
 
 %---------------------------------------------------------------------------%
 
-:- pred dense_switch__generate_case(cases_list, int, code_model, store_map,
-		cases_list, branch_end, branch_end, code_tree, string,
+:- pred dense_switch__generate_case(cases_list, int, code_model,
+	hlds_goal_info, cases_list, branch_end, branch_end, code_tree, string,
 		code_info, code_info).
 :- mode dense_switch__generate_case(in, in, in, in, out, in, out, out, out,
 		in, out) is det.
 
-dense_switch__generate_case(Cases0, NextVal, CodeModel, StoreMap, Cases,
+dense_switch__generate_case(Cases0, NextVal, CodeModel, SwitchGoalInfo, Cases,
 		MaybeEnd0, MaybeEnd, Code, Comment) -->
 	(
 		{ Cases0 = [Case | Cases1] },
@@ -228,8 +230,10 @@
 		% We need to save the expression cache, etc.,
 		% and restore them when we've finished.
 		code_info__remember_position(BranchStart),
-		trace__maybe_generate_internal_event_code(Goal, TraceCode),
+		trace__maybe_generate_internal_event_code(Goal, SwitchGoalInfo,
+			TraceCode),
 		code_gen__generate_goal(CodeModel, Goal, GoalCode),
+		{ goal_info_get_store_map(SwitchGoalInfo, StoreMap) },
 		code_info__generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd,
 			SaveCode),
 		{ Code =
Index: compiler/disj_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/disj_gen.m,v
retrieving revision 1.75
diff -u -b -r1.75 disj_gen.m
--- compiler/disj_gen.m	2002/03/28 03:42:54	1.75
+++ compiler/disj_gen.m	2002/09/02 00:48:23
@@ -232,7 +232,8 @@
 		code_info__effect_resume_point(NextResumePoint, CodeModel,
 			ModContCode),
 
-		trace__maybe_generate_internal_event_code(Goal, TraceCode),
+		trace__maybe_generate_internal_event_code(Goal, DisjGoalInfo,
+			TraceCode),
 		{ goal_info_get_code_model(GoalInfo, GoalCodeModel) },
 		code_gen__generate_goal(GoalCodeModel, Goal, GoalCode),
 
@@ -310,7 +311,8 @@
 
 		code_info__undo_disj_hijack(HijackInfo, UndoCode),
 
-		trace__maybe_generate_internal_event_code(Goal0, TraceCode),
+		trace__maybe_generate_internal_event_code(Goal0, DisjGoalInfo,
+			TraceCode),
 		code_gen__generate_goal(CodeModel, Goal0, GoalCode),
 		{ goal_info_get_store_map(DisjGoalInfo, StoreMap) },
 		code_info__generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd,
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.98
diff -u -b -r1.98 hlds_goal.m
--- compiler/hlds_goal.m	2002/08/14 06:41:28	1.98
+++ compiler/hlds_goal.m	2002/09/01 10:43:22
@@ -730,6 +730,11 @@
 				% feature, even if their determinism puts an
 				% at_most_zero upper bound on the number of
 				% solutions they have.
+	;	hide_debug_event
+				% The events associated with this goal should
+				% be hidden. This is used e.g. by the tabling
+				% transformation to preserve the set of events
+				% generated by a tabled procedure.
 	;	tailcall.	% This goal represents a tail call. This marker
 				% is used by deep profiling.
 
Index: compiler/ite_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ite_gen.m,v
retrieving revision 1.67
diff -u -b -r1.67 ite_gen.m
--- compiler/ite_gen.m	2002/03/28 03:43:07	1.67
+++ compiler/ite_gen.m	2002/09/02 03:16:05
@@ -26,7 +26,8 @@
 	code_info::in, code_info::out) is det.
 
 :- pred ite_gen__generate_negation(code_model::in, hlds_goal::in,
-	code_tree::out, code_info::in, code_info::out) is det.
+	hlds_goal_info::in, code_tree::out, code_info::in, code_info::out)
+	is det.
 
 %---------------------------------------------------------------------------%
 
@@ -107,7 +108,8 @@
 		EffectResumeCode),
 
 		% Generate the condition
-	trace__maybe_generate_internal_event_code(CondGoal, CondTraceCode),
+	trace__maybe_generate_internal_event_code(CondGoal, IteGoalInfo,
+		CondTraceCode),
 	code_gen__generate_goal(CondCodeModel, CondGoal, CondCode),
 
 	code_info__ite_enter_then(HijackInfo, ThenNeckCode, ElseNeckCode),
@@ -144,7 +146,7 @@
 	;	
 			% Generate the then branch
 		trace__maybe_generate_internal_event_code(ThenGoal,
-			ThenTraceCode),
+			IteGoalInfo, ThenTraceCode),
 		code_gen__generate_goal(CodeModel, ThenGoal, ThenCode),
 		code_info__generate_branch_end(StoreMap, no,
 			MaybeEnd0, ThenSaveCode)
@@ -160,7 +162,8 @@
 		MaybeTicketSlot, undo, RestoreTicketCode),
 
 		% Generate the else branch
-	trace__maybe_generate_internal_event_code(ElseGoal, ElseTraceCode),
+	trace__maybe_generate_internal_event_code(ElseGoal, IteGoalInfo,
+		ElseTraceCode),
 	code_gen__generate_goal(CodeModel, ElseGoal, ElseCode),
 	code_info__generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd,
 		ElseSaveCode),
@@ -201,7 +204,7 @@
 
 %---------------------------------------------------------------------------%
 
-ite_gen__generate_negation(CodeModel, Goal0, Code) -->
+ite_gen__generate_negation(CodeModel, Goal0, NotGoalInfo, Code) -->
 	{ CodeModel = model_non ->
 		error("nondet negation")
 	;
@@ -255,7 +258,7 @@
 		code_info__leave_simple_neg(GoalInfo, SimpleNeg),
 		{ Code = tree(tree(CodeL, CodeR), TestCode) }
 	;
-		generate_negation_general(CodeModel, Goal,
+		generate_negation_general(CodeModel, Goal, NotGoalInfo,
 			ResumeVars, ResumeLocs, Code)
 	).
 
@@ -263,10 +266,11 @@
 	% of the code for if-then-elses.
 
 :- pred generate_negation_general(code_model::in, hlds_goal::in,
-	set(prog_var)::in, resume_locs::in, code_tree::out,
+	hlds_goal_info::in, set(prog_var)::in, resume_locs::in, code_tree::out,
 	code_info::in, code_info::out) is det.
 
-generate_negation_general(CodeModel, Goal, ResumeVars, ResumeLocs, Code) -->
+generate_negation_general(CodeModel, Goal, NotGoalInfo, ResumeVars, ResumeLocs,
+		Code) -->
 
 	code_info__produce_vars(ResumeVars, ResumeMap, FlushCode),
 
@@ -300,7 +304,8 @@
 		% Generate the negated goal as a semi-deterministic goal;
 		% it cannot be nondet, since mode correctness requires it
 		% to have no output vars.
-	trace__maybe_generate_internal_event_code(Goal, EnterTraceCode),
+	trace__maybe_generate_internal_event_code(Goal, NotGoalInfo,
+		EnterTraceCode),
 	code_gen__generate_goal(model_semi, Goal, GoalCode),
 
 	code_info__ite_enter_then(HijackInfo, ThenNeckCode, ElseNeckCode),
@@ -323,8 +328,8 @@
 		code_info__maybe_release_hp(MaybeHpSlot),
 		code_info__maybe_reset_prune_and_release_ticket(
 			MaybeTicketSlot, commit, PruneTicketCode),
-		trace__maybe_generate_negated_event_code(Goal, neg_failure,
-			FailTraceCode),
+		trace__maybe_generate_negated_event_code(Goal, NotGoalInfo,
+			neg_failure, FailTraceCode),
 		code_info__generate_failure(FailCode),
 			% We want liveness after not(G) to be the same as
 			% after G. Information about what variables are where
@@ -341,8 +346,8 @@
 	code_info__maybe_restore_and_release_hp(MaybeHpSlot, RestoreHpCode),
 	code_info__maybe_reset_discard_and_release_ticket(
 		MaybeTicketSlot, undo, RestoreTicketCode),
-	trace__maybe_generate_negated_event_code(Goal, neg_success,
-		SuccessTraceCode),
+	trace__maybe_generate_negated_event_code(Goal, NotGoalInfo,
+		neg_success, SuccessTraceCode),
 
 	{ Code =
 		tree(FlushCode,
Index: compiler/string_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/string_switch.m,v
retrieving revision 1.39
diff -u -b -r1.39 string_switch.m
--- compiler/string_switch.m	2002/03/28 03:43:38	1.39
+++ compiler/string_switch.m	2002/09/02 00:55:33
@@ -18,12 +18,12 @@
 :- interface.
 
 :- import_module parse_tree__prog_data.
-:- import_module hlds__hlds_data, hlds__hlds_llds.
+:- import_module hlds__hlds_data, hlds__hlds_goal.
 :- import_module ll_backend__llds, ll_backend__code_info.
 :- import_module backend_libs__switch_util, backend_libs__code_model.
 
 :- pred string_switch__generate(cases_list, prog_var, code_model,
-	can_fail, store_map, label, branch_end, branch_end, code_tree,
+	can_fail, hlds_goal_info, label, branch_end, branch_end, code_tree,
 	code_info, code_info).
 :- mode string_switch__generate(in, in, in, in, in, in, in, out, out, in, out)
 	is det.
@@ -33,13 +33,14 @@
 :- implementation.
 
 :- import_module hlds__hlds_goal.
+:- import_module hlds__hlds_llds.
 :- import_module ll_backend__code_gen, ll_backend__trace.
 :- import_module backend_libs__builtin_ops.
 :- import_module libs__tree.
 
 :- import_module bool, int, string, list, map, std_util, assoc_list, require.
 
-string_switch__generate(Cases, Var, CodeModel, _CanFail, StoreMap,
+string_switch__generate(Cases, Var, CodeModel, _CanFail, SwitchGoalInfo,
 		EndLabel, MaybeEnd0, MaybeEnd, Code) -->
 	code_info__produce_variable(Var, VarCode, VarRval),
 	code_info__acquire_reg(r, SlotReg),
@@ -87,7 +88,7 @@
 		% Generate the code etc. for the hash table
 		%
 	string_switch__gen_hash_slots(0, TableSize, HashSlotsMap, CodeModel,
-		StoreMap, FailLabel, EndLabel, MaybeEnd0, MaybeEnd,
+		SwitchGoalInfo, FailLabel, EndLabel, MaybeEnd0, MaybeEnd,
 		Strings, Labels, NextSlots, SlotsCode),
 
 		% Generate code which does the hash table lookup
@@ -142,14 +143,14 @@
 	}.
 
 :- pred string_switch__gen_hash_slots(int, int, map(int, hash_slot),
-	code_model, store_map, label, label, branch_end, branch_end,
+	code_model, hlds_goal_info, label, label, branch_end, branch_end,
 	list(maybe(rval)), list(label), list(maybe(rval)), code_tree,
 	code_info, code_info).
 :- mode string_switch__gen_hash_slots(in, in, in, in, in, in, in,
 	in, out, out, out, out, out, in, out) is det.
 
 string_switch__gen_hash_slots(Slot, TableSize, HashSlotMap, CodeModel,
-		StoreMap, FailLabel, EndLabel, MaybeEnd0, MaybeEnd,
+		SwitchGoalInfo, FailLabel, EndLabel, MaybeEnd0, MaybeEnd,
 		Strings, Labels, NextSlots, Code) -->
 	( { Slot = TableSize } ->
 		{
@@ -163,7 +164,7 @@
 		}
 	;
 		string_switch__gen_hash_slot(Slot, TableSize, HashSlotMap,
-			CodeModel, StoreMap, FailLabel, EndLabel,
+			CodeModel, SwitchGoalInfo, FailLabel, EndLabel,
 			MaybeEnd0, MaybeEnd1,
 			String, Label, NextSlot, SlotCode),
 		{ Slot1 is Slot + 1 },
@@ -174,24 +175,22 @@
 			Code = tree(SlotCode, Code0)
 		},
 		string_switch__gen_hash_slots(Slot1, TableSize, HashSlotMap,
-			CodeModel, StoreMap, FailLabel, EndLabel,
+			CodeModel, SwitchGoalInfo, FailLabel, EndLabel,
 			MaybeEnd1, MaybeEnd,
 			Strings0, Labels0, NextSlots0, Code0)
 	).
 
 :- pred string_switch__gen_hash_slot(int, int, map(int, hash_slot),
-	code_model, store_map, label, label, branch_end, branch_end,
+	code_model, hlds_goal_info, label, label, branch_end, branch_end,
 	maybe(rval), label, maybe(rval), code_tree,
 	code_info, code_info).
 :- mode string_switch__gen_hash_slot(in, in, in, in, in, in, in,
 	in, out, out, out, out, out, in, out) is det.
 
-string_switch__gen_hash_slot(Slot, TblSize, HashSlotMap, CodeModel, StoreMap,
-		FailLabel, EndLabel, MaybeEnd0, MaybeEnd,
+string_switch__gen_hash_slot(Slot, TblSize, HashSlotMap, CodeModel,
+		SwitchGoalInfo, FailLabel, EndLabel, MaybeEnd0, MaybeEnd,
 		yes(StringRval), Label, yes(NextSlotRval), Code) -->
-	(
-		{ map__search(HashSlotMap, Slot, hash_slot(Case, Next)) }
-	->
+	( { map__search(HashSlotMap, Slot, hash_slot(Case, Next)) } ->
 		{ NextSlotRval = const(int_const(Next)) },
 		{ Case = case(_, ConsTag, _, Goal) },
 		{ ConsTag = string_constant(String0) ->
@@ -206,8 +205,10 @@
 			label(Label) - Comment
 		]) },
 		code_info__remember_position(BranchStart),
-		trace__maybe_generate_internal_event_code(Goal, TraceCode),
+		trace__maybe_generate_internal_event_code(Goal, SwitchGoalInfo,
+			TraceCode),
 		code_gen__generate_goal(CodeModel, Goal, GoalCode),
+		{ goal_info_get_store_map(SwitchGoalInfo, StoreMap) },
 		code_info__generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd,
 			SaveCode),
 		(
Index: compiler/switch_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/switch_gen.m,v
retrieving revision 1.78
diff -u -b -r1.78 switch_gen.m
--- compiler/switch_gen.m	2002/03/28 03:43:39	1.78
+++ compiler/switch_gen.m	2002/09/02 00:53:31
@@ -98,9 +98,8 @@
 		}
 	->
 		% XXX This may be be inefficient in some cases.
-		switch_gen__generate_all_cases(TaggedCases, CaseVar,
-			CodeModel, CanFail, StoreMap, EndLabel, no, MaybeEnd,
-			Code)
+		switch_gen__generate_all_cases(TaggedCases, CaseVar, CodeModel,
+			CanFail, GoalInfo, EndLabel, no, MaybeEnd, Code)
 	;
 		{ Indexing = yes },
 		{ SwitchCategory = atomic_switch },
@@ -135,7 +134,7 @@
 	->
 		dense_switch__generate(TaggedCases,
 			FirstVal, LastVal, CaseVar, CodeModel, CanFail1,
-			StoreMap, EndLabel, no, MaybeEnd, Code)
+			GoalInfo, EndLabel, no, MaybeEnd, Code)
 	;
 		{ Indexing = yes },
 		{ SwitchCategory = string_switch },
@@ -145,7 +144,7 @@
 		{ NumCases >= StringSize }
 	->
 		string_switch__generate(TaggedCases, CaseVar, CodeModel,
-			CanFail, StoreMap, EndLabel, no, MaybeEnd, Code)
+			CanFail, GoalInfo, EndLabel, no, MaybeEnd, Code)
 	;
 		{ Indexing = yes },
 		{ SwitchCategory = tag_switch },
@@ -155,14 +154,14 @@
 		{ NumCases >= TagSize }
 	->
 		tag_switch__generate(TaggedCases, CaseVar, CodeModel, CanFail,
-			StoreMap, EndLabel, no, MaybeEnd, Code)
+			GoalInfo, EndLabel, no, MaybeEnd, Code)
 	;
 		% To generate a switch, first we flush the
 		% variable on whose tag we are going to switch, then we
 		% generate the cases for the switch.
 
 		switch_gen__generate_all_cases(TaggedCases, CaseVar,
-			CodeModel, CanFail, StoreMap, EndLabel, no, MaybeEnd,
+			CodeModel, CanFail, GoalInfo, EndLabel, no, MaybeEnd,
 			Code)
 	),
 	code_info__after_all_branches(StoreMap, MaybeEnd).
@@ -227,12 +226,12 @@
 	% breaks caused by taken branches.
 
 :- pred switch_gen__generate_all_cases(list(extended_case), prog_var,
-	code_model, can_fail, store_map, label, branch_end, branch_end,
+	code_model, can_fail, hlds_goal_info, label, branch_end, branch_end,
 	code_tree, code_info, code_info).
 :- mode switch_gen__generate_all_cases(in, in, in, in, in, in, in, out, out,
 	in, out) is det.
 
-switch_gen__generate_all_cases(Cases0, Var, CodeModel, CanFail, StoreMap,
+switch_gen__generate_all_cases(Cases0, Var, CodeModel, CanFail, GoalInfo,
 		EndLabel, MaybeEnd0, MaybeEnd, Code) -->
 	code_info__produce_variable(Var, VarCode, _Rval),
 	(
@@ -265,11 +264,11 @@
 		{ Cases = Cases0 }
 	),
 	switch_gen__generate_cases(Cases, Var, CodeModel, CanFail,
-		StoreMap, EndLabel, MaybeEnd0, MaybeEnd, CasesCode),
+		GoalInfo, EndLabel, MaybeEnd0, MaybeEnd, CasesCode),
 	{ Code = tree(VarCode, CasesCode) }.
 
 :- pred switch_gen__generate_cases(list(extended_case), prog_var, code_model,
-	can_fail, store_map, label, branch_end, branch_end, code_tree,
+	can_fail, hlds_goal_info, label, branch_end, branch_end, code_tree,
 	code_info, code_info).
 :- mode switch_gen__generate_cases(in, in, in, in, in, in, in, out, out,
 	in, out) is det.
@@ -278,7 +277,7 @@
 	% came across a tag which was not covered by one of the cases.
 	% It is followed by the end of switch label to which the cases
 	% branch.
-switch_gen__generate_cases([], _Var, _CodeModel, CanFail, _StoreMap,
+switch_gen__generate_cases([], _Var, _CodeModel, CanFail, _GoalInfo,
 		EndLabel, MaybeEnd, MaybeEnd, Code) -->
 	( { CanFail = can_fail } ->
 		code_info__generate_failure(FailCode)
@@ -292,14 +291,17 @@
 	{ Code = tree(FailCode, EndCode) }.
 
 switch_gen__generate_cases([case(_, _, Cons, Goal) | Cases], Var, CodeModel,
-		CanFail, StoreMap, EndLabel, MaybeEnd0, MaybeEnd, CasesCode) -->
+		CanFail, SwitchGoalInfo, EndLabel, MaybeEnd0, MaybeEnd,
+		CasesCode) -->
 	code_info__remember_position(BranchStart),
+	{ goal_info_get_store_map(SwitchGoalInfo, StoreMap) },
 	(
 		{ Cases = [_|_] ; CanFail = can_fail }
 	->
 		unify_gen__generate_tag_test(Var, Cons, branch_on_failure,
 			NextLabel, TestCode),
-		trace__maybe_generate_internal_event_code(Goal, TraceCode),
+		trace__maybe_generate_internal_event_code(Goal, SwitchGoalInfo,
+			TraceCode),
 		code_gen__generate_goal(CodeModel, Goal, GoalCode),
 		code_info__generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd1,
 			SaveCode),
@@ -317,7 +319,8 @@
 			     ElseCode))))
 		}
 	;
-		trace__maybe_generate_internal_event_code(Goal, TraceCode),
+		trace__maybe_generate_internal_event_code(Goal, SwitchGoalInfo,
+			TraceCode),
 		code_gen__generate_goal(CodeModel, Goal, GoalCode),
 		code_info__generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd1,
 			SaveCode),
@@ -329,8 +332,9 @@
 	),
 	code_info__reset_to_position(BranchStart),
 		% generate the rest of the cases.
-	switch_gen__generate_cases(Cases, Var, CodeModel, CanFail, StoreMap,
-		EndLabel, MaybeEnd1, MaybeEnd, OtherCasesCode),
+	switch_gen__generate_cases(Cases, Var, CodeModel, CanFail,
+		SwitchGoalInfo, EndLabel, MaybeEnd1, MaybeEnd,
+		OtherCasesCode),
 	{ CasesCode = tree(ThisCaseCode, OtherCasesCode) }.
 
 %------------------------------------------------------------------------------%
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.37
diff -u -b -r1.37 table_gen.m
--- compiler/table_gen.m	2002/07/26 04:18:29	1.37
+++ compiler/table_gen.m	2002/09/01 16:52:15
@@ -667,7 +667,9 @@
 		instmap_delta_restrict(RestoreAnsInstMapDelta0,
 			RestoreAnsNonLocals, RestoreAnsInstMapDelta),
 		goal_info_init(RestoreAnsNonLocals, RestoreAnsInstMapDelta,
-			det, Context, RestoreAnsGoalInfo),
+			det, Context, RestoreAnsGoalInfo0),
+		goal_info_add_feature(RestoreAnsGoalInfo0, hide_debug_event,
+			RestoreAnsGoalInfo),
 		RestoreAnsGoal = RestoreAnsGoalEx - RestoreAnsGoalInfo
 	),
 	generate_save_goal(NumberedSaveVars, TableVar, BlockSize,
@@ -701,7 +703,9 @@
 	instmap_delta_restrict(CallSaveAnsInstMapDelta0,
 		CallSaveAnsNonLocals, CallSaveAnsInstMapDelta),
 	goal_info_init(CallSaveAnsNonLocals, CallSaveAnsInstMapDelta, det,
-		Context, CallSaveAnsGoalInfo),
+		Context, CallSaveAnsGoalInfo0),
+	goal_info_add_feature(CallSaveAnsGoalInfo0, hide_debug_event,
+		CallSaveAnsGoalInfo),
 	CallSaveAnsGoal = CallSaveAnsGoalEx - CallSaveAnsGoalInfo,
 
 	GenIfNecGoalEx = if_then_else([], OccurredGoal,
@@ -712,6 +716,8 @@
 	instmap_delta_restrict(GenIfNecInstMapDelta0, GenIfNecNonLocals,
 		GenIfNecInstMapDelta),
 	goal_info_init(GenIfNecNonLocals, GenIfNecInstMapDelta, det, Context,
+		GenIfNecGoalInfo0),
+	goal_info_add_feature(GenIfNecGoalInfo0, hide_debug_event,
 		GenIfNecGoalInfo),
 	GenIfNecGoal = GenIfNecGoalEx - GenIfNecGoalInfo,
 
@@ -723,7 +729,9 @@
 	instmap_delta_restrict(CheckAndGenAnsInstMapDelta0,
 		CheckAndGenAnsNonLocals, CheckAndGenAnsInstMapDelta),
 	goal_info_init(CheckAndGenAnsNonLocals, CheckAndGenAnsInstMapDelta,
-		det, Context, CheckAndGenAnsGoalInfo),
+		det, Context, CheckAndGenAnsGoalInfo0),
+	goal_info_add_feature(CheckAndGenAnsGoalInfo0, hide_debug_event,
+		CheckAndGenAnsGoalInfo),
 	CheckAndGenAnsGoal = CheckAndGenAnsGoalEx - CheckAndGenAnsGoalInfo,
 
 	BodyGoalEx = if_then_else([], InRangeGoal, CheckAndGenAnsGoal,
@@ -733,7 +741,8 @@
 	instmap_delta_restrict(BodyInstMapDelta0, OrigNonLocals,
 		BodyInstMapDelta),
 	goal_info_init(OrigNonLocals, BodyInstMapDelta, det, Context,
-		BodyGoalInfo),
+		BodyGoalInfo0),
+	goal_info_add_feature(BodyGoalInfo0, hide_debug_event, BodyGoalInfo),
 	Goal = BodyGoalEx - BodyGoalInfo.
 
 		%
@@ -812,6 +821,8 @@
 	instmap_delta_restrict(NoLoopGenInstMapDelta0, GenAnsNonLocals,
 		NoLoopGenInstMapDelta),
 	goal_info_init(GenAnsNonLocals, NoLoopGenInstMapDelta, det, Context,
+		NoLoopGenGoalInfo0),
+	goal_info_add_feature(NoLoopGenGoalInfo0, hide_debug_event,
 		NoLoopGenGoalInfo),
 	NoLoopGenAnsGoal = NoLoopGenAnsGoalEx - NoLoopGenGoalInfo,
 
@@ -822,8 +833,9 @@
 	instmap_delta_restrict(GenAnsInstMapDelta0, GenAnsNonLocals,
 		GenAnsInstMapDelta),
 	goal_info_init(GenAnsNonLocals, GenAnsInstMapDelta, det, Context,
+		GenAnsGoalInfo0),
+	goal_info_add_feature(GenAnsGoalInfo0, hide_debug_event,
 		GenAnsGoalInfo),
-
 	GenAnsGoal = GenAnsGoalEx - GenAnsGoalInfo,
 
 	ITEGoalEx = if_then_else([], CompleteCheckGoal, RestoreAnsGoal,
@@ -833,13 +845,14 @@
 	instmap_delta_restrict(ITEInstMapDelta0, GenAnsNonLocals,
 		ITEInstMapDelta),
 	goal_info_init(GenAnsNonLocals, ITEInstMapDelta, det, Context,
-		ITEGoalInfo),
+		ITEGoalInfo0),
+	goal_info_add_feature(ITEGoalInfo0, hide_debug_event, ITEGoalInfo),
 	ITEGoal = ITEGoalEx - ITEGoalInfo,
 
 	GoalEx = conj([LookUpGoal, ITEGoal]),
 	goal_info_init(OrigNonLocals, OrigInstMapDelta, det, Context,
-		GoalInfo),
-
+		GoalInfo0),
+	goal_info_add_feature(GoalInfo0, hide_debug_event, GoalInfo),
 	Goal = GoalEx - GoalInfo.
 
 %-----------------------------------------------------------------------------%
@@ -901,9 +914,7 @@
 			EvalMethod = eval_memo
 		)
 	->
-		(
-			EvalMethod = eval_loop_check
-		->
+		( EvalMethod = eval_loop_check ->
 			SaveAnsGoal = MarkAsInactiveGoal
 		;
 			SaveAnsGoal = SaveAnsGoal0
@@ -921,7 +932,9 @@
 		instmap_delta_restrict(NoLoopGenInstMapDelta0, GenAnsNonLocals,
 			NoLoopGenInstMapDelta),
 		goal_info_init(GenAnsNonLocals, NoLoopGenInstMapDelta, semidet,
-			Context, NoLoopGenGoalInfo),
+			Context, NoLoopGenGoalInfo0),
+		goal_info_add_feature(NoLoopGenGoalInfo0, hide_debug_event,
+			NoLoopGenGoalInfo),
 		NoLoopGenAnsGoal = NoLoopGenAnsGoalEx - NoLoopGenGoalInfo,
 
 		GenTrueAnsGoalEx = if_then_else([], ActiveCheckGoal,
@@ -931,8 +944,9 @@
 		instmap_delta_restrict(GenTrueAnsInstMapDelta0,
 			GenAnsNonLocals, GenTrueAnsInstMapDelta),
 		goal_info_init(GenAnsNonLocals, GenTrueAnsInstMapDelta,
-			semidet, Context, GenTrueAnsGoalInfo),
-
+			semidet, Context, GenTrueAnsGoalInfo0),
+		goal_info_add_feature(GenTrueAnsGoalInfo0, hide_debug_event,
+			GenTrueAnsGoalInfo),
 		GenTrueAnsGoal = GenTrueAnsGoalEx - GenTrueAnsGoalInfo
 	;
 		EvalMethod = eval_minimal
@@ -955,8 +969,9 @@
 		instmap_delta_restrict(GenTrueAnsInstMapDelta0,
 			GenAnsNonLocals, GenTrueAnsInstMapDelta),
 		goal_info_init(GenAnsNonLocals, GenTrueAnsInstMapDelta,
-			semidet, Context, GenTrueAnsGoalInfo),
-
+			semidet, Context, GenTrueAnsGoalInfo0),
+		goal_info_add_feature(GenTrueAnsGoalInfo0, hide_debug_event,
+			GenTrueAnsGoalInfo),
 		GenTrueAnsGoal = GenTrueAnsGoalEx - GenTrueAnsGoalInfo
 	;
 		error(
@@ -986,7 +1001,9 @@
 		instmap_delta_restrict(RestInstMapDelta0, RestNonLocals,
 			RestInstMapDelta),
 		goal_info_init(RestNonLocals, RestInstMapDelta, semidet,
-			Context, RestAnsGoalInfo),
+			Context, RestAnsGoalInfo0),
+		goal_info_add_feature(RestAnsGoalInfo0, hide_debug_event,
+			RestAnsGoalInfo),
 		RestoreAnsGoal = RestAnsGoalEx - RestAnsGoalInfo
 	),
 
@@ -997,7 +1014,9 @@
 	instmap_delta_restrict(GenAnsGoalInstMapDelta0, GenAnsNonLocals,
 		GenAnsGoalInstMapDelta),
 	goal_info_init(GenAnsNonLocals, GenAnsGoalInstMapDelta, semidet,
-		Context, GenAnsGoalInfo),
+		Context, GenAnsGoalInfo0),
+	goal_info_add_feature(GenAnsGoalInfo0, hide_debug_event,
+		GenAnsGoalInfo),
 	GenAnsGoal = GenAnsGoalEx - GenAnsGoalInfo,
 
 	ITEGoalEx = if_then_else([], CompleteCheckGoal, RestoreAnsGoal,
@@ -1007,13 +1026,14 @@
 	instmap_delta_restrict(ITEInstMapDelta0, GenAnsNonLocals,
 		ITEInstMapDelta),
 	goal_info_init(GenAnsNonLocals, ITEInstMapDelta, semidet,
-		Context, ITEGoalInfo),
+		Context, ITEGoalInfo0),
+	goal_info_add_feature(ITEGoalInfo0, hide_debug_event, ITEGoalInfo),
 	ITEGoal = ITEGoalEx - ITEGoalInfo,
 
 	GoalEx = conj([LookUpGoal, ITEGoal]),
 	goal_info_init(OrigNonLocals, OrigInstMapDelta, semidet, Context,
-		GoalInfo),
-
+		GoalInfo0),
+	goal_info_add_feature(GoalInfo0, hide_debug_event, GoalInfo),
 	Goal = GoalEx - GoalInfo.
 
 %-----------------------------------------------------------------------------%
@@ -1072,19 +1092,13 @@
 	true_goal(TrueGoal),
 	fail_goal(FailGoal),
 
-	(
-		EvalMethod = eval_memo
-	->
+	( EvalMethod = eval_memo ->
 		SaveAnsGoal = SaveAnsGoal0,
 		ActiveGoal = LoopErrorGoal
-	;
-		EvalMethod = eval_loop_check
-	->
+	; EvalMethod = eval_loop_check ->
 		SaveAnsGoal = TrueGoal,
 		ActiveGoal = LoopErrorGoal
-	;
-		EvalMethod = eval_minimal
-	->
+	; EvalMethod = eval_minimal ->
 		SaveAnsGoal = SaveAnsGoal0,
 		ActiveGoal = SuspendGoal
 	;
@@ -1099,12 +1113,12 @@
 	instmap_delta_restrict(GenAnsGoalPart1IMD0, GenAnsGoalPart1NonLocals,
 		GenAnsGoalPart1IMD),
 	goal_info_init(GenAnsGoalPart1NonLocals, GenAnsGoalPart1IMD, nondet,
-		Context, GenAnsGoalPart1GoalInfo),
+		Context, GenAnsGoalPart1GoalInfo0),
+	goal_info_add_feature(GenAnsGoalPart1GoalInfo0, hide_debug_event,
+		GenAnsGoalPart1GoalInfo),
 	GenAnsGoalPart1 = GenAnsGoalPart1Ex - GenAnsGoalPart1GoalInfo,
 
-	(
-		EvalMethod = eval_minimal
-	->
+	( EvalMethod = eval_minimal ->
 		ResumeGoal = ResumeGoal1
 	;
 		ResumeGoal = FailGoal
@@ -1114,22 +1128,24 @@
 
 	ITE1GoalEx = if_then_else([], IsActiveCheckGoal, ActiveGoal,
 		GenAnsGoal),
-	ITE1Goal = ITE1GoalEx - GenAnsGoalPart1GoalInfo,
+	goal_info_add_feature(GenAnsGoalPart1GoalInfo, hide_debug_event,
+		ITE1GoalInfo),
+	ITE1Goal = ITE1GoalEx - ITE1GoalInfo,
 
-	(
-		EvalMethod = eval_loop_check
-	->
+	( EvalMethod = eval_loop_check ->
 		ITE2Goal = ITE1Goal
 	;
 		ITE2GoalEx = if_then_else([], CompleteCheckGoal,
 			RestoreAllAnsGoal, ITE1Goal),
-		ITE2Goal = ITE2GoalEx - GenAnsGoalPart1GoalInfo
+		goal_info_add_feature(GenAnsGoalPart1GoalInfo,
+			hide_debug_event, ITE2GoalInfo),
+		ITE2Goal = ITE2GoalEx - ITE2GoalInfo
 	),
 
 	GoalEx = conj([LookUpGoal, ITE2Goal]),
 	goal_info_init(OrigNonLocals, OrigInstMapDelta, nondet, Context,
-		GoalInfo),
-
+		GoalInfo0),
+	goal_info_add_feature(GoalInfo0, hide_debug_event, GoalInfo),
 	Goal = GoalEx - GoalInfo.
 
 %-----------------------------------------------------------------------------%
Index: compiler/tag_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/tag_switch.m,v
retrieving revision 1.53
diff -u -b -r1.53 tag_switch.m
--- compiler/tag_switch.m	2002/03/28 03:43:40	1.53
+++ compiler/tag_switch.m	2002/09/02 00:56:17
@@ -15,7 +15,7 @@
 :- interface.
 
 :- import_module parse_tree__prog_data.
-:- import_module hlds__hlds_data, hlds__hlds_llds.
+:- import_module hlds__hlds_data, hlds__hlds_goal.
 :- import_module ll_backend__llds, ll_backend__code_info.
 :- import_module backend_libs__switch_util, backend_libs__code_model.
 
@@ -24,7 +24,7 @@
 	% Generate intelligent indexing code for tag based switches.
 
 :- pred tag_switch__generate(list(extended_case), prog_var, code_model,
-	can_fail, store_map, label, branch_end, branch_end, code_tree,
+	can_fail, hlds_goal_info, label, branch_end, branch_end, code_tree,
 	code_info, code_info).
 :- mode tag_switch__generate(in, in, in, in, in, in, in, out, out, in, out)
 	is det.
@@ -32,7 +32,7 @@
 :- implementation.
 
 :- import_module parse_tree__prog_data.
-:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_goal. 
+:- import_module hlds__hlds_module, hlds__hlds_pred, hlds__hlds_llds. 
 :- import_module check_hlds__type_util.
 :- import_module ll_backend__code_gen, ll_backend__trace.
 :- import_module backend_libs__builtin_ops.
@@ -171,9 +171,8 @@
 			;	jump_table
 			;	binary_search.
 
-tag_switch__generate(Cases, Var, CodeModel, CanFail, StoreMap, EndLabel,
-		MaybeEnd0, MaybeEnd, Code)
-		-->
+tag_switch__generate(Cases, Var, CodeModel, CanFail, SwitchGoalInfo, EndLabel,
+		MaybeEnd0, MaybeEnd, Code) -->
 	% group the cases based on primary tag value
 	% and find out how many constructors share each primary tag value
 
@@ -270,14 +269,14 @@
 			PtagCaseList) },
 		tag_switch__generate_primary_binary_search(PtagCaseList,
 			0, MaxPrimary, PtagRval, VarRval, CodeModel, CanFail,
-			StoreMap, EndLabel, FailLabel, PtagCountMap,
+			SwitchGoalInfo, EndLabel, FailLabel, PtagCountMap,
 			no, MaybeEnd, CasesCode)
 	;
 		{ PrimaryMethod = jump_table },
 		{ switch_util__order_ptags_by_value(0, MaxPrimary, PtagCaseMap,
 			PtagCaseList) },
 		tag_switch__generate_primary_jump_table(PtagCaseList,
-			0, MaxPrimary, VarRval, CodeModel, StoreMap,
+			0, MaxPrimary, VarRval, CodeModel, SwitchGoalInfo,
 			EndLabel, FailLabel, PtagCountMap, MaybeEnd0, MaybeEnd,
 			Labels, TableCode),
 		{ SwitchCode = node([
@@ -298,7 +297,7 @@
 			PtagCaseList = PtagCaseList0
 		},
 		tag_switch__generate_primary_try_chain(PtagCaseList,
-			PtagRval, VarRval, CodeModel, CanFail, StoreMap,
+			PtagRval, VarRval, CodeModel, CanFail, SwitchGoalInfo,
 			EndLabel, FailLabel, PtagCountMap, empty, empty,
 			MaybeEnd0, MaybeEnd, CasesCode)
 	;
@@ -306,7 +305,7 @@
 		{ switch_util__order_ptags_by_count(PtagCountList, PtagCaseMap,
 			PtagCaseList) },
 		tag_switch__generate_primary_try_me_else_chain(PtagCaseList,
-			PtagRval, VarRval, CodeModel, CanFail, StoreMap,
+			PtagRval, VarRval, CodeModel, CanFail, SwitchGoalInfo,
 			EndLabel, FailLabel, PtagCountMap, MaybeEnd0, MaybeEnd,
 			CasesCode)
 	),
@@ -324,7 +323,7 @@
 	% Generate a switch on a primary tag value using a try-me-else chain.
 
 :- pred tag_switch__generate_primary_try_me_else_chain(ptag_case_list,
-	rval, rval, code_model, can_fail, store_map, label, label,
+	rval, rval, code_model, can_fail, hlds_goal_info, label, label,
 	ptag_count_map, branch_end, branch_end,
 	code_tree, code_info, code_info).
 :- mode tag_switch__generate_primary_try_me_else_chain(in, in, in, in, in, in,
@@ -334,7 +333,7 @@
 		_, _) -->
 	{ error("generate_primary_try_me_else_chain: empty switch") }.
 tag_switch__generate_primary_try_me_else_chain([PtagGroup | PtagGroups],
-		TagRval, VarRval, CodeModel, CanFail, StoreMap,
+		TagRval, VarRval, CodeModel, CanFail, SwitchGoalInfo,
 		EndLabel, FailLabel, PtagCountMap, MaybeEnd0, MaybeEnd, Code)
 		-->
 	{ PtagGroup = Primary - (StagLoc - StagGoalMap) },
@@ -358,8 +357,8 @@
 		]) },
 		tag_switch__generate_primary_tag_code(StagGoalMap,
 			Primary, MaxSecondary, StagLoc, VarRval, CodeModel,
-			StoreMap, EndLabel, FailLabel, MaybeEnd0, MaybeEnd1,
-			TagCode),
+			SwitchGoalInfo, EndLabel, FailLabel,
+			MaybeEnd0, MaybeEnd1, TagCode),
 		{ ElseCode = node([
 			label(ElseLabel) -
 				"handle next primary tag"
@@ -373,7 +372,7 @@
 			code_info__reset_to_position(BranchStart),
 			tag_switch__generate_primary_try_me_else_chain(
 				PtagGroups, TagRval, VarRval, CodeModel,
-				CanFail, StoreMap, EndLabel, FailLabel,
+				CanFail, SwitchGoalInfo, EndLabel, FailLabel,
 				PtagCountMap, MaybeEnd1, MaybeEnd,
 				OtherTagsCode),
 			{ Code = tree(ThisTagCode, OtherTagsCode) }
@@ -391,8 +390,8 @@
 	;
 		tag_switch__generate_primary_tag_code(StagGoalMap,
 			Primary, MaxSecondary, StagLoc, VarRval, CodeModel,
-			StoreMap, EndLabel, FailLabel, MaybeEnd0, MaybeEnd,
-			Code)
+			SwitchGoalInfo, EndLabel, FailLabel,
+			MaybeEnd0, MaybeEnd, Code)
 	).
 
 %-----------------------------------------------------------------------------%
@@ -400,7 +399,7 @@
 	% Generate a switch on a primary tag value using a try chain.
 
 :- pred tag_switch__generate_primary_try_chain(ptag_case_list,
-	rval, rval, code_model, can_fail, store_map, label, label,
+	rval, rval, code_model, can_fail, hlds_goal_info, label, label,
 	ptag_count_map, code_tree, code_tree, branch_end, branch_end,
 	code_tree, code_info, code_info).
 :- mode tag_switch__generate_primary_try_chain(in, in, in, in, in, in,
@@ -410,7 +409,7 @@
 		_, _) -->
 	 { error("empty list in generate_primary_try_chain") }.
 tag_switch__generate_primary_try_chain([PtagGroup | PtagGroups],
-		TagRval, VarRval, CodeModel, CanFail, StoreMap, EndLabel,
+		TagRval, VarRval, CodeModel, CanFail, SwitchGoalInfo, EndLabel,
 		FailLabel, PtagCountMap, PrevTests0, PrevCases0,
 		MaybeEnd0, MaybeEnd, Code) -->
 	{ PtagGroup = Primary - (StagLoc - StagGoalMap) },
@@ -438,17 +437,17 @@
 		]) },
 		tag_switch__generate_primary_tag_code(StagGoalMap,
 			Primary, MaxSecondary, StagLoc, VarRval, CodeModel,
-			StoreMap, EndLabel, FailLabel, MaybeEnd0, MaybeEnd1,
-			TagCode),
+			SwitchGoalInfo, EndLabel, FailLabel,
+			MaybeEnd0, MaybeEnd1, TagCode),
 		{ PrevTests = tree(PrevTests0, TestCode) },
 		{ PrevCases = tree(tree(LabelCode, TagCode), PrevCases0) },
 		( { PtagGroups = [_|_] } ->
 			code_info__reset_to_position(BranchStart),
 			tag_switch__generate_primary_try_chain(PtagGroups,
-				TagRval, VarRval, CodeModel, CanFail, StoreMap,
-				EndLabel, FailLabel, PtagCountMap,
-				PrevTests, PrevCases, MaybeEnd1, MaybeEnd,
-				Code)
+				TagRval, VarRval, CodeModel, CanFail,
+				SwitchGoalInfo, EndLabel, FailLabel,
+				PtagCountMap, PrevTests, PrevCases,
+				MaybeEnd1, MaybeEnd, Code)
 		;
 			{ FailCode = node([
 				goto(label(FailLabel)) -
@@ -463,7 +462,7 @@
 		]) },
 		tag_switch__generate_primary_tag_code(StagGoalMap,
 			Primary, MaxSecondary, StagLoc, VarRval,
-			CodeModel, StoreMap, EndLabel, FailLabel,
+			CodeModel, SwitchGoalInfo, EndLabel, FailLabel,
 			MaybeEnd0, MaybeEnd, TagCode),
 		{ Code =
 			tree(PrevTests0,
@@ -479,14 +478,14 @@
 	% that has an entry for all possible primary tag values.
 
 :- pred tag_switch__generate_primary_jump_table(ptag_case_list, int, int,
-	rval, code_model, store_map, label, label, ptag_count_map,
+	rval, code_model, hlds_goal_info, label, label, ptag_count_map,
 	branch_end, branch_end, list(label), code_tree, code_info, code_info).
 :- mode tag_switch__generate_primary_jump_table(in, in, in, in,
 	in, in, in, in, in, in, out, out, out, in, out) is det.
 
 tag_switch__generate_primary_jump_table(PtagGroups, CurPrimary, MaxPrimary,
-		VarRval, CodeModel, StoreMap, EndLabel, FailLabel, PtagCountMap,
-		MaybeEnd0, MaybeEnd, Labels, Code) -->
+		VarRval, CodeModel, SwitchGoalInfo, EndLabel, FailLabel,
+		PtagCountMap, MaybeEnd0, MaybeEnd, Labels, Code) -->
 	( { CurPrimary > MaxPrimary } ->
 		{ PtagGroups = [] ->
 			true
@@ -516,21 +515,22 @@
 				tag_switch__generate_primary_tag_code(
 					StagGoalMap, CurPrimary, MaxSecondary,
 					StagLoc, VarRval, CodeModel,
-					StoreMap, EndLabel, FailLabel,
+					SwitchGoalInfo, EndLabel, FailLabel,
 					MaybeEnd0, MaybeEnd1, ThisTagCode)
 			;
 				code_info__remember_position(BranchStart),
 				tag_switch__generate_primary_tag_code(
 					StagGoalMap, CurPrimary, MaxSecondary,
 					StagLoc, VarRval, CodeModel,
-					StoreMap, EndLabel, FailLabel,
+					SwitchGoalInfo, EndLabel, FailLabel,
 					MaybeEnd0, MaybeEnd1, ThisTagCode),
 				code_info__reset_to_position(BranchStart)
 			),
 			tag_switch__generate_primary_jump_table(PtagGroups1,
 				NextPrimary, MaxPrimary, VarRval, CodeModel,
-				StoreMap, EndLabel, FailLabel, PtagCountMap,
-				MaybeEnd1, MaybeEnd, OtherLabels, OtherCode),
+				SwitchGoalInfo, EndLabel, FailLabel,
+				PtagCountMap, MaybeEnd1, MaybeEnd,
+				OtherLabels, OtherCode),
 			{ Labels = [NewLabel | OtherLabels] },
 			{ Code =
 				tree(LabelCode,
@@ -540,8 +540,9 @@
 		;
 			tag_switch__generate_primary_jump_table(PtagGroups,
 				NextPrimary, MaxPrimary, VarRval, CodeModel,
-				StoreMap, EndLabel, FailLabel, PtagCountMap,
-				MaybeEnd0, MaybeEnd, OtherLabels, Code),
+				SwitchGoalInfo, EndLabel, FailLabel,
+				PtagCountMap, MaybeEnd0, MaybeEnd,
+				OtherLabels, Code),
 			{ Labels = [FailLabel | OtherLabels] }
 		)
 	).
@@ -553,14 +554,14 @@
 	% MinPtag to MaxPtag (including both boundary values).
 
 :- pred tag_switch__generate_primary_binary_search(ptag_case_list, int, int,
-	rval, rval, code_model, can_fail, store_map, label, label,
+	rval, rval, code_model, can_fail, hlds_goal_info, label, label,
 	ptag_count_map, branch_end, branch_end, code_tree,
 	code_info, code_info).
 :- mode tag_switch__generate_primary_binary_search(in, in, in,
 	in, in, in, in, in, in, in, in, in, out, out, in, out) is det.
 
 tag_switch__generate_primary_binary_search(PtagGroups, MinPtag, MaxPtag,
-		PtagRval, VarRval, CodeModel, CanFail, StoreMap,
+		PtagRval, VarRval, CodeModel, CanFail, SwitchGoalInfo,
 		EndLabel, FailLabel, PtagCountMap,
 		MaybeEnd0, MaybeEnd, Code) -->
 	( { MinPtag = MaxPtag } ->
@@ -592,7 +593,7 @@
 			},
 			tag_switch__generate_primary_tag_code(
 				StagGoalMap, CurPrimary, MaxSecondary, StagLoc,
-				VarRval, CodeModel, StoreMap, EndLabel,
+				VarRval, CodeModel, SwitchGoalInfo, EndLabel,
 				FailLabel, MaybeEnd0, MaybeEnd, Code)
 		;
 			{ error("caselist not singleton or empty when binary search ends") }
@@ -628,13 +629,13 @@
 		code_info__remember_position(BranchStart),
 		tag_switch__generate_primary_binary_search(LowGroups,
 			MinPtag, LowRangeEnd, PtagRval, VarRval, CodeModel,
-			CanFail, StoreMap, EndLabel, FailLabel, PtagCountMap,
-			MaybeEnd0, MaybeEnd1, LowRangeCode),
+			CanFail, SwitchGoalInfo, EndLabel, FailLabel,
+			PtagCountMap, MaybeEnd0, MaybeEnd1, LowRangeCode),
 		code_info__reset_to_position(BranchStart),
 		tag_switch__generate_primary_binary_search(HighGroups,
 			HighRangeStart, MaxPtag, PtagRval, VarRval, CodeModel,
-			CanFail, StoreMap, EndLabel, FailLabel, PtagCountMap,
-			MaybeEnd1, MaybeEnd, HighRangeCode),
+			CanFail, SwitchGoalInfo, EndLabel, FailLabel,
+			PtagCountMap, MaybeEnd1, MaybeEnd, HighRangeCode),
 
 		{ Code =
 			tree(IfCode,
@@ -651,13 +652,13 @@
 	% use a jump table to implement the secondary switch.
 
 :- pred tag_switch__generate_primary_tag_code(stag_goal_map, tag_bits, int,
-	stag_loc, rval, code_model, store_map, label, label,
+	stag_loc, rval, code_model, hlds_goal_info, label, label,
 	branch_end, branch_end, code_tree, code_info, code_info).
 :- mode tag_switch__generate_primary_tag_code(in, in, in, in, in, in, in,
 	in, in, in, out, out, in, out) is det.
 
 tag_switch__generate_primary_tag_code(GoalMap, Primary, MaxSecondary, StagLoc,
-		Rval, CodeModel, StoreMap, EndLabel, FailLabel,
+		Rval, CodeModel, SwitchGoalInfo, EndLabel, FailLabel,
 		MaybeEnd0, MaybeEnd, Code) -->
 	{ map__to_assoc_list(GoalMap, GoalList) },
 	(
@@ -666,8 +667,9 @@
 		% There is no secondary tag, so there is no switch on it
 		( { GoalList = [-1 - Goal] } ->
 			trace__maybe_generate_internal_event_code(Goal,
-				TraceCode),
+				SwitchGoalInfo, TraceCode),
 			code_gen__generate_goal(CodeModel, Goal, GoalCode),
+			{ goal_info_get_store_map(SwitchGoalInfo, StoreMap) },
 			code_info__generate_branch_end(StoreMap,
 				MaybeEnd0, MaybeEnd, SaveCode),
 			{ GotoCode = node([
@@ -754,7 +756,7 @@
 		(
 			{ SecondaryMethod = jump_table },
 			tag_switch__generate_secondary_jump_table(GoalList,
-				0, MaxSecondary, CodeModel, StoreMap,
+				0, MaxSecondary, CodeModel, SwitchGoalInfo,
 				EndLabel, FailLabel, MaybeEnd0, MaybeEnd,
 				Labels, CasesCode),
 			{ SwitchCode = node([
@@ -766,12 +768,12 @@
 			{ SecondaryMethod = binary_search },
 			tag_switch__generate_secondary_binary_search(GoalList,
 				0, MaxSecondary, StagRval, CodeModel, CanFail,
-				StoreMap, EndLabel, FailLabel,
+				SwitchGoalInfo, EndLabel, FailLabel,
 				MaybeEnd0, MaybeEnd, Code)
 		;
 			{ SecondaryMethod = try_chain },
 			tag_switch__generate_secondary_try_chain(GoalList,
-				StagRval, CodeModel, CanFail, StoreMap,
+				StagRval, CodeModel, CanFail, SwitchGoalInfo,
 				EndLabel, FailLabel, empty, empty,
 				MaybeEnd0, MaybeEnd, Codes),
 			{ Code = tree(StagCode, Codes) }
@@ -779,7 +781,7 @@
 			{ SecondaryMethod = try_me_else_chain },
 			tag_switch__generate_secondary_try_me_else_chain(
 				GoalList, StagRval, CodeModel, CanFail,
-				StoreMap, EndLabel, FailLabel,
+				SwitchGoalInfo, EndLabel, FailLabel,
 				MaybeEnd0, MaybeEnd, Codes),
 			{ Code = tree(StagCode, Codes) }
 		)
@@ -790,7 +792,7 @@
 	% Generate a switch on a secondary tag value using a try-me-else chain.
 
 :- pred tag_switch__generate_secondary_try_me_else_chain(stag_goal_list, rval,
-	code_model, can_fail, store_map, label, label,
+	code_model, can_fail, hlds_goal_info, label, label,
 	branch_end, branch_end, code_tree, code_info, code_info).
 :- mode tag_switch__generate_secondary_try_me_else_chain(in, in, in, in, in,
 	in, in, in, out, out, in, out) is det.
@@ -799,9 +801,10 @@
 		-->
 	{ error("generate_secondary_try_me_else_chain: empty switch") }.
 tag_switch__generate_secondary_try_me_else_chain([Case0 | Cases0], StagRval,
-		CodeModel, CanFail, StoreMap, EndLabel, FailLabel,
+		CodeModel, CanFail, SwitchGoalInfo, EndLabel, FailLabel,
 		MaybeEnd0, MaybeEnd, Code) -->
 	{ Case0 = Secondary - Goal },
+	{ goal_info_get_store_map(SwitchGoalInfo, StoreMap) },
 	( { Cases0 = [_|_] ; CanFail = can_fail } ->
 		code_info__remember_position(BranchStart),
 		code_info__get_next_label(ElseLabel),
@@ -811,7 +814,8 @@
 				label(ElseLabel))
 				- "test remote sec tag only"
 		]) },
-		trace__maybe_generate_internal_event_code(Goal, TraceCode),
+		trace__maybe_generate_internal_event_code(Goal, SwitchGoalInfo,
+			TraceCode),
 		code_gen__generate_goal(CodeModel, Goal, GoalCode),
 		code_info__generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd1,
 			SaveCode),
@@ -831,7 +835,7 @@
 		( { Cases0 = [_|_] } ->
 			code_info__reset_to_position(BranchStart),
 			tag_switch__generate_secondary_try_me_else_chain(Cases0,
-				StagRval, CodeModel, CanFail, StoreMap,
+				StagRval, CodeModel, CanFail, SwitchGoalInfo,
 				EndLabel, FailLabel, MaybeEnd1, MaybeEnd,
 				OtherCode),
 			{ Code = tree(ThisCode, OtherCode) }
@@ -844,7 +848,8 @@
 			{ Code = tree(ThisCode, FailCode) }
 		)
 	;
-		trace__maybe_generate_internal_event_code(Goal, TraceCode),
+		trace__maybe_generate_internal_event_code(Goal, SwitchGoalInfo,
+			TraceCode),
 		code_gen__generate_goal(CodeModel, Goal, GoalCode),
 		code_info__generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd,
 			SaveCode),
@@ -865,8 +870,9 @@
 	% Generate a switch on a secondary tag value using a try chain.
 
 :- pred tag_switch__generate_secondary_try_chain(stag_goal_list, rval,
-	code_model, can_fail, store_map, label, label, code_tree, code_tree,
-	branch_end, branch_end, code_tree, code_info, code_info).
+	code_model, can_fail, hlds_goal_info, label, label,
+	code_tree, code_tree, branch_end, branch_end, code_tree, code_info,
+	code_info).
 :- mode tag_switch__generate_secondary_try_chain(in, in, in, in, in,
 	in, in, in, in, in, out, out, in, out) is det.
 
@@ -874,9 +880,10 @@
 		-->
 	{ error("generate_secondary_try_chain: empty switch") }.
 tag_switch__generate_secondary_try_chain([Case0 | Cases0], StagRval,
-		CodeModel, CanFail, StoreMap, EndLabel, FailLabel,
+		CodeModel, CanFail, SwitchGoalInfo, EndLabel, FailLabel,
 		PrevTests0, PrevCases0, MaybeEnd0, MaybeEnd, Code) -->
 	{ Case0 = Secondary - Goal },
+	{ goal_info_get_store_map(SwitchGoalInfo, StoreMap) },
 	( { Cases0 = [_|_] ; CanFail = can_fail } ->
 		code_info__remember_position(BranchStart),
 		code_info__get_next_label(ThisStagLabel),
@@ -890,7 +897,8 @@
 			label(ThisStagLabel) -
 				"handle next secondary tag"
 		]) },
-		trace__maybe_generate_internal_event_code(Goal, TraceCode),
+		trace__maybe_generate_internal_event_code(Goal, SwitchGoalInfo,
+			TraceCode),
 		code_gen__generate_goal(CodeModel, Goal, GoalCode),
 		code_info__generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd1,
 			SaveCode),
@@ -910,7 +918,7 @@
 		( { Cases0 = [_|_] } ->
 			code_info__reset_to_position(BranchStart),
 			tag_switch__generate_secondary_try_chain(Cases0,
-				StagRval, CodeModel, CanFail, StoreMap,
+				StagRval, CodeModel, CanFail, SwitchGoalInfo,
 				EndLabel, FailLabel, PrevTests, PrevCases,
 				MaybeEnd1, MaybeEnd, Code)
 		;
@@ -922,7 +930,8 @@
 			{ Code = tree(PrevTests, tree(FailCode, PrevCases)) }
 		)
 	;
-		trace__maybe_generate_internal_event_code(Goal, TraceCode),
+		trace__maybe_generate_internal_event_code(Goal, SwitchGoalInfo,
+			TraceCode),
 		code_gen__generate_goal(CodeModel, Goal, GoalCode),
 		code_info__generate_branch_end(StoreMap, MaybeEnd0, MaybeEnd,
 			SaveCode),
@@ -946,14 +955,14 @@
 	% that has an entry for all possible secondary tag values.
 
 :- pred tag_switch__generate_secondary_jump_table(stag_goal_list, int, int,
-	code_model, store_map, label, label, branch_end, branch_end,
+	code_model, hlds_goal_info, label, label, branch_end, branch_end,
 	list(label), code_tree, code_info, code_info).
 :- mode tag_switch__generate_secondary_jump_table(in, in, in, in,
 	in, in, in, in, out, out, out, in, out) is det.
 
 tag_switch__generate_secondary_jump_table(CaseList, CurSecondary, MaxSecondary,
-		CodeModel, StoreMap, EndLabel, FailLabel, MaybeEnd0, MaybeEnd,
-		Labels, Code) -->
+		CodeModel, SwitchGoalInfo, EndLabel, FailLabel,
+		MaybeEnd0, MaybeEnd, Labels, Code) -->
 	( { CurSecondary > MaxSecondary } ->
 		{ CaseList = [] ->
 			true
@@ -973,8 +982,9 @@
 			]) },
 			code_info__remember_position(BranchStart),
 			trace__maybe_generate_internal_event_code(Goal,
-				TraceCode),
+				SwitchGoalInfo, TraceCode),
 			code_gen__generate_goal(CodeModel, Goal, GoalCode),
+			{ goal_info_get_store_map(SwitchGoalInfo, StoreMap) },
 			code_info__generate_branch_end(StoreMap,
 				MaybeEnd0, MaybeEnd1, SaveCode),
 			( { CaseList1 = [] } ->
@@ -988,7 +998,7 @@
 			]) },
 			tag_switch__generate_secondary_jump_table(CaseList1,
 				NextSecondary, MaxSecondary, CodeModel,
-				StoreMap, EndLabel, FailLabel,
+				SwitchGoalInfo, EndLabel, FailLabel,
 				MaybeEnd1, MaybeEnd, OtherLabels, OtherCode),
 			{ Labels = [NewLabel | OtherLabels] },
 			{ Code =
@@ -1002,7 +1012,7 @@
 		;
 			tag_switch__generate_secondary_jump_table(CaseList,
 				NextSecondary, MaxSecondary, CodeModel,
-				StoreMap, EndLabel, FailLabel,
+				SwitchGoalInfo, EndLabel, FailLabel,
 				MaybeEnd0, MaybeEnd, OtherLabels, Code),
 			{ Labels = [FailLabel | OtherLabels] }
 		)
@@ -1015,14 +1025,14 @@
 	% MinPtag to MaxPtag (including both boundary values).
 
 :- pred tag_switch__generate_secondary_binary_search(stag_goal_list, int, int,
-	rval, code_model, can_fail, store_map, label, label,
+	rval, code_model, can_fail, hlds_goal_info, label, label,
 	branch_end, branch_end, code_tree, code_info, code_info).
 :- mode tag_switch__generate_secondary_binary_search(in, in, in,
 	in, in, in, in, in, in, in, out, out, in, out) is det.
 
 tag_switch__generate_secondary_binary_search(StagGoals, MinStag, MaxStag,
-		StagRval, CodeModel, CanFail, StoreMap, EndLabel, FailLabel,
-		MaybeEnd0, MaybeEnd, Code) -->
+		StagRval, CodeModel, CanFail, SwitchGoalInfo, EndLabel,
+		FailLabel, MaybeEnd0, MaybeEnd, Code) -->
 	( { MinStag = MaxStag } ->
 		{ CurSec = MinStag },
 		( { StagGoals = [] } ->
@@ -1043,8 +1053,9 @@
 			{ MaybeEnd = MaybeEnd0 }
 		; { StagGoals = [CurSec - Goal] } ->
 			trace__maybe_generate_internal_event_code(Goal,
-				TraceCode),
+				SwitchGoalInfo, TraceCode),
 			code_gen__generate_goal(CodeModel, Goal, GoalCode),
+			{ goal_info_get_store_map(SwitchGoalInfo, StoreMap) },
 			code_info__generate_branch_end(StoreMap,
 				MaybeEnd0, MaybeEnd, SaveCode),
 			{ Code =
@@ -1086,12 +1097,12 @@
 		code_info__remember_position(BranchStart),
 		tag_switch__generate_secondary_binary_search(LowGoals,
 			MinStag, LowRangeEnd, StagRval, CodeModel,
-			CanFail, StoreMap, EndLabel, FailLabel,
+			CanFail, SwitchGoalInfo, EndLabel, FailLabel,
 			MaybeEnd0, MaybeEnd1, LowRangeCode),
 		code_info__reset_to_position(BranchStart),
 		tag_switch__generate_secondary_binary_search(HighGoals,
 			HighRangeStart, MaxStag, StagRval, CodeModel,
-			CanFail, StoreMap, EndLabel, FailLabel,
+			CanFail, SwitchGoalInfo, EndLabel, FailLabel,
 			MaybeEnd1, MaybeEnd, HighRangeCode),
 
 		{ Code =
Index: compiler/trace.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trace.m,v
retrieving revision 1.56
diff -u -b -r1.56 trace.m
--- compiler/trace.m	2002/08/30 07:22:40	1.56
+++ compiler/trace.m	2002/09/02 03:14:38
@@ -163,13 +163,14 @@
 	% trace event. This predicate must be called just before generating
 	% code for the given goal.
 :- pred trace__maybe_generate_internal_event_code(hlds_goal::in,
-	code_tree::out, code_info::in, code_info::out) is det.
+	hlds_goal_info::in, code_tree::out, code_info::in, code_info::out)
+	is det.
 
 	% If we are doing execution tracing, generate code for an trace event
 	% that represents leaving a negated goal (via success or failure).
 :- pred trace__maybe_generate_negated_event_code(hlds_goal::in,
-	negation_end_port::in, code_tree::out, code_info::in, code_info::out)
-	is det.
+	hlds_goal_info::in, negation_end_port::in, code_tree::out,
+	code_info::in, code_info::out) is det.
 
 	% If we are doing execution tracing, generate code for a nondet
 	% pragma C code trace event.
@@ -638,7 +639,7 @@
 		TraceCode = empty
 	}.
 
-trace__maybe_generate_internal_event_code(Goal, Code) -->
+trace__maybe_generate_internal_event_code(Goal, OutsideGoalInfo, Code) -->
 	code_info__get_maybe_trace_info(MaybeTraceInfo),
 	(
 		{ MaybeTraceInfo = yes(TraceInfo) }
@@ -680,9 +681,16 @@
 		->
 			{ goal_info_get_pre_deaths(GoalInfo, PreDeaths) },
 			{ goal_info_get_context(GoalInfo, Context) },
+			{ goal_info_has_feature(OutsideGoalInfo,
+				hide_debug_event)
+			->
+				HideEvent = yes
+			;
+				HideEvent = no
+			},
 			trace__generate_event_code(Port,
 				internal(Path, PreDeaths), TraceInfo,
-				Context, _, _, Code)
+				Context, HideEvent, _, _, Code)
 		;
 			{ Code = empty }
 		)
@@ -690,7 +698,8 @@
 		{ Code = empty }
 	).
 
-trace__maybe_generate_negated_event_code(Goal, NegPort, Code) -->
+trace__maybe_generate_negated_event_code(Goal, OutsideGoalInfo, NegPort, Code)
+		-->
 	code_info__get_maybe_trace_info(MaybeTraceInfo),
 	(
 		{ MaybeTraceInfo = yes(TraceInfo) },
@@ -710,8 +719,13 @@
 		{ Goal = _ - GoalInfo },
 		{ goal_info_get_goal_path(GoalInfo, Path) },
 		{ goal_info_get_context(GoalInfo, Context) },
+		{ goal_info_has_feature(OutsideGoalInfo, hide_debug_event) ->
+			HideEvent = yes
+		;
+			HideEvent = no
+		},
 		trace__generate_event_code(Port, negation_end(Path),
-			TraceInfo, Context, _, _, Code)
+			TraceInfo, Context, HideEvent, _, _, Code)
 	;
 		{ Code = empty }
 	).
@@ -728,7 +742,7 @@
 			TraceInfo ^ trace_suppress_items, Port) = yes }
 	->
 		trace__generate_event_code(Port, nondet_pragma, TraceInfo,
-			Context, _, _, Code)
+			Context, no, _, _, Code)
 	;
 		{ Code = empty }
 	).
@@ -744,7 +758,7 @@
 			TraceInfo ^ trace_suppress_items, Port) = yes }
 	->
 		trace__generate_event_code(Port, external, TraceInfo,
-			Context, Label, TvarDataMap, Code),
+			Context, no, Label, TvarDataMap, Code),
 		{ MaybeExternalInfo = yes(external_event_info(Label,
 			TvarDataMap, Code)) }
 	;
@@ -752,11 +766,11 @@
 	).
 
 :- pred trace__generate_event_code(trace_port::in, trace_port_info::in,
-	trace_info::in, prog_context::in, label::out,
+	trace_info::in, prog_context::in, bool::in, label::out,
 	map(tvar, set(layout_locn))::out, code_tree::out,
 	code_info::in, code_info::out) is det.
 
-trace__generate_event_code(Port, PortInfo, TraceInfo, Context,
+trace__generate_event_code(Port, PortInfo, TraceInfo, Context, HideEvent,
 		Label, TvarDataMap, Code) -->
 	code_info__get_next_label(Label),
 	code_info__get_known_variables(LiveVars0),
@@ -825,8 +839,8 @@
 		"\t\t\t(const MR_Label_Layout *)\n",
 		"\t\t\t&", LabelStr, ");\n"],
 		CallStmt) },
-	code_info__add_trace_layout_for_label(Label, Context, Port, no, Path,
-		LayoutLabelInfo),
+	code_info__add_trace_layout_for_label(Label, Context, Port, HideEvent,
+		Path, LayoutLabelInfo),
 	(
 		{ Port = fail },
 		{ TraceInfo ^ redo_label = yes(RedoLabel) }
@@ -842,7 +856,7 @@
 		% for the redo event, whose layout information is filled in
 		% when we get to the fail event.
 		code_info__add_trace_layout_for_label(RedoLabel, Context, redo,
-			no, Path, LayoutLabelInfo)
+			HideEvent, Path, LayoutLabelInfo)
 	;
 		[]
 	),
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
Index: doc/mdb_categories
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/mdb_categories,v
retrieving revision 1.12
diff -u -b -r1.12 mdb_categories
--- doc/mdb_categories	2002/04/08 04:45:32	1.12
+++ doc/mdb_categories	2002/09/02 05:12:48
@@ -57,7 +57,8 @@
 developer  - Commands that are intended to be of use only to developers
              of the Mercury implementation. The developer commands are
              `nondet_stack', `stack_regs', `all_regs', `table_io',
-	     `proc_stats', `label_stats' and `print_optionals'.
+             `proc_stats', `label_stats', `print_optionals' and
+             `unhide_events'.
 
 end
 document_category 1000 misc
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.325
diff -u -b -r1.325 user_guide.texi
--- doc/user_guide.texi	2002/09/01 06:05:15	1.325
+++ doc/user_guide.texi	2002/09/01 16:38:20
@@ -3048,6 +3048,18 @@
 @sp 1
 @item print_optionals off
 Tells the debugger not to print optionally-printed values.
+ at sp 1
+ at item unhide_events
+ at kindex unhide_events (mdb command)
+Reports whether events that are normally hidden
+(that are usually of interest only to implementors)
+are being exposed or not.
+ at sp 1
+ at item unhide_events on
+Tells the debugger to expose events that are normally hidden.
+ at sp 1
+ at item unhide_events off
+Tells the debugger to hide events that are normally hidden.
 @end table
 @node Miscellaneous commands
 @subsection Miscellaneous commands
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.45
diff -u -b -r1.45 mercury_trace_base.c
--- runtime/mercury_trace_base.c	2002/07/26 04:20:12	1.45
+++ runtime/mercury_trace_base.c	2002/09/01 16:22:49
@@ -112,6 +112,27 @@
 MR_bool		MR_trace_from_full = MR_TRUE;
 
 /*
+** MR_trace_unhide_events is a boolean. Normally, it is set to false, which
+** means that events that the compiler designates as hidden are really hidden
+** from the procedural debugger, being visible only when building the annotated
+** trace. When an mdb command intended for implementors only sets it to true,
+** hidden events will be visible to the procedural debugger too, i.e. the
+** hidden annotation on events will cease to be effective.
+**
+** The MR_trace_have_unhid_events is a boolean that is set to true whenever
+** MR_trace_unhide_events is set to true, and it is never reset to false.
+** MR_trace_have_unhid_events will therefore be true if the user has ever
+** unhidden events. The declarative debugger checks this flag and refuses
+** to perform if it is set, because if this flag has ever been set, then the
+** numbering of events may not be the same after a retry, which makes it
+** impossible to *reliably* find the event at which the "dd" command was issued
+** while building the annotated trace.
+*/
+
+MR_bool		MR_trace_unhide_events = MR_FALSE;
+MR_bool		MR_trace_have_unhid_events = MR_FALSE;
+
+/*
 ** I/O tabling is documented in library/table_builtin.m
 */
 
Index: runtime/mercury_trace_base.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.h,v
retrieving revision 1.25
diff -u -b -r1.25 mercury_trace_base.h
--- runtime/mercury_trace_base.h	2002/07/22 07:13:10	1.25
+++ runtime/mercury_trace_base.h	2002/09/01 16:23:56
@@ -128,6 +128,9 @@
 extern	MR_Unsigned	MR_trace_event_number;
 extern	MR_bool		MR_trace_from_full;
 
+extern	MR_bool		MR_trace_unhide_events;
+extern	MR_bool		MR_trace_have_unhid_events;
+
 /*
 ** The details of I/O tabling are documented in library/table_builtin.m.
 */
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
Index: tests/debugger/mdb_command_test.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/mdb_command_test.inp,v
retrieving revision 1.18
diff -u -b -r1.18 mdb_command_test.inp
--- tests/debugger/mdb_command_test.inp	2002/08/30 04:02:52	1.18
+++ tests/debugger/mdb_command_test.inp	2002/09/02 04:56:02
@@ -47,6 +47,7 @@
 proc_stats           xyzzy xyzzy xyzzy xyzzy xyzzy
 label_stats          xyzzy xyzzy xyzzy xyzzy xyzzy
 print_optionals      xyzzy xyzzy xyzzy xyzzy xyzzy
+unhide_events        xyzzy xyzzy xyzzy xyzzy xyzzy
 source               xyzzy xyzzy xyzzy xyzzy xyzzy
 save                 xyzzy xyzzy xyzzy xyzzy xyzzy
 quit                 xyzzy xyzzy xyzzy xyzzy xyzzy
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.53
diff -u -b -r1.53 mercury_trace.c
--- trace/mercury_trace.c	2002/07/29 11:16:00	1.53
+++ trace/mercury_trace.c	2002/09/01 16:28:47
@@ -145,6 +145,10 @@
 		depth = (MR_Unsigned) MR_call_depth_framevar(MR_curfr);
 	}
 
+	if (layout->MR_sll_hidden && !MR_trace_unhide_events) {
+		return NULL;
+	}
+
 	MR_trace_event_number++;
 
 #ifdef	MR_TRACE_HISTOGRAM
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.133
diff -u -b -r1.133 mercury_trace_internal.c
--- trace/mercury_trace_internal.c	2002/08/07 03:18:57	1.133
+++ trace/mercury_trace_internal.c	2002/09/01 16:35:38
@@ -436,6 +436,9 @@
 static MR_Next	MR_trace_cmd_print_optionals(char **words, int word_count,
 			MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
 			MR_Event_Details *event_details, MR_Code **jumpaddr);
+static MR_Next	MR_trace_cmd_unhide_events(char **words, int word_count,
+			MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
+			MR_Event_Details *event_details, MR_Code **jumpaddr);
 static MR_Next	MR_trace_cmd_save(char **words, int word_count,
 			MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
 			MR_Event_Details *event_details, MR_Code **jumpaddr);
@@ -3309,13 +3312,36 @@
 		MR_print_optionals = MR_TRUE;
 		MR_trace_set_level(MR_trace_current_level(),
 			MR_print_optionals);
-	} else if (word_count != 1)  {
+	} else if (word_count == 1)  {
+		fprintf(MR_mdb_out,
+			"optional values are %s being printed\n",
+			MR_print_optionals? "" : "not");
+	} else {
 		MR_trace_usage("developer", "print_optionals");
 	}
 
+	return KEEP_INTERACTING;
+}
+
+static MR_Next
+MR_trace_cmd_unhide_events(char **words, int word_count,
+	MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
+	MR_Event_Details *event_details, MR_Code **jumpaddr)
+{
+	if (word_count == 2 && MR_streq(words[1], "off")) {
+		MR_trace_unhide_events = MR_FALSE;
+		fprintf(MR_mdb_out, "hidden events values are hidden\n");
+	} else if (word_count == 2 && MR_streq(words[1], "on")) {
+		MR_trace_unhide_events = MR_TRUE;
+		MR_trace_have_unhid_events = MR_TRUE;
+		fprintf(MR_mdb_out, "hidden events values are exposed\n");
+	} else if (word_count == 1)  {
 	fprintf(MR_mdb_out,
-		"optional values are %s being printed\n",
-		MR_print_optionals? "" : "not");
+			"hidden events are %s\n",
+			MR_trace_unhide_events? "exposed" : "hidden");
+	} else {
+		MR_trace_usage("developer", "unhide_events");
+	}
 
 	return KEEP_INTERACTING;
 }
@@ -3471,6 +3497,13 @@
 		fprintf(MR_mdb_err,
 			"mdb: dd requires no arguments.\n");
 	} else {
+		if (MR_trace_have_unhid_events) {
+			fflush(MR_mdb_out);
+			fprintf(MR_mdb_err,
+				"mdb: dd doesn't work after `unhide_events on'.\n");
+			return KEEP_INTERACTING;
+		}
+
 		if (MR_trace_start_decl_debug(MR_TRACE_DECL_DEBUG,
 			NULL, cmd, event_info, event_details, jumpaddr))
 		{
@@ -5086,6 +5119,8 @@
 	{ "developer", "proc_body", MR_trace_cmd_proc_body,
 		NULL, MR_trace_null_completer },
 	{ "developer", "print_optionals", MR_trace_cmd_print_optionals,
+		MR_trace_on_off_args, MR_trace_null_completer },
+	{ "developer", "unhide_events", MR_trace_cmd_unhide_events,
 		MR_trace_on_off_args, MR_trace_null_completer },
 
 	{ "misc", "source", MR_trace_cmd_source,
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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