[m-dev.] For review: make things work with -DUSE_EXTERNAL_DEBUGGER

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Feb 4 08:47:35 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?

> 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.

> 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.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "Binaries may die
WWW: <http://www.cs.mu.oz.au/~fjh>  |   but source code lives forever"
PGP: finger fjh at 128.250.37.3        |     -- leaked Microsoft memo.



More information about the developers mailing list