[m-dev.] retry through try

Ian MacLarty maclarty at cs.mu.OZ.AU
Tue Dec 14 20:11:10 AEDT 2004


The `retry' command in mdb seems to break when used to retry through a call
to exception.catch_impl when it is deep traced.  

Does builtin_catch do something to the stack that causes retry to break?

Normally this wouldn't be a problem because exception.m isn't normally deep
traced.  However it is in the decldebug grade.  Should it not be deep
traced in the decldebug grade, or is this a bug with builtin_catch or

Below is an mdb session showing the problem and the file the test was run on.


       1:      1  1 CALL pred catch.main/2-0 (cc_multi) catch.m:8
mdb> break catch_impl
Registering debuggable procedures... done.
There are 96 debuggable modules, with a total of 5545 procedures.
Ambiguous procedure specification. The matches are:
0: pred exception.catch_impl/3-5 (nondet)
1: pred exception.catch_impl/3-4 (multi)
2: pred exception.catch_impl/3-3 (cc_nondet)
3: pred exception.catch_impl/3-2 (cc_multi)
4: pred exception.catch_impl/3-1 (semidet)
5: pred exception.catch_impl/3-0 (det)

Which do you want to put a breakpoint on (0-5 or *)? *
 0: + stop  interface pred exception.catch_impl/3-5 (nondet)
 1: + stop  interface pred exception.catch_impl/3-4 (multi)
 2: + stop  interface pred exception.catch_impl/3-3 (cc_nondet)
 3: + stop  interface pred exception.catch_impl/3-2 (cc_multi)
 4: + stop  interface pred exception.catch_impl/3-1 (semidet)
 5: + stop  interface pred exception.catch_impl/3-0 (det)
mdb> c
      10:      7  5 CALL pred exception.catch_impl/3-0 (det) exception.m:707 (exception.m:473)
      11:      8  6 CALL pred exception.IntroducedFrom__pred__try__473__10/3-0 (det) exception.m:473
mdb> retry 1
Mercury runtime: proc layout without exec trace in MR_maybe_record_call_table
Last trace event was event #11.

:- module catch.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is cc_multi.
:- implementation.
:- import_module exception, int.

main -->
	{ p(1, R1) },
	{ p(2, R2) },

:- pred p(int::in, exception_result(int)::out) is cc_multi.

p(N, R) :-
	try(q(N), R).

:- pred q(int::in, int::out) is det.

q(N, M) :-
		N > 1
		M = N
		throw("q: bad input")

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