Diff: More info for calls in hlds dumps

Andrew Bromage bromage at cs.mu.oz.au
Wed May 14 16:45:49 AEST 1997


G'day all.

Fergus, could you pleas review this one?  Thanks.

Cheers,
Andrew Bromage
--------8<---CUT HERE---8<--------
Approximate hours taken: 0.2

Output pred_ids and proc_ids for calls in HLDS dumps.  New option
for --verbose-dump-hlds 'l' which flags whether or not to dump
this information.

compiler/hlds_out.m:
	Write pred_id, proc_id and call unify context for calls
	in hlds_out__write_goal_2.

doc/user_guide.texi:
	Document new option for --verbose-dump-hlds.

Index: compiler/hlds_out.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_out.m,v
retrieving revision 1.161
diff -u -r1.161 hlds_out.m
--- hlds_out.m	1997/05/12 08:18:41	1.161
+++ hlds_out.m	1997/05/14 06:13:58
@@ -935,9 +935,9 @@
 	io__write_string(Follow),
 	io__write_string("\n").
 
-hlds_out__write_goal_2(call(_PredId, _ProcId, ArgVars, Builtin, _, PredName),
-		_ModuleInfo, VarSet, AppendVarnums, Indent, Follow, _) -->
-		% XXX we should print more info here
+hlds_out__write_goal_2(call(PredId, ProcId, ArgVars, Builtin,
+			MaybeUnifyContext, PredName),
+		ModuleInfo, VarSet, AppendVarnums, Indent, Follow, TypeQual) -->
 	globals__io_lookup_string_option(verbose_dump_hlds, Verbose),
 	( { string__contains_char(Verbose, 'b') } ->
 		(
@@ -965,7 +965,38 @@
 			AppendVarnums)
 	),
 	io__write_string(Follow),
-	io__write_string("\n").
+	io__write_string("\n"),
+	( { string__contains_char(Verbose, 'l') } ->
+		{ pred_id_to_int(PredId, PredNum) },
+		{ proc_id_to_int(ProcId, ProcNum) },
+		hlds_out__write_indent(Indent),
+		io__write_string("% pred id: "),
+		io__write_int(PredNum),
+		io__write_string(", proc id: "),
+		io__write_int(ProcNum),
+		io__write_strings([Follow, "\n"]),
+		( { MaybeUnifyContext = yes(CallUnifyContext) } ->
+			{ TypeQual = yes(_, VarTypes) ->
+				map__lookup(VarTypes, Var, UniType),
+				VarType = yes(UniType)
+			;
+				VarType = no
+			},
+			{ CallUnifyContext = call_unify_context(Var,
+					RHS, _UnifyContext) },
+			hlds_out__write_indent(Indent),
+			io__write_string("% Complicated unify: "),
+			mercury_output_var(Var, VarSet, AppendVarnums),
+			io__write_string(" = "),
+			hlds_out__write_unify_rhs_2(RHS, ModuleInfo, VarSet,
+				AppendVarnums, Indent, Follow, VarType,
+				TypeQual)
+		;
+			[]
+		)
+	;
+		[]
+	).
 
 hlds_out__write_goal_2(unify(A, B, _, Unification, _), ModuleInfo, VarSet,
 		AppendVarnums, Indent, Follow, TypeQual) -->
Index: doc/user_guide.texi
===================================================================
RCS file: /home/staff/zs/imp/mercury/doc/user_guide.texi,v
retrieving revision 1.85
diff -u -r1.85 user_guide.texi
--- user_guide.texi	1997/04/11 20:39:53	1.85
+++ user_guide.texi	1997/05/14 05:55:02
@@ -1233,6 +1233,7 @@
 d - determinism of goals,
 f - follow_vars sets of goals,
 i - instmap deltas of goals,
+l - pred/mode ids and unify contexts of called predicates,
 n - nonlocal variables of goals,
 p - pre-birth, post-birth, pre-death and post-death sets of goals,
 r - resume points of goals,



More information about the developers mailing list