[m-rev.] diff: workaround problem causing debugger seg faults

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Oct 1 12:05:20 AEST 2007


XXX This is a workaround rather than a proper fix for the problem.
Zoltan, we should discuss this next time you are in.

Estimated hours taken: 1
Branches: main

Workaround a problem that was causing the debugger to seg fault on 64-bit
machines.

trace/mercury_trace_util.[ch]:
 	Back out the change that made the type of the second argument of
 	MR_trace_is_natural_number() MR_Unsigned rather than int.
 	At the moment this causes problems on 64-bit machines
 	(where sizeof(MR_Unsigned) != sizeof(int)), because much of the
 	code in the trace directory still uses ints to represent unsigned
 	values.

trace/mercury_trace_cmd_browsing.c:
 	Call MR_trace_is_unsigned() instead of MR_trace_is_natural_number()
 	in a spot.

 	Fix some cut-and-paste errors: several calls to fprintf() had
 	more arguments than their format strings had conversion specifiers.

Julien.

Index: trace/mercury_trace_cmd_browsing.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_cmd_browsing.c,v
retrieving revision 1.8
diff -u -r1.8 mercury_trace_cmd_browsing.c
--- trace/mercury_trace_cmd_browsing.c	27 Sep 2007 07:28:28 -0000	1.8
+++ trace/mercury_trace_cmd_browsing.c	1 Oct 2007 01:57:45 -0000
@@ -227,16 +227,14 @@
              if (MR_io_tabling_phase == MR_IO_TABLING_BEFORE) {
                  fflush(MR_mdb_out);
                  fprintf(MR_mdb_err,
-                    "mdb: I/O tabling has not yet started.\n",
-                    MR_io_tabling_start, MR_io_tabling_counter_hwm);
+                    "mdb: I/O tabling has not yet started.\n");
                  return KEEP_INTERACTING;
              }

              if (MR_io_tabling_counter_hwm == 0) {
                  fflush(MR_mdb_out);
                  fprintf(MR_mdb_err,
-                    "mdb: There are no tabled I/O actions yet.\n",
-                    MR_io_tabling_start, MR_io_tabling_counter_hwm);
+                    "mdb: There are no tabled I/O actions yet.\n");
                  return KEEP_INTERACTING;
              }

@@ -306,16 +304,14 @@
          if (MR_io_tabling_phase == MR_IO_TABLING_BEFORE) {
              fflush(MR_mdb_out);
              fprintf(MR_mdb_err,
-                "mdb: I/O tabling has not yet started.\n",
-                MR_io_tabling_start, MR_io_tabling_counter_hwm);
+                "mdb: I/O tabling has not yet started.\n");
              return KEEP_INTERACTING;
          }

          if (MR_io_tabling_counter_hwm == 0) {
              fflush(MR_mdb_out);
              fprintf(MR_mdb_err,
-                "mdb: There are no tabled I/O actions yet.\n",
-                MR_io_tabling_start, MR_io_tabling_counter_hwm);
+                "mdb: There are no tabled I/O actions yet.\n");
              return KEEP_INTERACTING;
          }

@@ -326,7 +322,7 @@
                  "%" MR_INTEGER_LENGTH_MODIFIER "u.\n",
                  MR_io_tabling_start, MR_io_tabling_counter_hwm - 1);
              fflush(MR_mdb_out);
-        } else if (MR_trace_is_natural_number(words[2], &action)) {
+        } else if (MR_trace_is_unsigned(words[2], &action)) {
              problem = MR_trace_browse_action(MR_mdb_out, action,
                  MR_trace_browse_goal_internal,
                  MR_BROWSE_CALLER_PRINT, format);
Index: trace/mercury_trace_util.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_util.c,v
retrieving revision 1.23
diff -u -r1.23 mercury_trace_util.c
--- trace/mercury_trace_util.c	27 Sep 2007 07:28:29 -0000	1.23
+++ trace/mercury_trace_util.c	1 Oct 2007 01:45:53 -0000
@@ -29,7 +29,7 @@
  }

  MR_bool
-MR_trace_is_natural_number(const char *word, MR_Unsigned *value)
+MR_trace_is_natural_number(const char *word, int *value)
  {
      if (word != NULL && MR_isdigit(*word)) {
          *value = *word - '0';
Index: trace/mercury_trace_util.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_util.h,v
retrieving revision 1.19
diff -u -r1.19 mercury_trace_util.h
--- trace/mercury_trace_util.h	27 Sep 2007 07:28:29 -0000	1.19
+++ trace/mercury_trace_util.h	1 Oct 2007 01:46:23 -0000
@@ -56,7 +56,7 @@
  */

  extern  MR_bool MR_trace_is_natural_number(const char *word,
-                    MR_Unsigned *value);
+                    int *value);

  extern  MR_bool MR_trace_is_natural_number_pair(const char *word,
                      MR_Unsigned *value1, MR_Unsigned *value2);

--------------------------------------------------------------------------
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