[m-dev.] for review: a big step towards the trace-based debugger (part 3 of 3)
Tyson Dowd
trd at stimpy.cs.mu.oz.au
Wed Apr 1 15:00:39 AEST 1998
On 01-Apr-1998, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
>
> > On 20-Mar-1998, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> > > + ** If any code invoked by MR_trace is itself traced,
> > > + ** MR_saved_regs will be overwritten, leading to a crash later on.
> > > + ** This is one reason (but not the only one) why we turn off
> > > + ** tracing when we call back Mercury code from this file.
> > > + */
> >
> > What are the other reasons? They aren't specified up with the
> > documentation near MR_trace_enabled (or whatever it's called).
>
> I would have thought it was obvious. When you print the values of the
> variables at a point in your program, you don't want to see
>
> mtrace> 456 123 io__print CALL DET
>
> at nauseam interspersed with the values you want to look at. (Tyson: d'oh!)
D'oh! No, really, I knew about that one, but I was wondering whether
there were more insidious reasons like the saved registers being squashed
reason.
I guess what I am getting at is "Is this the ONLY reason we couldn't
debug the execution of code the debugger uses?" (apart from actually
falling into an infinite loop) or are there others.
> > Please make sure this change doesn't break stack traces before commiting.
>
> Do you have a test case for this?
Not in "tests", because there isn't a "stack tracing grade".
Here's a test you can use -- the exact stack trace depends on
optimization options of course.
:- module map_error.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- pred create_map_error(io__state::di, io__state::uo) is det.
:- pred do_call_this(io__state::di, io__state::uo) is det.
:- import_module map, list, string, std_util.
main -->
do_call_this,
write_string("Done\n").
:- pragma no_inline(create_map_error/2).
:- pragma no_inline(do_call_this/2).
create_map_error -->
{ map__init(NewMap) },
{ map__det_insert_from_corresponding_lists(NewMap, [1,2,3,4,5],
["happy", "sad", "miserable", "joyful", "dead"],
NewMap1) },
{ map__det_insert_from_corresponding_lists(NewMap1, [1],
["duplicate"], NewMap3) },
write(NewMap3).
do_call_this -->
write_string("Getting ready"),
create_map_error,
write_string("Done calling.\n").
--
Tyson Dowd # So I asked Sarah: what's the serial number on
# your computer? She replied:
trd at cs.mu.oz.au # A-C-2-4-0-V-/-5-0-H-Z
http://www.cs.mu.oz.au/~trd #
More information about the developers
mailing list