[m-dev.] For review: make things work with -DUSE_EXTERNAL_DEBUGGER
Erwan Jahier
Erwan.Jahier at irisa.fr
Thu Feb 4 19:08:01 AEDT 1999
| On 03-Feb-1999, Erwan Jahier <Erwan.Jahier at irisa.fr> wrote:
| > 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.
|
| Where's the code that actually does the indirect call?
In runtime/mercury_trace_base.c, just as you pointed out.
|
| > 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
| > }
|
| I think they need to be changed to indirect calls.
OK.
(both are working; did I miss some warnings?)
|
| > 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
|
| All new symbols added should start with the `MR_' prefix.
OK.
Here is a relative diff:
Index: runtime/mercury_trace_base.c
--- 0.2/runtime/mercury_trace_base.c Thu, 04 Feb 1999 08:59:09 +0100 jahier (submitdiff/0_mercury_tr 1.2 640)
+++ 0.2(w)/runtime/mercury_trace_base.c Thu, 04 Feb 1999 09:00:29 +0100 jahier (submitdiff/0_mercury_tr 1.2 640)
@@ -159,7 +159,7 @@
{
#ifdef MR_USE_EXTERNAL_DEBUGGER
if (MR_trace_handler == MR_TRACE_EXTERNAL)
- MR_trace_init_external();
+ MR_address_of_trace_init_external();
#endif
}
@@ -168,7 +168,7 @@
{
#ifdef MR_USE_EXTERNAL_DEBUGGER
if (MR_trace_handler == MR_TRACE_EXTERNAL)
- MR_trace_final_external();
+ MR_address_of_trace_final_external();
#endif
}
Index: runtime/mercury_wrapper.c
--- 0.2/runtime/mercury_wrapper.c Thu, 04 Feb 1999 08:59:09 +0100 jahier (submitdiff/2_mercury_wr 1.2 640)
+++ 0.2(w)/runtime/mercury_wrapper.c Thu, 04 Feb 1999 08:59:32 +0100 jahier (submitdiff/2_mercury_wr 1.2 640)
@@ -135,8 +135,8 @@
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);
+void (*MR_address_of_trace_init_external)(void);
+void (*MR_address_of_trace_final_external)(void);
#endif
#ifdef CONSERVATIVE_GC
Index: runtime/mercury_wrapper.h
--- 0.2/runtime/mercury_wrapper.h Thu, 04 Feb 1999 08:59:09 +0100 jahier (submitdiff/3_mercury_wr 1.2 640)
+++ 0.2(w)/runtime/mercury_wrapper.h Thu, 04 Feb 1999 09:00:08 +0100 jahier (submitdiff/3_mercury_wr 1.2 640)
@@ -65,11 +65,11 @@
** 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.
+** pointer MR_address_of_trace_init_external.
*/
-extern void (*address_of_trace_init_external)(void);
-extern void (*address_of_trace_final_external)(void);
+extern void (*MR_address_of_trace_init_external)(void);
+extern void (*MR_address_of_trace_final_external)(void);
/*
** XXX This is obsolete too.
Index: util/mkinit.c
--- 0.2/util/mkinit.c Thu, 04 Feb 1999 08:59:09 +0100 jahier (submitdiff/4_mkinit.c 1.2 640)
+++ 0.2(w)/util/mkinit.c Thu, 04 Feb 1999 08:59:16 +0100 jahier (submitdiff/4_mkinit.c 1.2 640)
@@ -151,8 +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"
- " address_of_trace_init_external = MR_trace_init_external;\n"
- " address_of_trace_final_external = MR_trace_final_external;\n"
+ " MR_address_of_trace_init_external = MR_trace_init_external;\n"
+ " MR_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