[m-rev.] diff: fix two minor bugs in the debugger

Zoltan Somogyi zs at csse.unimelb.edu.au
Wed Sep 21 18:45:58 AEST 2011


trace/mercury_trace_cmd_developer.c:
	Fix a minor bug: don't go on to try to print statistics if users invoke
	the "stats" command without saying *which* statistics they want, since
	it just leads to the printing of the same error message.

trace/mercury_trace_cmd_developer.c:
	Fix a core-dump level bug: since the pointer to the table of variable
	names in a procedure may be NULL if the procedure has no named Mercury
	variables (which can happen for procedures defined in foreign
	languages), test it for NULL before deferencing it.

Zoltan.

Index: mercury_trace_cmd_developer.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_cmd_developer.c,v
retrieving revision 1.12
diff -u -b -r1.12 mercury_trace_cmd_developer.c
--- mercury_trace_cmd_developer.c	5 Sep 2008 11:19:34 -0000	1.12
+++ mercury_trace_cmd_developer.c	21 Sep 2011 08:25:21 -0000
@@ -660,6 +660,7 @@
 
     if (word_count != 2) {
         MR_trace_usage_cur_cmd();
+        return KEEP_INTERACTING;
     }
 
     if (filename != NULL) {
Index: mercury_trace_tables.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_tables.c,v
retrieving revision 1.51
diff -u -b -r1.51 mercury_trace_tables.c
--- mercury_trace_tables.c	20 May 2011 04:16:58 -0000	1.51
+++ mercury_trace_tables.c	21 Sep 2011 08:33:30 -0000
@@ -1922,6 +1922,7 @@
             }
 
             var_names = proc_layout->MR_sle_used_var_names;
+            if (var_names != NULL) {
             num_var_nums = proc_layout->MR_sle_max_named_var_num + 1;
 
             total_var_num_table_entries += num_var_nums;
@@ -1932,6 +1933,7 @@
             }
         }
     }
+    }
 
     fprintf(fp, "%d modules, %d bytes in string tables, average %.2f\n",
         MR_module_info_next, total_string_table_bytes,
--------------------------------------------------------------------------
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