Files
mercury/tests/debugger/exception_value.m
Mark Brown 8cfbaedc5a Allow the value of an exception to be printed and browsed
Estimated hours taken: 5

Allow the value of an exception to be printed and browsed
at EXCP events in the internal debugger.  Two new commands
are added to the debugger:

	print exception
	browse exception

trace/mercury_trace_internal.c:
	Implement the new commands.

runtime/mercury_trace_base.c:
runtime/mercury_trace_base.h:
	Export functions to get/set a global which stores the
	value of an exception for the internal debugger to refer to.

library/exception.m:
	Set the exception value before generating EXCP events.

doc/user_guide.texi:
	Document the new debugger commands.

tests/debugger/Mmakefile:
tests/debugger/exception_value.m:
tests/debugger/exception_value.inp:
tests/debugger/exception_value.exp:
tests/debugger/exception_value.exp2:
	Add a test case.
2000-06-19 07:59:28 +00:00

38 lines
575 B
Mathematica

:- module exception_value.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is cc_multi.
:- implementation.
:- import_module std_util, exception, list.
main -->
{ test1(Res1) },
print(Res1),
io__nl,
{ test2(Res2) },
print(Res2),
io__nl.
:- pred test1(exception_result(int)::out) is cc_multi.
test1(Res) :-
try(p, Res).
:- pred test2(exception_result(int)::out) is cc_multi.
test2(Res) :-
try(q, Res).
:- pred p(int::out) is det.
p(_) :-
throw("p exception").
:- pred q(int::out) is det.
q(_) :-
throw("q oops" - [1, 2, 3]).