[m-rev.] for review: fix more debugger problems that broke the nightly builds

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Apr 6 13:53:39 AEST 2006


For review by Zoltan.

Estimated hours taken: 2
Branches: main, release

Fix a problem with the recent debugger changes that broke the 0.13 branch in
nogc grades on jupiter (and would presumably have broken the main branch
tonight).  The problem was that the static global variable
MR_trace_browser_persistent_state_type, defined in mercury_trace_browser.c, is
referred to in the recently added file mercury_trace_cmd_parameter.c.  This
causes a link-time error in the latter.  This only shows up in nogc grades
since in other grades the the references to
MR_trace_browser_persistent_state_type are eliminated by the preprocessor.

Fix some other problems that cause warnings from the C compiler.

trace/mercury_trace_browse.[ch]:
	Export the global MR_trace_browser_persistent_state_type since it is
	now referred to from the module mercury_trace_cmd_parameter.

trace/mercury_trace_cmd_parameter.c:
	#include mercury_trace_browse.h here because this file refers to
	MR_trace_browser_persistent_state_type.

	Call ML_LISTING_listing_type rather than passing its address to
	MR_make_permanent.

	Avoid a C compiler warning on 64-bit architectures about the size of
	int and MR_Integer differing.

trace/mercury_trace_holds_vars.c:
	Avoid C compiler warnings in calls to MR_make_permanent by adding
	casts so that the arguments have the correct type.
	(Again this only shows up in nogc grades since it's all just macros in
	the other grades.)

browser/listing.m:
	Export ML_LISTING_listing_type as a function rather than as a predicate
	since that is how it was being used in the trace directory.

Julien.

(NOTE: this diff is against the 0.13 branch)

Index: browser/listing.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/listing.m,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 listing.m
--- browser/listing.m	4 Apr 2006 07:41:45 -0000	1.4.2.1
+++ browser/listing.m	6 Apr 2006 02:45:13 -0000
@@ -114,10 +114,10 @@
 :- pragma export(list_file(in, in, in, in, in, in, in, di, uo),
     "ML_LISTING_list_file").

-:- pred listing_type(type_desc::out) is det.
-:- pragma export(listing_type(out), "ML_LISTING_listing_type").
+:- func listing_type = type_desc.
+:- pragma export(listing_type = out, "ML_LISTING_listing_type").

-listing_type(type_of(Path)) :-
+listing_type = type_of(Path) :-
     clear_list_path(Path @ [], _).

 %-----------------------------------------------------------------------------%
Index: trace/mercury_trace_browse.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_browse.c,v
retrieving revision 1.38.2.1
diff -u -r1.38.2.1 mercury_trace_browse.c
--- trace/mercury_trace_browse.c	4 Apr 2006 07:42:04 -0000	1.38.2.1
+++ trace/mercury_trace_browse.c	6 Apr 2006 02:55:12 -0000
@@ -41,7 +41,7 @@

 #include <stdio.h>

-static  MR_TypeInfo MR_trace_browser_persistent_state_type;
+MR_TypeInfo         MR_trace_browser_persistent_state_type;

 MR_Word             MR_trace_browser_persistent_state;

Index: trace/mercury_trace_browse.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_browse.h,v
retrieving revision 1.23.2.1
diff -u -r1.23.2.1 mercury_trace_browse.h
--- trace/mercury_trace_browse.h	4 Apr 2006 07:42:04 -0000	1.23.2.1
+++ trace/mercury_trace_browse.h	6 Apr 2006 02:38:59 -0000
@@ -149,6 +149,7 @@
 */

 extern	MR_Word	MR_trace_browser_persistent_state;
+extern  MR_TypeInfo MR_trace_browser_persistent_state_type;

 /*
 ** Initializes the interactive term browser persistent state or does nothing
Index: trace/mercury_trace_cmd_parameter.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_cmd_parameter.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 mercury_trace_cmd_parameter.c
--- trace/mercury_trace_cmd_parameter.c	5 Apr 2006 04:51:18 -0000	1.1.2.2
+++ trace/mercury_trace_cmd_parameter.c	6 Apr 2006 03:45:42 -0000
@@ -26,6 +26,7 @@
 #include "mercury_string.h"

 #include "mercury_trace.h"
+#include "mercury_trace_browse.h"
 #include "mercury_trace_internal.h"
 #include "mercury_trace_cmds.h"
 #include "mercury_trace_cmd_parameter.h"
@@ -468,7 +469,8 @@
         );

         MR_listing_path =
-            MR_make_permanent(MR_listing_path, ML_LISTING_listing_type);
+            MR_make_permanent(MR_listing_path,
+                (MR_TypeInfo) ML_LISTING_listing_type());
     }

     return KEEP_INTERACTING;
@@ -497,7 +499,8 @@
     );

     MR_listing_path =
-        MR_make_permanent(MR_listing_path, ML_LISTING_listing_type);
+        MR_make_permanent(MR_listing_path,
+            (MR_TypeInfo) ML_LISTING_listing_type());

     return KEEP_INTERACTING;
 }
@@ -516,7 +519,8 @@
     );

     MR_listing_path =
-        MR_make_permanent(MR_listing_path, ML_LISTING_listing_type);
+        MR_make_permanent(MR_listing_path,
+            (MR_TypeInfo) ML_LISTING_listing_type());

     return KEEP_INTERACTING;
 }
@@ -577,22 +581,33 @@
 MR_trace_cmd_max_io_actions(char **words, int word_count,
     MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
 {
-    int                 n;
+    int num_io_actions;

-    if (word_count == 2 && MR_trace_is_natural_number(words[1], &n)) {
+    if (word_count == 2 &&
+            MR_trace_is_natural_number(words[1], &num_io_actions)) {
         MR_TRACE_CALL_MERCURY(
-            ML_BROWSE_set_num_io_actions(n,
+            ML_BROWSE_set_num_io_actions(num_io_actions,
                 MR_trace_browser_persistent_state,
                 &MR_trace_browser_persistent_state);
         );
     } else if (word_count == 1) {
+
+        MR_Integer n;
+
         MR_TRACE_CALL_MERCURY(
             ML_BROWSE_get_num_io_actions(
                 MR_trace_browser_persistent_state, &n);
         );
+
+        /*
+        ** We do this to avoid warnings about MR_Integer and int
+        ** having different sizes on 64-bit architectures.
+        */
+        num_io_actions = (int) n;
+
         fprintf(MR_mdb_out,
             "The maximum number of I/O actions printed is %d\n",
-            n);
+            num_io_actions);
     } else {
         MR_trace_usage_cur_cmd();
     }
Index: trace/mercury_trace_hold_vars.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_hold_vars.c,v
retrieving revision 1.1
diff -u -r1.1 mercury_trace_hold_vars.c
--- trace/mercury_trace_hold_vars.c	11 Jul 2005 07:30:30 -0000	1.1
+++ trace/mercury_trace_hold_vars.c	6 Apr 2006 03:33:46 -0000
@@ -46,8 +46,8 @@
     MR_prepare_insert_into_sorted(MR_held_vars, MR_held_var_next, slot,
         strcmp(MR_held_vars[slot].MR_held_name, name));
     MR_held_vars[slot].MR_held_name = strdup(name);
-    MR_held_vars[slot].MR_held_type = (MR_TypeInfo) MR_make_permanent(typeinfo,
-        typeinfo_type_word);
+    MR_held_vars[slot].MR_held_type = (MR_TypeInfo) MR_make_permanent(
+        (MR_Word) typeinfo, (MR_TypeInfo) typeinfo_type_word);
     MR_held_vars[slot].MR_held_value = MR_make_permanent(value, typeinfo);

     return MR_TRUE;
--------------------------------------------------------------------------
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