[m-rev.] for review: fix some decldebug test case failures

Zoltan Somogyi zs at csse.unimelb.edu.au
Tue Dec 5 16:58:53 AEDT 2006


This is pending bootcheck.

The remaining bug in condition_bug seems worth fixing only after the
polymorphism transformation has had its premature optimization undone.

Zoltan.

Fix some test case failures in decldebug grades.

tests/debugger/declarative/loopcheck.exp3:
	Expect a different number of events after recent changes to io.m.

tests/debugger/declarative/condition_bug.{m,inp,exp}:
	Update this test case for recent changes to term_to_xml.m.

	Document the remaining bug that causes this test case to still fail.

tests/EXPECT_FAIL_TESTS.all_grades:
	For now, expect the condition_bug test case to fail for grades that
	execute it.

runtime/mercury_type_info.[ch]:
	Add a utility function to print the type represented by a type_info.

trace/mercury_trace_vars.c:
	Use the new utility function to print the type of each variable when
	the var_details command is given. This is how I tracked down the
	remaining bug in the condition_bug test case.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/log4m
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/mopenssl
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/stream/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_type_info.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_type_info.c,v
retrieving revision 1.62
diff -u -b -r1.62 mercury_type_info.c
--- runtime/mercury_type_info.c	1 Sep 2005 07:36:28 -0000	1.62
+++ runtime/mercury_type_info.c	5 Dec 2006 04:59:08 -0000
@@ -897,3 +897,40 @@
     /* not reached */
     return 0;
 }
+
+/*---------------------------------------------------------------------------*/
+
+void
+MR_print_type(FILE *fp, MR_TypeInfo type_info)
+{
+    MR_TypeCtorInfo tci;
+    MR_TypeInfo     *arg_vector;
+    int             arity;
+    int             i;
+
+    tci = MR_TYPEINFO_GET_TYPE_CTOR_INFO(type_info);
+    if (MR_type_ctor_has_variable_arity(tci)) {
+        arity = MR_TYPEINFO_GET_VAR_ARITY_ARITY(type_info);
+        arg_vector = MR_TYPEINFO_GET_VAR_ARITY_ARG_VECTOR(type_info);
+    } else {
+        arity = tci->MR_type_ctor_arity;
+        arg_vector = MR_TYPEINFO_GET_FIXED_ARITY_ARG_VECTOR(type_info);
+    }
+
+    fprintf(fp, "%s.%s",
+        tci->MR_type_ctor_module_name, tci->MR_type_ctor_name);
+    if (arity > 0) {
+        fprintf(fp, "(");
+
+        for (i = 1; i <= arity; i++) {
+            MR_print_type(fp, arg_vector[i]);
+            if (i < arity) {
+                fprintf(fp, ", ");
+            }
+        }
+
+        fprintf(fp, ")");
+    }
+}
+
+/*---------------------------------------------------------------------------*/
Index: runtime/mercury_type_info.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.120
diff -u -b -r1.120 mercury_type_info.h
--- runtime/mercury_type_info.h	8 Jun 2006 08:20:02 -0000	1.120
+++ runtime/mercury_type_info.h	5 Dec 2006 04:54:58 -0000
@@ -60,6 +60,7 @@
 #include "mercury_types.h"  /* for `MR_Word' */
 #include "mercury_tags.h"   /* for `MR_DEFINE_BUILTIN_ENUM_CONST' */
 #include "mercury_hlc_types.h" /* for `MR_Mercury_Type_Info' */
+#include <stdio.h>              /* for FILE */
 
 /*---------------------------------------------------------------------------*/
 
@@ -1858,6 +1859,15 @@
                         int arity, MR_TypeInfoParams type_params,
                         const MR_PseudoTypeInfo *arg_pseudo_type_infos);
 
+/*
+** MR_print_type:
+**
+** Print a representation of the type represented by the given typeinfo to the
+** given file.
+*/
+
+extern  void        MR_print_type(FILE *fp, MR_TypeInfo type_info);
+
 /*---------------------------------------------------------------------------*/
 
 #endif /* not MERCURY_TYPE_INFO_H */
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing tests
Index: tests/EXPECT_FAIL_TESTS.all_grades
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/EXPECT_FAIL_TESTS.all_grades,v
retrieving revision 1.1
diff -u -b -r1.1 EXPECT_FAIL_TESTS.all_grades
--- tests/EXPECT_FAIL_TESTS.all_grades	3 Jun 2005 07:04:30 -0000	1.1
+++ tests/EXPECT_FAIL_TESTS.all_grades	5 Dec 2006 05:48:31 -0000
@@ -1,2 +1,3 @@
+debugger/declarative/condition_bug
 valid/constraint_prop_bug
 valid/ho_and_type_spec_bug
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
Index: tests/debugger/loopcheck.exp3
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/loopcheck.exp3,v
retrieving revision 1.6
diff -u -b -r1.6 loopcheck.exp3
--- tests/debugger/loopcheck.exp3	12 May 2006 05:04:32 -0000	1.6
+++ tests/debugger/loopcheck.exp3	4 Dec 2006 19:51:18 -0000
@@ -22,5 +22,5 @@
 mdb> continue
 Uncaught Mercury exception:
 Software Error: detected infinite recursion in pred loopcheck.loop/1
-Last trace event was event #310.
+Last trace event was event #318.
 Last trace event before the unhandled exception was event #8.
cvs diff: Diffing tests/debugger/declarative
Index: tests/debugger/declarative/condition_bug.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/declarative/condition_bug.exp,v
retrieving revision 1.4
diff -u -b -r1.4 condition_bug.exp
--- tests/debugger/declarative/condition_bug.exp	27 Jun 2006 04:09:02 -0000	1.4
+++ tests/debugger/declarative/condition_bug.exp	5 Dec 2006 05:49:53 -0000
@@ -4,23 +4,23 @@
 mdb> untrust 0
 mdb> table_io start
 I/O tabling started.
-mdb> break io.write_string/3
- 0: + stop  interface pred io.write_string/3-0 (det)
+mdb> break io.write_string/4
+ 0: + stop  interface pred io.write_string/4-0 (det)
 mdb> condition Message = "english"
- 0: + stop  interface pred io.write_string/3-0 (det)
+ 0: + stop  interface pred io.write_string/4-0 (det)
             Message = "english"
 mdb> continue
 <?xml version="1.0"?>
 <translations>
 	<word>
-		<      E2:     C2 CALL pred io.write_string/3-0 (det) io.m:NNNN (term_to_xml.m:NNNN)
+		<      E2:     C2 CALL pred io.write_string/4-0 (det) io.m:NNNN (term_to_xml.m:NNNN)
 mdb> finish
-english      E3:     C2 EXIT pred io.write_string/3-0 (det) io.m:NNNN (term_to_xml.m:NNNN)
+english      E3:     C2 EXIT pred io.write_string/4-0 (det) io.m:NNNN (term_to_xml.m:NNNN)
 mdb> dd
 write_string("english", _, _)
 1 tabled IO action:
 write_string("english")
-Valid? browse 1
+Valid? browse 2
 browser> track
 >critical</english>
 		<dutch>kritiek</dutch>
Index: tests/debugger/declarative/condition_bug.inp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/declarative/condition_bug.inp,v
retrieving revision 1.1
diff -u -b -r1.1 condition_bug.inp
--- tests/debugger/declarative/condition_bug.inp	8 Feb 2006 21:54:31 -0000	1.1
+++ tests/debugger/declarative/condition_bug.inp	5 Dec 2006 04:08:35 -0000
@@ -2,12 +2,12 @@
 echo on
 untrust 0
 table_io start
-break io.write_string/3
+break io.write_string/4
 condition Message = "english"
 continue
 finish
 dd
-browse 1
+browse 2
 track
 info
 quit
Index: tests/debugger/declarative/condition_bug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/declarative/condition_bug.m,v
retrieving revision 1.2
diff -u -b -r1.2 condition_bug.m
--- tests/debugger/declarative/condition_bug.m	30 Mar 2006 04:44:59 -0000	1.2
+++ tests/debugger/declarative/condition_bug.m	5 Dec 2006 05:40:39 -0000
@@ -41,3 +41,21 @@
 		elem("english", [], [data(English)]),
 	 	elem("dutch", [], [data(Dutch)])])
 	| translation_pairs_to_xml(Rest)].
+
+% This test case currently does not work. The symptom is an abort from the
+% declarative debugger with a message about not being to perform a retry
+% because the value of an input argument is missing. This arises at a call
+% to list/foldl/4 with mode di/uo for the accumulator pair. The debugger
+% erroneously believes the accumulator at that call to be a string, when in
+% fact it is an I/O state.
+%
+% The problem arises at the call to write_xml_doc/4 in write_xml_doc/3.
+% The arity 3 version of this predicate has an I/O state pair as its last two
+% arguments, whereas the arity 4 has the signature
+%
+% :- pred write_xml_doc(Stream::in, T::in, State::di, State::uo)
+%   is det <= (xmlable(T), stream.writer(Stream, string, State)).
+%
+% It seems the debugger is picking the typeinfo for string out of the second
+% typeclass_info instead of the typeinfo for State, and thus it shows the type
+% of the third argument of write_xml_doc/4 as string, not I/O state.
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace_vars.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_vars.c,v
retrieving revision 1.72
diff -u -b -r1.72 mercury_trace_vars.c
--- trace/mercury_trace_vars.c	5 Dec 2006 03:51:22 -0000	1.72
+++ trace/mercury_trace_vars.c	5 Dec 2006 05:00:23 -0000
@@ -824,6 +824,9 @@
 
         fprintf(out, "typeinfo %p, value %" MR_INTEGER_LENGTH_MODIFIER "x\n",
             value->MR_value_type, value->MR_value_value);
+        fprintf(out, "type is ");
+        MR_print_type(out, value->MR_value_type);
+        fprintf(out, "\n");
     }
 
     return NULL;
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list