[m-rev.] for review: when resuming dd session don't always set search mode

Ian MacLarty maclarty at cs.mu.OZ.AU
Sat Apr 30 21:56:47 AEST 2005


For review by anyone.

Estimated hours taken: 1
Branches: main

When resuming a declarative debugging session set the search mode only
if it is explicitly given as an option.

tests/debugger/declarative/resume.exp:
tests/debugger/declarative/resume.inp:
	Test the above.

trace/mercury_trace_declarative.c:
	Wrap calls to mercury code in MR_TRACE_CALL_MERCURY.
	
trace/mercury_trace_internal.c:
	Set the search_mode of the analyser if it is a new session or
	the search mode is explicitly given.

Index: tests/debugger/declarative/resume.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/resume.exp,v
retrieving revision 1.1
diff -u -r1.1 resume.exp
--- tests/debugger/declarative/resume.exp	2 Mar 2005 01:20:21 -0000	1.1
+++ tests/debugger/declarative/resume.exp	30 Apr 2005 11:46:47 -0000
@@ -192,19 +192,21 @@
  0: + stop  interface pred resume.wrapper/6-0 (semidet)
 mdb> c
       E5:     C4 EXIT pred resume.wrapper/6-0 (semidet)
-mdb> dd -r
+mdb> dd -r -s divide_and_query
 l([26, 27, 28, 29, 30]) = 30
 Valid? n
-l([27, 28, 29, 30]) = 30
-Valid? n
-l([28, 29, 30]) = 30
-Valid? n
 l([29, 30]) = 30
-Valid? n
-l([30]) = 30
-Valid? n
-Found incorrect contour:
-l([30]) = 30
-Is this a bug? y
-     E23:    C16 EXIT func resume.l/1-0 (semidet)
+Valid? a
+Diagnosis aborted.
+      E5:     C4 EXIT pred resume.wrapper/6-0 (semidet)
+mdb> dd -r
+l([29, 30]) = 30
+Valid? a
+Diagnosis aborted.
+      E5:     C4 EXIT pred resume.wrapper/6-0 (semidet)
+mdb> dd -rs top_down
+l([27, 28, 29, 30]) = 30
+Valid? a
+Diagnosis aborted.
+      E5:     C4 EXIT pred resume.wrapper/6-0 (semidet)
 mdb> quit -y
Index: tests/debugger/declarative/resume.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/resume.inp,v
retrieving revision 1.1
diff -u -r1.1 resume.inp
--- tests/debugger/declarative/resume.inp	2 Mar 2005 01:20:22 -0000	1.1
+++ tests/debugger/declarative/resume.inp	30 Apr 2005 11:45:08 -0000
@@ -90,11 +90,11 @@
 delete *
 break wrapper
 c
-dd -r
-n
-n
+dd -r -s divide_and_query
 n
-n
-n
-y
+a
+dd -r
+a
+dd -rs top_down
+a
 quit -y
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.85
diff -u -r1.85 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	13 Apr 2005 03:50:55 -0000	1.85
+++ trace/mercury_trace_declarative.c	30 Apr 2005 11:37:09 -0000
@@ -1367,17 +1367,21 @@
 MR_trace_is_valid_search_mode_string(const char *search_mode_string,
 	MR_Decl_Search_Mode *search_mode)
 {
-	if (MR_streq(search_mode_string, "top_down")) {
-		*search_mode =
-			MR_DD_decl_top_down_search_mode();
-		return MR_TRUE;
-	} else if (MR_streq(search_mode_string, "divide_and_query")) {
-		*search_mode =
-			MR_DD_decl_divide_and_query_search_mode();
-		return MR_TRUE;
-	} else {
-		return MR_FALSE;
-	}
+	MR_bool	is_valid;
+	
+	MR_TRACE_CALL_MERCURY(
+		if (MR_streq(search_mode_string, "top_down")) {
+			*search_mode = MR_DD_decl_top_down_search_mode();
+			is_valid = MR_TRUE;
+		} else if (MR_streq(search_mode_string, "divide_and_query")) {
+			*search_mode = 
+				MR_DD_decl_divide_and_query_search_mode();
+			is_valid = MR_TRUE;
+		} else {
+			is_valid = MR_FALSE;
+		}
+	);
+	return is_valid;
 }
 
 MR_Decl_Search_Mode
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.202
diff -u -r1.202 mercury_trace_internal.c
--- trace/mercury_trace_internal.c	29 Apr 2005 01:03:29 -0000	1.202
+++ trace/mercury_trace_internal.c	30 Apr 2005 11:43:38 -0000
@@ -5658,7 +5658,7 @@
 
     MR_trace_decl_assume_all_io_is_tabled = MR_FALSE;
     MR_edt_depth_step_size = MR_TRACE_DECL_INITIAL_DEPTH;
-    search_mode = MR_trace_get_default_search_mode();
+    search_mode = (MR_Word) -1;
     MR_trace_decl_in_dd_dd_mode = MR_FALSE;
 
     if (! MR_trace_options_dd(&MR_trace_decl_assume_all_io_is_tabled,
@@ -5673,9 +5673,12 @@
                 "mdb: dd doesn't work after `unhide_events on'.\n");
             return KEEP_INTERACTING;
         }
-
-        MR_trace_decl_set_fallback_search_mode(search_mode);
-
+        if (search_mode != (MR_Word) -1) {
+            MR_trace_decl_set_fallback_search_mode(search_mode);
+        } else if (new_session) {
+            MR_trace_decl_set_fallback_search_mode(
+                MR_trace_get_default_search_mode());
+        }
         if (MR_trace_start_decl_debug(MR_TRACE_DECL_DEBUG,
             NULL, new_session, cmd, event_info, event_details, jumpaddr))
         {
@@ -5700,7 +5703,7 @@
 
     MR_trace_decl_assume_all_io_is_tabled = MR_FALSE;
     MR_edt_depth_step_size = MR_TRACE_DECL_INITIAL_DEPTH;
-    search_mode = MR_trace_get_default_search_mode();
+    search_mode = (MR_Word) -1;
     MR_trace_decl_in_dd_dd_mode = MR_TRUE;
 
     if (! MR_trace_options_dd(&MR_trace_decl_assume_all_io_is_tabled,
@@ -5716,9 +5719,12 @@
             trace_mode = MR_TRACE_DECL_DEBUG;
             filename = (const char *) NULL;
         }
-
-        MR_trace_decl_set_fallback_search_mode(search_mode);
-
+        if (search_mode != (MR_Word) -1) {
+            MR_trace_decl_set_fallback_search_mode(search_mode);
+        } else if (new_session) {
+            MR_trace_decl_set_fallback_search_mode(
+                MR_trace_get_default_search_mode());
+        }
         if (MR_trace_start_decl_debug(trace_mode, filename,
             new_session, cmd, event_info, event_details, jumpaddr))
         {
--------------------------------------------------------------------------
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