[m-dev.] diff: ignore compiler generated procedures in the declarative debugger

Mark Anthony BROWN dougl at cs.mu.OZ.AU
Thu Jun 22 04:56:22 AEST 2000


Hi,

Estimated hours taken: 1.5

Ignore compiler generated procedures in the declarative debugger
(that is, assume they are correct).

trace/mercury_trace_declarative.c:
	Filter out events from compiler generated procedures, and
	don't allow 'dd' to be used at these events.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/comp_gen.m:
tests/debugger/declarative/comp_gen.inp:
tests/debugger/declarative/comp_gen.exp:
	New test case for these changes.

Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.15
diff -u -r1.15 Mmakefile
--- tests/debugger/declarative/Mmakefile	2000/05/15 20:07:04	1.15
+++ tests/debugger/declarative/Mmakefile	2000/06/21 17:34:25
@@ -23,6 +23,7 @@
 	args			\
 	backtrack		\
 	big			\
+	comp_gen		\
 	filter			\
 	gcf			\
 	if_then_else		\
@@ -87,6 +88,9 @@
 
 big.out: big big.inp
 	$(MDB) ./big < big.inp > big.out 2>&1
+
+comp_gen.out: comp_gen comp_gen.inp
+	$(MDB) ./comp_gen < comp_gen.inp > comp_gen.out 2>&1
 
 family.out: family family.inp
 	$(MDB) ./family < family.inp > family.out 2>&1
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.23
diff -u -r1.23 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	2000/06/14 15:40:07	1.23
+++ trace/mercury_trace_declarative.c	2000/06/21 18:00:49
@@ -333,6 +333,13 @@
 		}
 	}
 
+	if (MR_ENTRY_LAYOUT_COMPILER_GENERATED(entry)) {
+		/*
+		** Filter out events for compiler generated procedures.
+		*/
+		return NULL;
+	}
+
 #ifdef MR_USE_DECL_STACK_SLOT
 	if (entry->MR_sle_maybe_decl_debug < 1) {
 		/*
@@ -1099,6 +1106,13 @@
 		fprintf(MR_mdb_err, "mdb: cannot start declarative debugging, "
 				"because this procedure was not\n"
 				"compiled with execution tracing enabled.\n");
+		return FALSE;
+	}
+
+	if (MR_ENTRY_LAYOUT_COMPILER_GENERATED(entry)) {
+		fflush(MR_mdb_out);
+		fprintf(MR_mdb_err, "mdb: cannot start declarative debugging "
+				"at compiler generated procedures.\n");
 		return FALSE;
 	}


New file tests/debugger/declarative/comp_gen.m:

:- module comp_gen.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.

main -->
	{ data(A, B) },
	(
		{ p(A, B) }
	->
		io__write_string("yes\n")
	;
		io__write_string("no\n")
	).

:- type foo(X) ---> f(X).

:- pred data(foo(int), foo(int)).
:- mode data(out, out) is det.

data(f(1), f(2)).

:- pred p(T, T).
:- mode p(in, in) is semidet.

p(X, X).


New file tests/debugger/declarative/comp_gen.inp:

echo on
register --quiet
break p
continue
step
finish
dd
continue
dd
yes
continue


New file tests/debugger/declarative/comp_gen.exp:

       1:      1  1 CALL pred comp_gen:main/2-0 (det) comp_gen.m:7
mdb> echo on
Command echo enabled.
mdb> register --quiet
mdb> break p
 0: + stop  interface pred comp_gen:p/2-0 (semidet)
mdb> continue
       5:      3  2 CALL pred comp_gen:p/2-0 (semidet) comp_gen.m:27 (comp_gen.m:10)
mdb> step
       6:      4  3 CALL __Unify__ for comp_gen:foo/1-0 (semidet) comp_gen.m:17 (comp_gen.m:27)
mdb> finish
       7:      4  3 FAIL __Unify__ for comp_gen:foo/1-0 (semidet) comp_gen.m:17 (comp_gen.m:27)
mdb> dd
mdb: cannot start declarative debugging at compiler generated procedures.
mdb> continue
       8:      3  2 FAIL pred comp_gen:p/2-0 (semidet) comp_gen.m:27 (comp_gen.m:10)
mdb> dd
Found partially uncovered atom:
p(f(1), f(2))
Is this a bug? yes
       8:      3  2 FAIL pred comp_gen:p/2-0 (semidet) comp_gen.m:27 (comp_gen.m:10)
mdb> continue
no

-- 
Mark Brown, PhD student            )O+  |  "Another of Fortran's breakthroughs
(m.brown at cs.mu.oz.au)                   |  was the GOTO statement, which was...
Dept. of Computer Science and Software  |  uniquely simple and understandable"
Engineering, University of Melbourne    |              -- IEEE, 1994
--------------------------------------------------------------------------
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