[m-dev.] for review: improved low-level debugging messages
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed Mar 17 09:25:33 AEDT 1999
> > incr_hp_debug_msg(Word val, const Word *addr)
> > {
> > #ifdef CONSERVATIVE_GC
> > - printf("allocated %ld words at 0x%p\n", (long) (Integer) val, addr);
> > + printf("allocated %ld words at %p\n", (long) (Integer) val, addr);
>
> Both the old code and the new code are buggy, because there is no guarantee
> that (long) is the same size as `void *'.
You seem to be confused. The cast is on the size of the new cell, not
the pointer.
> > for (i = 1; &MR_based_framevar(fr,i) > MR_prevfr_slot(fr); i++) {
> > - printf("\t framevar(%d) %ld 0x%lx\n",
> > + printf("\t framevar(%d) %ld %lx\n",
> > i, (long) (Integer) MR_based_framevar(fr,i),
> > (unsigned long) MR_based_framevar(fr,i));
> > }
>
> What's the rationale for this change?
> The log message says
>
> Improve the facilities for printing pointers into the det and nondet
> stacks for diagnostic purposes.
>
> but why is removing the "0x" here an improvement?
I was removing the 0x from in front of %p, since the platforms we are using
now, unlike the SGIs, print the 0x for %p, and I don't want to look at
addresses that start with 0x0x. The change above was overzealous removal of
0xs; I will undo it.
> > +print_detstackptr(FILE *fp, const Word *s)
>
> These new functions should get an `MR_' prefix.
>
> > +++ mercury_misc.h 1999/03/16 01:19:16
> > +extern void printdetstack(const Word *s);
> > +extern void printdetstackptr(const Word *s);
> > +extern void print_detstackptr(FILE *fp, const Word *s);
> > +extern void printnondstack(const Word *s);
> > +extern void printnondstackptr(const Word *s);
> > +extern void print_nondstackptr(FILE *fp, const Word *s);
>
> Likewise.
Ah, but some of those are not new functions; their declarations have
just been grouped together.
I will add the prefix for the new functions. The old ones require changes
elsewhere, which will probably conflict with Tyson's changes in progress,
so I will add the prefix for them later. We should have a great renaming
of everything in the runtime anyway.
Zoltan.
More information about the developers
mailing list