[m-dev.] for review: sorting variables better in the debugger
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu May 27 19:01:14 AEST 1999
On 26-May-1999, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
>
> +++ mercury_trace_vars.c Tue May 25 19:46:56 1999
...
> +typedef struct {
> + char *MR_var_fullname;
> + char *MR_var_basename;
> + char *MR_var_basename_malloc;
> + int MR_var_num_suffix;
> + bool MR_var_has_suffix;
> + bool MR_var_is_headvar;
> + bool MR_var_is_ambiguous;
> + int MR_var_hlds_number;
> + Word MR_var_value;
> + Word MR_var_type;
> +} MR_Var_Details;
> +
> +typedef struct {
> + const MR_Stack_Layout_Label *MR_point_top_layout;
> + Word *MR_point_top_saved_regs;
> + const char *MR_point_problem;
> + int MR_point_level;
> + const MR_Stack_Layout_Entry *MR_point_level_entry;
> + Word *MR_point_level_base_sp;
> + Word *MR_point_level_base_curfr;
> + int MR_point_var_count;
> + int MR_point_var_max;
> + MR_Var_Details *MR_point_vars;
> +} MR_Point;
I think it would be very helpful to have some comments here
explaining what these data types are for.
Also the meaning of many of the fields is unclear.
What's `MR_var_basename_malloc' supposed to be?
For stylistic reasons I would put MR_var_type before MR_var_value.
> + copy = strdup(name);
strdup() is not a standard ANSI/ISO C function.
So if you want to use it, then you need to use autoconf.
Since strdup() is so simple, it's probably easier to just
define our own MR_strdup().
> +static int
> +MR_trace_compare_var_details(const void *arg1, const void *arg2)
> +{
It would be helpful to have some comments with this function
explaining the rationale for the particular ordering relation
chosen.
> mercury_vars.h:
> +/*
> +** Print the list of the names and values of all variables live at the current
> +** point. The variables names are printed directly to the given file; the
> +** variable values are printed by calling the given browser function on them.
> +*/
> +
> +extern const char *MR_trace_browse_all(FILE *out, FILE *err,
> + MR_Browser browser);
Are `out' and `err' allowed to be NULL here?
Is `browser' allowed to be NULL?
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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