[m-rev.] for review: fix conditional breakpoints bug
Ian MacLarty
maclarty at cs.mu.OZ.AU
Mon Feb 6 17:41:24 AEDT 2006
On 6 Feb 2006, at 03:13, Julien Fischer wrote:
>
> On Sun, 5 Feb 2006, Ian MacLarty wrote:
>
>> For review by anyone.
>>
>> Estimated hours taken: 3
>> Branches: main
>>
>> Fix a bug where subterm dependency tracking would break if a
>> conditional
>> breakpoint was set. When the condition of a conditional breakpoint is
>> evaluated, some Mercury code is called. Conditional breakpoints were
>> being
>> evaluated outside of the "safe" part of the call graph where the call
>> sequence number is saved and restored in case any traced Mercury code
>> updates the call sequence number. This meant that the Mercury code
>> used to
>> evaluate conditional breakpoints was updating the call sequence
>> number and
>> confusing the declarative debugger.
>>
>> This type of error, where Mercury code is called and the original
>> sequence
>> number is not restored afterwards has occured numerous times in the
>> past
>> (for example it occured when Ralph introduced the list command), so I
>> have
>> changed the MR_TRACE_CALL_MERCURY macro to save and restore the event,
>> sequence and depth numbers to prevent this kind of error in the
>> future.
>> Previously the event, sequence and depth numbers were saved in an
>> MR_Event_Details structure at the start of MR_trace_event and
>> restored at
>> the end. The MR_Event_Details structure needed to be passed to all
>> the
>> command functions in case there was a retry (since then the event,
>> sequence
>> and depth numbers must not be restored to their original values, but
>> to new
>> values). This is now all unnecessary, since the event, sequence and
>> depth
>> numbers will be restored after any Mercury code is called (as long as
>> it is
>> wrapped in MR_TRACE_CALL_MERCURY).
>>
>> runtime/mercury_trace_base.h:
>> Save and restore the event, call sequence and depth numbers
>> when calling Mercury code.
>>
>> trace/mercury_trace.c:
>> trace/mercury_trace.h:
>> trace/mercury_trace_declarative.c:
>> trace/mercury_trace_declarative.h:
>> trace/mercury_trace_external.c:
>> trace/mercury_trace_internal.c:
>> trace/mercury_trace_spy.c:
>> trace/mercury_trace_util.c:
>> trace/mercury_trace_util.h:
>> Do not pass around event_details anymore. And remove, now redundant,
>> saving and restoring of the event details before and after calling
>> Mercury code.
>>
>> tests/debugger/declarative/Mmakefile:
>> tests/debugger/declarative/condition_bug.inp:
>> tests/debugger/declarative/condition_bug.m:
>> Test that tracking of subterms works with conditional breakpoints.
>>
>
> ...
>
>> Index: trace/mercury_trace_spy.c
>> ===================================================================
>> RCS file:
>> /home/mercury1/repository/mercury/trace/mercury_trace_spy.c,v
>> retrieving revision 1.25
>> diff -u -r1.25 mercury_trace_spy.c
>> --- trace/mercury_trace_spy.c 11 Jul 2005 07:30:31 -0000 1.25
>> +++ trace/mercury_trace_spy.c 4 Feb 2006 17:16:31 -0000
>> @@ -361,6 +361,12 @@
>> const char *MR_spy_point_cond_problem = NULL;
>> MR_Spy_Cond *MR_spy_point_cond_bad = NULL;
>>
>> +/*
>> +** NOTE: MR_spy_cond_is_true may only be called from within
>> MR_trace_event
>> +** (or one of its decendents), since it calls Mercury code to
>> evaluate the
>
> s/decendents/descendents/
>
Actually I've removed that comment completely, since it's no longer
true. I added that comment before I decided to change
MR_TRACE_CALL_MERCURY.
Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list