[m-dev.] For review: Add a pred_or_func attribute to the external debugger

Erwan Jahier Erwan.Jahier at irisa.fr
Sat Feb 20 01:44:22 AEDT 1999


|
| > --- fixbug1.4/browser/debugger_interface.m Thu, 18 Feb 1999 22:16:50 +0100 jahier (submitdiff/6_debugger_i 1.6 640)
| > +++ fixbug1.4(w)/browser/debugger_interface.m Fri, 19 Feb 1999 13:04:00 +0100 jahier (submitdiff/6_debugger_i 1.6 640)
| > @@ -80,6 +80,7 @@
| >  			match(call_number),
| >  			match(depth_number),
| >  			match(trace_port_type),
| > +			match(string),		% "pred" or "func"
| >  			match(string),		% module name
| >  			match(string),		% pred name
| >  			match(arity),
| > @@ -166,6 +167,7 @@
| >  			call_number,
| >  			depth_number,
| >  			trace_port_type,
| > +			string,		% "pred" or "func"
| >  			string,		% module name
| >  			string,		% pred name
| >  			arity,
| 
| Hmm, wouldn't it be better to use an enumeration type
| rather than a string here?

Yes.
Here is the new diff.

Index: trace/mercury_trace_external.c
--- fixbug1.4/trace/mercury_trace_external.c Fri, 19 Feb 1999 11:06:08 +0100 jahier (submitdiff/5_mercury_tr 1.14 640)
+++ fixbug1.5(w)/trace/mercury_trace_external.c Fri, 19 Feb 1999 15:42:01 +0100 jahier (submitdiff/5_mercury_tr 1.15 640)
@@ -567,6 +567,7 @@
 		seqno,
 		depth,
 		port,
+		layout->MR_sll_entry->MR_sle_user.MR_user_pred_or_func,
 		layout->MR_sll_entry->MR_sle_user.MR_user_def_module,
 		layout->MR_sll_entry->MR_sle_user.MR_user_name,
 		layout->MR_sll_entry->MR_sle_user.MR_user_arity,
@@ -650,6 +651,7 @@
 		seqno,
 		depth,
 		port,
+		layout->MR_sll_entry->MR_sle_user.MR_user_pred_or_func,
 		layout->MR_sll_entry->MR_sle_user.MR_user_def_module,
 		layout->MR_sll_entry->MR_sle_user.MR_user_name,
 		layout->MR_sll_entry->MR_sle_user.MR_user_arity,
Index: browser/debugger_interface.m
--- fixbug1.4/browser/debugger_interface.m Thu, 18 Feb 1999 22:16:50 +0100 jahier (submitdiff/6_debugger_i 1.6 640)
+++ fixbug1.5(w)/browser/debugger_interface.m Fri, 19 Feb 1999 15:28:40 +0100 jahier (submitdiff/6_debugger_i 1.7 640)
@@ -63,6 +63,9 @@
 
 :- type goal_path_string == string.
 
+:- type pred_or_func
+	--->	predicate
+	;	function.
 
 
 % This is known as "debugger_query" in the Opium documentation.
@@ -80,6 +83,7 @@
 			match(call_number),
 			match(depth_number),
 			match(trace_port_type),
+			match(pred_or_func),
 			match(string),		% module name
 			match(string),		% pred name
 			match(arity),
@@ -166,6 +170,7 @@
 			call_number,
 			depth_number,
 			trace_port_type,
+			pred_or_func,
 			string,		% module name
 			string,		% pred name
 			arity,
@@ -194,23 +199,23 @@
 %	send to the debugger (e.g. Opium) the attributes of the current event
 %	except the list of arguments.
 
-:- pragma export(output_current_slots(in, in, in, in, in, in, in, in, in,
+:- pragma export(output_current_slots(in, in, in, in, in, in, in, in, in, in,
 		in, in, di, uo), "ML_DI_output_current_slots").
 			
 :- pred output_current_slots(event_number, call_number, depth_number, 
-	trace_port_type, /* module name */ string, /* pred name */ string, 
-	arity, /* mode num */ int, determinism, goal_path_string, 
-	io__output_stream, io__state, io__state).
-:- mode output_current_slots(in, in, in, in, in, in, in, in, in, in, in,
+	trace_port_type, pred_or_func, /* module name */ string,
+	/* pred name */ string, arity, /* mode num */ int, determinism, 
+	goal_path_string, io__output_stream, io__state, io__state).
+:- mode output_current_slots(in, in, in, in, in, in, in, in, in, in, in, in,
  	di, uo) is det.
 
 
-output_current_slots(EventNumber, CallNumber, DepthNumber, Port,
+output_current_slots(EventNumber, CallNumber, DepthNumber, Port, PredOrFunc,
 	ModuleName, PredName, Arity, ModeNum, Determinism,
 	Path, OutputStream) -->
 	
 	{ CurrentTraceInfo = current_slots(EventNumber, CallNumber, 
-		DepthNumber, Port, ModuleName, PredName, Arity,
+		DepthNumber, Port, PredOrFunc, ModuleName, PredName, Arity,
 		ModeNum, Determinism, Path) },
 	io__write(OutputStream, CurrentTraceInfo),
 	io__print(OutputStream, ".\n"),
@@ -289,31 +294,34 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pragma export(found_match(in, in, in, in, in, in, in, in, in, in,
+:- pragma export(found_match(in, in, in, in, in, in, in, in, in, in, in,
 			in, in), "ML_DI_found_match").
 			
 :- pred found_match(event_number, call_number, depth_number, trace_port_type,
-	/* module name */ string, /* pred name */ string, arity,
-	/* mode num */ int, determinism, /* the arguments */ list(univ),
+	pred_or_func, /* module name */ string, 
+	/* pred name */ string, arity, /* mode num */ int, determinism, 
+	/* the arguments */ list(univ),
 				% XXX we could provide better ways of
 				% matching on arguments
 	goal_path_string, debugger_request).
-:- mode found_match(in, in, in, in, in, in, in, in, in, in, in, in)
+:- mode found_match(in, in, in, in, in, in, in, in, in, in, in, in, in)
 	is semidet.
 
-found_match(EventNumber, CallNumber, DepthNumber, Port, ModuleName, 
+found_match(EventNumber, CallNumber, DepthNumber, Port, PredOrFunc, ModuleName, 
 		PredName, Arity, ModeNum, Determinism, Args, Path, 
 		DebuggerRequest) :-
 	(
 		DebuggerRequest = forward_move(MatchEventNumber,
 			MatchCallNumber, MatchDepthNumber, MatchPort,
-			MatchModuleName, MatchPredName, MatchArity,
-			MatchModeNum, MatchDeterminism, MatchArgs, MatchPath)
+			MatchPredOrFunc, MatchModuleName, MatchPredName, 
+			MatchArity, MatchModeNum, MatchDeterminism, 
+			MatchArgs, MatchPath)
 	->
 		match(MatchEventNumber, EventNumber),
 		match(MatchCallNumber, CallNumber),
 		match(MatchDepthNumber, DepthNumber),
 		match(MatchPort, Port),
+		match(MatchPredOrFunc, PredOrFunc),
 		match(MatchModuleName, ModuleName),
 		match(MatchPredName, PredName),
 		match(MatchArity, Arity),
@@ -382,7 +390,7 @@
 % MR_debugger_request_type in runtime/mercury_trace_external.c.
 
 classify_request(hello_reply, 0).
-classify_request(forward_move(_, _, _, _, _, _, _, _, _, _, _), 1).
+classify_request(forward_move(_, _, _, _, _, _, _, _, _, _, _, _), 1).
 classify_request(current_vars, 2).
 classify_request(current_slots, 3).
 classify_request(no_trace, 4).



-- 
R1.





More information about the developers mailing list