[m-dev.] for review: debugger initialization

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Nov 14 00:29:47 AEDT 1998


On 13-Nov-1998, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> + at table @emph
> + at item
> +The file named by the @samp{MERCURY_DEBUGGER_INIT} environment variable.
> +Usually, @samp{mdb} sets this variable to point to a file

If you use `@table', then there should be something following each `@item' --
for `@table @emph', that something gets `@emph'ed.
The syntax for @item in a @table is
	@item <...name of item goes here...> <end-of-line>
	<... stuff goes here ...>

Probably you want to use `@itemize @bullet' rather than `@table @emph'.

> -		/*
> -		** Look for an initialization file in the following places,
> -		** in order:
> -		** 
> -		** - the file named by the MERCURY_DEBUGGER_INIT environment
> -		**   variable, which can be set by the user
> -		**
> -		** - the file .mdbrc in the current directory
> -		**
> -		** - the file .mdbrc in the user's home directory

I think this summary comment was useful; better to modify it to remain
correct rather than just deleting it.

> |static void
> |MR_trace_internal_init_from_env(void)
>  {
>  	char	*init;
>  
> |	init = getenv("MERCURY_DEBUGGER_INIT");
>  	if (init != NULL) {
> |		(void) MR_trace_source(init);
> |		/* If the source failed, the error message has been printed. */
>  	}
>  }

It might be a good idea to issue a warning if MERCURY_DEBUGGER_INIT
is not set.

> +static void
> +MR_trace_internal_init_from_local(void)
>  {
>  	FILE	*fp;
>  
> -	if ((fp = fopen(filename, "r")) != NULL) {
> +	if ((fp = fopen(MDBRC_FILENAME, "r")) != NULL) {
>  		MR_trace_source_from_open_file(fp);
>  		fclose(fp);
> -		return TRUE;
> -	} else {
> -		return FALSE;
>  	}
>  }

Here it really ought to issue a warning message if the reason for the
failure of fopen() is anything other than "file not found" -- for
example, if there is a `.mdbrc' file there, but it is not readable, or
there is an I/O error, or an NFS timeout, etc.  then a warning such as
"mdb: can't open `.mdbrc': permission denied" could be quite helpful.

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