[m-rev.] for review: handle EXCP nodes in wrong and missing answer diagnosis

Ian MacLarty maclarty at cs.mu.OZ.AU
Thu Jan 6 12:46:11 AEDT 2005


For review by anyone.

Estimated hours taken: 0.5
Branches: main

Include EXCP nodes as wrong and missing answer children, instead of aborting.

browser/declarative_tree.m
	Instead of aborting when an EXCP node is encountered, add it as
	a child for both missing and wrong answer diagnosis.

tests/debugger/declarative/catch.exp
tests/debugger/declarative/catch.inp
	This test doesn't abort with an error message anymore, but
	asks if the caught exception was expected.

	Note that I have not adjusted catch.exp2 since the catch test has been
	failing in the decldebug grade for a different reason, namely because 
	tracing information is not being included in the stack for 
	builtin_catch.

Index: browser/declarative_tree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_tree.m,v
retrieving revision 1.11
diff -u -r1.11 declarative_tree.m
--- browser/declarative_tree.m	16 Dec 2004 00:12:39 -0000	1.11
+++ browser/declarative_tree.m	4 Jan 2005 01:04:18 -0000
@@ -327,11 +327,9 @@
 		throw(internal_error("wrong_answer_children_2",
 			"unexpected start of contour"))
 	;
-		Node = excp(_, _, _, _, _)
-	->
-		throw(unimplemented_feature("code that catches exceptions"))
-	;
-		Node = exit(_, _, _, _, _, _)
+		( Node = exit(_, _, _, _, _, _)
+		; Node = excp(_, _, _, _, _)
+		)
 	->
 			%
 			% Add a child for this node.
@@ -425,12 +423,9 @@
 		throw(internal_error("missing_answer_children_2",
 			"unexpected start of contour"))
 	;
-		Node = excp(_, _, _, _, _)
-	->
-		throw(unimplemented_feature("code that catches exceptions"))
-	;
 		( Node = exit(_, _, _, _, _, _)
 		; Node = fail(_, _, _, _)
+		; Node = excp(_, _, _, _, _)
 		)
 	->
 			%
Index: tests/debugger/declarative/catch.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/catch.exp,v
retrieving revision 1.4
diff -u -r1.4 catch.exp
--- tests/debugger/declarative/catch.exp	16 Dec 2004 00:12:40 -0000	1.4
+++ tests/debugger/declarative/catch.exp	5 Jan 2005 12:38:34 -0000
@@ -17,19 +17,24 @@
 being omitted from the trace.
 p(1, exception(univ_cons("q: bad input")))
 Valid? no
-Sorry, the diagnosis cannot continue because it requires support for
-the following: code that catches exceptions.
-The debugger is a work in progress, and this is not supported in the
-current version.
+Call q(1, _)
+Throws "q: bad input"
+Expected? no
+Found unhandled exception:
+q(1, _)
+"q: bad input"
+Is this a bug? yes
+      E4:     C3 EXCP pred catch.q/2-0 (det) e;c3; catch.m:29
+mdb> continue
 mdb: warning: reached unknown label
 This may result in some exception events
 being omitted from the trace.
       E3:     C2 EXIT pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:9)
 mdb> continue
 exception(univ_cons("q: bad input"))
-      E4:     C3 CALL pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:12)
+      E5:     C4 CALL pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:12)
 mdb> finish
-      E5:     C3 EXIT pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:12)
+      E6:     C4 EXIT pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:12)
 mdb> dd
 p(2, succeeded(2))
 Valid? no
@@ -38,6 +43,6 @@
 Found incorrect contour:
 p(2, succeeded(2))
 Is this a bug? yes
-      E5:     C3 EXIT pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:12)
+      E6:     C4 EXIT pred catch.p/2-0 (cc_multi) catch.m:18 (catch.m:12)
 mdb> continue
 succeeded(2)
Index: tests/debugger/declarative/catch.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/catch.inp,v
retrieving revision 1.1
diff -u -r1.1 catch.inp
--- tests/debugger/declarative/catch.inp	13 Sep 2002 04:17:47 -0000	1.1
+++ tests/debugger/declarative/catch.inp	4 Jan 2005 06:01:09 -0000
@@ -5,6 +5,9 @@
 finish
 dd
 no
+no
+yes
+continue
 continue
 finish
 dd
--------------------------------------------------------------------------
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