[m-dev.] Please help... once more

Erwan Jahier Erwan.Jahier at irisa.fr
Mon Oct 16 21:49:12 AEDT 2000


| Please send a proper diff, not just cut-and-paste extracts.

Common subdirectories: trace-save/CVS and trace/CVS
Only in trace: libmer_trace.a
Only in trace: libmer_trace.so
diff -u trace-save/mercury_trace.c trace/mercury_trace.c
--- trace-save/mercury_trace.c	Wed Aug  9 17:53:35 2000
+++ trace/mercury_trace.c	Mon Oct 16 12:40:34 2000
@@ -131,7 +131,47 @@
 
 #endif	/* MR_TRACE_HISTOGRAM */
 
-	switch (MR_trace_ctrl.MR_trace_cmd) {
+	switch (MR_trace_ctrl.MR_trace_cmd) { 
+		case MR_CMD_COLLECT:
+		  {
+			MR_Event_Info	event_info;
+			Word		*saved_regs = event_info.MR_saved_regs;
+			int		max_r_num;
+			const char	*path;
+			bool    	stop_collecting = FALSE;
+			
+			port = (MR_Trace_Port) layout->MR_sll_port;
+			path = layout->MR_sll_entry->MR_sle_module_layout
+			  ->MR_ml_string_table + layout->MR_sll_goal_path;
+
+			max_r_num = layout->MR_sll_entry->MR_sle_max_r_num;
+			if (max_r_num + MR_NUM_SPECIAL_REG > 
+					MR_MAX_SPECIAL_REG_MR) 
+			{
+			  event_info.MR_max_mr_num = 
+					max_r_num + MR_NUM_SPECIAL_REG;
+			} else {
+				event_info.MR_max_mr_num = 
+						MR_MAX_SPECIAL_REG_MR;
+			}
+			MR_copy_regs_to_saved_regs(event_info.MR_max_mr_num, 
+					saved_regs);
+
+			MR_COLLECT_filter(seqno, depth, port, layout, 
+					path, &stop_collecting);
+		    
+			if (stop_collecting) 
+			{
+				MR_send_collect_result();
+				MR_send_message_to_socket(
+						"execution_continuing");
+		    	}
+		    
+			MR_copy_saved_regs_to_regs(event_info.MR_max_mr_num, 
+					saved_regs);
+		    
+			goto check_stop_print;
+		  }	
 		case MR_CMD_GOTO:
 			if (MR_trace_event_number >=
 					MR_trace_ctrl.MR_trace_stop_event)
diff -u trace-save/mercury_trace.h trace/mercury_trace.h
--- trace-save/mercury_trace.h	Wed Aug  9 17:53:36 2000
+++ trace/mercury_trace.h	Fri Oct 13 17:40:49 2000
@@ -90,6 +90,7 @@
 */
 
 typedef enum {
+	MR_CMD_COLLECT,
 	MR_CMD_GOTO,
 	MR_CMD_NEXT,
 	MR_CMD_FINISH,
Only in trace: mercury_trace.o
Only in trace: mercury_trace_alias.o
Only in trace: mercury_trace_browse.o
Only in trace: mercury_trace_declarative.o
diff -u trace-save/mercury_trace_external.c trace/mercury_trace_external.c
--- trace-save/mercury_trace_external.c	Sat Aug 12 17:53:43 2000
+++ trace/mercury_trace_external.c	Mon Oct 16 12:47:54 2000
@@ -134,6 +134,16 @@
 
 static	void	(*send_collect_result_ptr)(MR_Word, MR_Word);
 
+
+/*
+** Function pointer which is applied to each event during collect requets.
+*/
+
+static void    	(*filter_ptr)(MR_Integer, MR_Integer, MR_Integer, MR_Word,
+			MR_Word, MR_String, MR_String, MR_String, MR_Integer,
+			MR_Integer, MR_Word, MR_Integer, MR_String, MR_Word, 
+			MR_Word *, MR_Char *);
+
 /*
 ** Variable generated during the dynamic linking that is needed to close
 ** this linking properly.
@@ -163,7 +173,6 @@
 static void MR_send_message_to_socket_format(const char *format, ...)
 	MR_LIKE_PRINTF(1, 2);
 
-static void	MR_send_message_to_socket(const char *message);
 static void	MR_read_request_from_socket(
 			MR_Word *debugger_request_ptr, 
 			MR_Integer *debugger_request_type_ptr);

@@ -201,13 +210,7 @@
 static void	MR_get_variable_name(MR_Word debugger_request,
 			MR_String *var_name_ptr);
 static void	MR_trace_browse_one_external(MR_Var_Spec which_var);
-static void	MR_COLLECT_filter(void (*filter_ptr)(MR_Integer, MR_Integer, MR_Integer, 
-			MR_Word, MR_Word, MR_String, MR_String, MR_String, MR_Integer, MR_Integer, 
-			MR_Word, MR_Integer, MR_String, MR_Word, MR_Word *, MR_Char *), Unsigned seqno, 
-			Unsigned depth, MR_Trace_Port port, 
-			const MR_Stack_Layout_Label *layout, const char *path, 
-			bool *stop_collecting);
-static void	MR_send_collect_result(void);
+
 
 #if 0
 This pseudocode should go in the debugger process:
@@ -475,9 +478,6 @@
 {
 	static MR_Word	search_data;
 	static void	(*initialize_ptr)(MR_Word *);
-	static void    	(*filter_ptr)(MR_Integer, MR_Integer, MR_Integer, MR_Word,
-				MR_Word, MR_String, MR_String, MR_String, MR_Integer,
-				MR_Integer, MR_Word, MR_Integer, MR_String, MR_Word, MR_Word *, MR_Char *);
 	static void	(*get_collect_var_type_ptr)(MR_Word *);
 	static bool    	collect_linked = FALSE;
 	bool    	stop_collecting = FALSE;
@@ -537,7 +537,7 @@
 
 		case MR_collecting:
 		 
-			MR_COLLECT_filter(*filter_ptr, seqno, depth, port,
+			MR_COLLECT_filter(seqno, depth, port,
 				layout, path, &stop_collecting);
 
 			if (stop_collecting) {
@@ -809,7 +809,8 @@
 				if (collect_linked) {
 					MR_send_message_to_socket(
 						"collect_linked");
-					external_debugger_mode = MR_collecting;
+					cmd->MR_trace_cmd = MR_CMD_COLLECT;
+ 					external_debugger_mode = MR_collecting;
 					MR_TRACE_CALL_MERCURY(
 					  (*initialize_ptr)(&MR_collecting_variable));
 
@@ -818,7 +819,7 @@
 					** the current event, we need to call 
 					** filter once here.
 					*/
-					MR_COLLECT_filter(*filter_ptr, seqno, depth,
+					MR_COLLECT_filter(seqno, depth,
 						port, layout, path, &stop_collecting);
 					
 					if (stop_collecting) {
@@ -1062,7 +1063,7 @@
 	MR_line_number(MR_debugger_socket_out)++;
 }
 
-static void
+void
 MR_send_message_to_socket(const char *message)
 {
 	fprintf(MR_file(MR_debugger_socket_out), "%s.\n", message);
@@ -1463,10 +1464,8 @@
 ** This function calls the collect filtering predicate defined by the user
 ** and dynamically link with the execution.
 */
-static void
-MR_COLLECT_filter(void (*filter_ptr)(MR_Integer, MR_Integer, MR_Integer, MR_Word, MR_Word, 
-	MR_String, MR_String, MR_String, MR_Integer, MR_Integer, MR_Word, MR_Integer, MR_String, MR_Word, 
-	MR_Word *, MR_Char *), Unsigned seqno, Unsigned depth, MR_Trace_Port port, 
+void
+MR_COLLECT_filter(Unsigned seqno, Unsigned depth, MR_Trace_Port port, 
 	const MR_Stack_Layout_Label *layout, const char *path, 
 	bool *stop_collecting)
 {
@@ -1509,7 +1508,7 @@
 	*stop_collecting = (result == 'y');
 }
 
-static void
+void
 MR_send_collect_result(void)
 {
 	MR_TRACE_CALL_MERCURY(
diff -u trace-save/mercury_trace_external.h trace/mercury_trace_external.h
--- trace-save/mercury_trace_external.h	Wed May 17 17:52:36 2000
+++ trace/mercury_trace_external.h	Fri Oct 13 17:42:59 2000
@@ -15,10 +15,16 @@
 
 #ifdef	MR_USE_EXTERNAL_DEBUGGER
 
+extern  void	MR_send_message_to_socket(const char *message);
 extern	void	MR_trace_init_external(void);
 extern	void	MR_trace_final_external(void);
 extern	Code   *MR_trace_event_external(MR_Trace_Cmd_Info *cmd,
 			MR_Event_Info *event_info);
+extern void	MR_COLLECT_filter(Unsigned seqno, 
+			Unsigned depth, MR_Trace_Port port, 
+			const MR_Stack_Layout_Label *layout, const char *path, 
+			bool *stop_collecting);
+extern void	MR_send_collect_result(void);
 
 /*
 ** External debugger socket streams.


-- 
R1.


--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list