For review: make things work with -DUSE_EXTERNAL_DEBUGGER

Erwan Jahier Erwan.Jahier at irisa.fr
Thu Feb 4 06:51:59 AEDT 1999


Estimated hours taken: 2

MR_trace_init_external() and MR_trace_final_external() are defined 
in trace/mercury_trace_external.c but are also needed in
runtime/mercury_trace_base.c. As we can not do direct calls from
runtime/ to trace/, we do an indirect call via a function
pointer address_of_trace_init_external. The rational for this change
is to be able to compile Mercury files with -DUSE_EXTERNAL_DEBUGGER.


runtime/mercury_trace_base.c:
	Remove an out of date comment.

runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
	Add prototype declaration for MR_trace_init_external()
	and MR_trace_final_external().

runtime/mercury_wrapper.h:
util/mkinit.c:
	Remove useless prototypes.

Index: runtime/mercury_init.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_init.h,v
retrieving revision 1.9
diff -u -r1.9 mercury_init.h
--- mercury_init.h	1998/12/06 23:48:41	1.9
+++ mercury_init.h	1999/02/03 17:39:29
@@ -116,6 +116,10 @@
 extern	void	ML_io_print_to_cur_stream(Word, Word);
 extern	void	ML_io_print_to_stream(Word, Word, Word);
 
+/* in trace/mercury_trace_external.h */
+extern	void	MR_trace_init_external(void);
+extern	void	MR_trace_final_external(void);
+
 /* in browser/debugger_interface.h */
 extern	void	ML_DI_output_current_vars(Word, Word, Word);
 		/* output_current_vars/4 */
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.9
diff -u -r1.9 mercury_trace_base.c
--- mercury_trace_base.c	1998/12/09 12:26:30	1.9
+++ mercury_trace_base.c	1999/02/03 17:39:29
@@ -159,7 +159,7 @@
 {
 #ifdef MR_USE_EXTERNAL_DEBUGGER
 	if (MR_trace_handler == MR_TRACE_EXTERNAL)
-		MR_trace_init_external(); /* should be in this module */
+		MR_trace_init_external();
 #endif
 }
 
@@ -168,7 +168,7 @@
 {
 #ifdef MR_USE_EXTERNAL_DEBUGGER
 	if (MR_trace_handler == MR_TRACE_EXTERNAL)
-		MR_trace_final_external(); /* should be in this module */
+		MR_trace_final_external();
 #endif
 }
 
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.30
diff -u -r1.30 mercury_wrapper.c
--- mercury_wrapper.c	1998/12/17 14:57:39	1.30
+++ mercury_wrapper.c	1999/02/03 17:39:29
@@ -133,6 +133,12 @@
 
 void	(*address_of_mercury_init_io)(void);
 void	(*address_of_init_modules)(void);
+
+#ifdef	MR_USE_EXTERNAL_DEBUGGER
+void	(*address_of_trace_init_external)(void);
+void	(*address_of_trace_final_external)(void);
+#endif
+
 #ifdef CONSERVATIVE_GC
 void	(*address_of_init_gc)(void);
 #endif
Index: runtime/mercury_wrapper.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.h,v
retrieving revision 1.16
diff -u -r1.16 mercury_wrapper.h
--- mercury_wrapper.h	1998/12/17 13:37:03	1.16
+++ mercury_wrapper.h	1999/02/03 17:39:29
@@ -61,35 +61,15 @@
 #endif
 
 /*
-** Similarly, these are for the debugger interface; they're defined in
-** browser/debugger_interface.m.
-** XXX These are obsolete; the browser can call the ML_ versions directly.
+** MR_trace_init_external() and MR_trace_final_external() are defined 
+** in trace/mercury_trace_external.c but are called in
+** runtime/mercury_trace_base.c. As we can not do direct calls from
+** runtime/ to trace/, we do an indirect call via a function
+** pointer address_of_trace_init_external.
 */
-extern	void	(*MR_DI_output_current_vars)(Word, Word, Word);
-		/* output_current_vars/3 */
-extern	void	(*MR_DI_output_current_nth_var)(Word, Word);
-		/* output_current_nth_var/2 */
-extern	void	(*MR_DI_output_current_live_var_names)(Word, Word, Word);
-		/* output_current_live_var_names/5 */
-extern	void	(*MR_DI_output_current_slots)(Integer, Integer, Integer, Word,
-		String, String, Integer, Integer, Integer, String, Word);
-		/* output_current_slots/13 */
-extern	bool	(*MR_DI_found_match)(Integer, Integer, Integer, Word, String,
-		String, Integer, Integer, Integer, Word, String, Word);
-		/* found_match/12 */
-extern	int	(*MR_DI_get_var_number)(Word);
-		/* get_var_number/1 */
-extern	void	(*MR_DI_read_request_from_socket)(Word, Word *, Integer *);
-		/* read_request_from_socket/5 */
 
-/*
-** ML_type_name() is defined in library/std_util.m and used in
-** trace/mercury_trace_external.c.
-** XXX This is obsolete; the tracer can call the ML_ version directly.
-*/
-
-extern	String	(*MR_type_name)(Word);
-		/* normally ML_type_name (type_name/1) */ 
+extern	void		(*address_of_trace_init_external)(void);
+extern	void		(*address_of_trace_final_external)(void);
 
 /*
 ** XXX This is obsolete too.
Index: util/mkinit.c
===================================================================
RCS file: /home/mercury1/repository/mercury/util/mkinit.c,v
retrieving revision 1.45
diff -u -r1.45 mkinit.c
--- mkinit.c	1998/12/06 23:49:14	1.45
+++ mkinit.c	1999/02/03 17:39:36
@@ -151,15 +151,8 @@
 	"	MR_io_print_to_cur_stream = ML_io_print_to_cur_stream;\n"
 	"	MR_io_print_to_stream = ML_io_print_to_stream;\n"
 	"#ifdef MR_USE_EXTERNAL_DEBUGGER\n"
-	"	MR_type_name = ML_type_name;\n"
-	"	MR_DI_output_current_vars = ML_DI_output_current_vars;\n"
-  	"	MR_DI_output_current_nth_var = ML_DI_output_current_nth_var;\n"
-	"	MR_DI_output_current_live_var_names = "
-			"ML_DI_output_current_live_var_names;\n"
-	"	MR_DI_output_current_slots = ML_DI_output_current_slots;\n"
-  	"	MR_DI_get_var_number = ML_DI_get_var_number;\n"
-	"	MR_DI_found_match = ML_DI_found_match;\n"
-	"	MR_DI_read_request_from_socket = ML_DI_read_request_from_socket;\n"
+	"	address_of_trace_init_external = MR_trace_init_external;\n"
+	"	address_of_trace_final_external = MR_trace_final_external;\n"
 	"#endif\n"
 	"	MR_trace_func_ptr = %s;\n"
 	"#if defined(USE_GCC_NONLOCAL_GOTOS) && !defined(USE_ASM_LABELS)\n"

-- 
R1.





More information about the developers mailing list