[m-rev.] for review: fix conditional breakpoints bug
Ian MacLarty
maclarty at cs.mu.OZ.AU
Sun Feb 5 07:50:58 AEDT 2006
For review by anyone.
Estimated hours taken: 3
Branches: main
Fix a bug where subterm dependency tracking would break if a conditional
breakpoint was set. When the condition of a conditional breakpoint is
evaluated, some Mercury code is called. Conditional breakpoints were being
evaluated outside of the "safe" part of the call graph where the call sequence
number is saved and restored in case any traced Mercury code updates the call
sequence number. This meant that the Mercury code used to evaluate conditional
breakpoints was updating the call sequence number and confusing the declarative
debugger.
This type of error, where Mercury code is called and the original sequence
number is not restored afterwards has occured numerous times in the past
(for example it occured when Ralph introduced the list command), so I have
changed the MR_TRACE_CALL_MERCURY macro to save and restore the event, sequence
and depth numbers to prevent this kind of error in the future. Previously
the event, sequence and depth numbers were saved in an MR_Event_Details
structure at the start of MR_trace_event and restored at the end. The
MR_Event_Details structure needed to be passed to all the command functions
in case there was a retry (since then the event, sequence and depth numbers
must not be restored to their original values, but to new values). This is
now all unnecessary, since the event, sequence and depth numbers will be
restored after any Mercury code is called (as long as it is wrapped in
MR_TRACE_CALL_MERCURY).
runtime/mercury_trace_base.h:
Save and restore the event, call sequence and depth numbers
when calling Mercury code.
trace/mercury_trace.c:
trace/mercury_trace.h:
trace/mercury_trace_declarative.c:
trace/mercury_trace_declarative.h:
trace/mercury_trace_external.c:
trace/mercury_trace_internal.c:
trace/mercury_trace_spy.c:
trace/mercury_trace_util.c:
trace/mercury_trace_util.h:
Do not pass around event_details anymore. And remove, now redundant,
saving and restoring of the event details before and after calling
Mercury code.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/condition_bug.inp:
tests/debugger/declarative/condition_bug.m:
Test that tracking of subterms works with conditional breakpoints.
Index: runtime/mercury_trace_base.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.h,v
retrieving revision 1.51
diff -u -r1.51 mercury_trace_base.h
--- runtime/mercury_trace_base.h 24 Aug 2005 09:07:11 -0000 1.51
+++ runtime/mercury_trace_base.h 4 Feb 2006 17:29:02 -0000
@@ -572,9 +572,15 @@
*/
#define MR_TRACE_CALL_MERCURY(STATEMENTS) do { \
- MR_bool saved_io_enabled; \
+ MR_bool saved_io_enabled; \
+ MR_Unsigned saved_trace_call_seqno; \
+ MR_Unsigned saved_trace_call_depth; \
+ MR_Unsigned saved_trace_event_number; \
\
saved_io_enabled = MR_io_tabling_enabled; \
+ saved_trace_call_seqno = MR_trace_call_seqno; \
+ saved_trace_call_depth = MR_trace_call_depth; \
+ saved_trace_event_number = MR_trace_event_number; \
MR_io_tabling_enabled = MR_FALSE; \
MR_restore_transient_registers(); \
MR_save_registers(); \
@@ -582,6 +588,9 @@
MR_restore_registers(); \
MR_save_transient_registers(); \
MR_io_tabling_enabled = saved_io_enabled; \
+ MR_trace_call_seqno = saved_trace_call_seqno; \
+ MR_trace_call_depth = saved_trace_call_depth; \
+ MR_trace_event_number = saved_trace_event_number; \
} while (0)
#endif /* MERCURY_TRACE_BASE_H */
Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.88
diff -u -r1.88 Mmakefile
--- tests/debugger/declarative/Mmakefile 8 Dec 2005 20:38:45 -0000 1.88
+++ tests/debugger/declarative/Mmakefile 4 Feb 2006 20:26:48 -0000
@@ -84,6 +84,7 @@
DECLDEBUG_DECLARATIVE_PROGS= \
builtin_call_rep \
catch_retry \
+ condition_bug \
priv_builtin_bug \
sort \
track_through_catch \
@@ -247,6 +248,11 @@
$(MDB) ./comp_gen < comp_gen.inp > comp_gen.out 2>&1 \
|| { grep . $@ /dev/null; exit 1; }
+condition_bug.out: condition_bug condition_bug.inp
+ $(MDB_STD) ./condition_bug < condition_bug.inp \
+ > condition_bug.out 2>&1 \
+ || { grep . $@ /dev/null; exit 1; }
+
confirm_abort.out: confirm_abort confirm_abort.inp
$(MDB) ./confirm_abort < confirm_abort.inp > confirm_abort.out 2>&1 \
|| { grep . $@ /dev/null; exit 1; }
Index: tests/debugger/declarative/condition_bug.inp
===================================================================
RCS file: tests/debugger/declarative/condition_bug.inp
diff -N tests/debugger/declarative/condition_bug.inp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/condition_bug.inp 4 Feb 2006 17:29:58 -0000
@@ -0,0 +1,14 @@
+register --quiet
+echo on
+untrust 0
+table_io start
+break io.write_string/3
+condition Message = "english"
+continue
+finish
+dd
+browse 1
+track
+info
+quit
+quit -y
Index: tests/debugger/declarative/condition_bug.m
===================================================================
RCS file: tests/debugger/declarative/condition_bug.m
diff -N tests/debugger/declarative/condition_bug.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/condition_bug.m 4 Feb 2006 14:43:37 -0000
@@ -0,0 +1,43 @@
+:- module condition_bug.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module list, int, string, map, svmap, term_to_xml, assoc_list,
+ std_util.
+
+main(!IO) :-
+ some [!Map] (
+ map.init(!:Map),
+ svmap.set("mission", "missie", !Map),
+ svmap.set("critical", "kritiek", !Map),
+ FinalMap = !.Map
+ ),
+ write_xml_doc(translation(FinalMap), !IO),
+ io.nl(!IO).
+
+:- type translation ---> translation(map(string, string)).
+
+:- instance xmlable(translation) where [
+ func(to_xml/1) is translation_to_xml
+].
+
+:- func translation_to_xml(translation::in) = (xml::out(xml_doc)).
+
+translation_to_xml(translation(TranslationMap)) =
+ elem("translations", [],
+ translation_pairs_to_xml(map.to_assoc_list(TranslationMap))).
+
+:- func translation_pairs_to_xml(assoc_list(string, string)) = list(xml).
+
+translation_pairs_to_xml([]) = [].
+translation_pairs_to_xml([English - Dutch | Rest]) =
+ [elem("word", [], [
+ elem("english", [], [data(English)]),
+ elem("dutch", [], [data(Dutch)])])
+ | translation_pairs_to_xml(Rest)].
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.93
diff -u -r1.93 mercury_trace.c
--- trace/mercury_trace.c 12 Dec 2005 16:34:35 -0000 1.93
+++ trace/mercury_trace.c 4 Feb 2006 17:36:07 -0000
@@ -616,7 +616,7 @@
#define MR_INIT_ARG_COUNT 20
MR_Retry_Result
-MR_trace_retry(MR_Event_Info *event_info, MR_Event_Details *event_details,
+MR_trace_retry(MR_Event_Info *event_info,
int ancestor_level, MR_Retry_Across_Io across_io,
MR_bool assume_all_io_is_tabled, const char *retry_interactive_message,
MR_bool *unsafe_retry, const char **problem,
@@ -1017,16 +1017,6 @@
printf("\n");
#endif
- /*
- ** Overriding MR_trace_call_seqno etc is not enough, because
- ** we will restore the values of those variables later. We must
- ** also override the saved copies.
- */
-
- event_details->MR_call_seqno = MR_trace_call_seqno;
- event_details->MR_call_depth = MR_trace_call_depth;
- event_details->MR_event_number = MR_trace_event_number;
-
if (args != NULL) {
MR_free(args);
}
Index: trace/mercury_trace.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.h,v
retrieving revision 1.31
diff -u -r1.31 mercury_trace.h
--- trace/mercury_trace.h 10 Oct 2005 07:58:12 -0000 1.31
+++ trace/mercury_trace.h 4 Feb 2006 18:01:41 -0000
@@ -44,18 +44,6 @@
} MR_Event_Info;
/*
-** MR_Event_Details is used to save some globals across calls to
-** MR_trace_debug_cmd. It is passed to MR_trace_retry which can
-** then override the saved values.
-*/
-
-typedef struct MR_Event_Details_Struct {
- MR_Unsigned MR_event_number;
- MR_Unsigned MR_call_seqno;
- MR_Unsigned MR_call_depth;
-} MR_Event_Details;
-
-/*
** The above declarations are part of the interface between MR_trace_real
** and the internal and external debuggers. Even though MR_trace_real is
** defined in mercury_trace.c, its prototype is not here. Instead, it is
@@ -150,7 +138,6 @@
} MR_Retry_Result;
extern MR_Retry_Result MR_trace_retry(MR_Event_Info *event_info,
- MR_Event_Details *event_details,
int ancestor_level,
MR_Retry_Across_Io across_io,
MR_bool assume_all_io_is_tabled,
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.98
diff -u -r1.98 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c 10 Oct 2005 07:58:12 -0000 1.98
+++ trace/mercury_trace_declarative.c 4 Feb 2006 17:59:24 -0000
@@ -388,7 +388,6 @@
MR_bool create_supertree,
MR_Trace_Cmd_Info *cmd,
MR_Event_Info *event_info,
- MR_Event_Details *event_details,
MR_Code **jumpaddr);
static MR_Code *MR_trace_restart_decl_debug(
MR_Trace_Node call_preceding,
@@ -397,21 +396,17 @@
MR_bool create_supertree,
MR_Unsigned depth_limit,
MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info,
- MR_Event_Details *event_details);
+ MR_Event_Info *event_info);
static MR_Code *MR_decl_diagnosis(MR_Trace_Node root,
MR_Trace_Cmd_Info *cmd,
MR_Event_Info *event_info,
- MR_Event_Details *event_details,
MR_bool new_tree);
static MR_Code *MR_decl_go_to_selected_event(MR_Unsigned event,
MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info,
- MR_Event_Details *event_details);
+ MR_Event_Info *event_info);
static MR_Code *MR_trace_decl_retry_supertree(
MR_Unsigned max_distance,
- MR_Event_Info *event_info,
- MR_Event_Details *event_details);
+ MR_Event_Info *event_info);
static MR_String MR_trace_node_path(MR_Trace_Node node);
static MR_Trace_Port MR_trace_node_port(MR_Trace_Node node);
static MR_Unsigned MR_trace_node_seqno(MR_Trace_Node node);
@@ -473,7 +468,6 @@
{
const MR_Proc_Layout *entry;
MR_Unsigned depth;
- MR_Event_Details event_details;
MR_Integer trace_suppress;
MR_Unsigned node_depth;
MR_Unsigned call_seqno;
@@ -530,12 +524,8 @@
/*
** Call the front end.
*/
- event_details.MR_call_seqno = MR_trace_call_seqno;
- event_details.MR_call_depth = MR_trace_call_depth;
- event_details.MR_event_number = MR_trace_event_number;
-
return MR_decl_diagnosis(MR_edt_return_node, &MR_trace_ctrl,
- event_info, &event_details, MR_TRUE);
+ event_info, MR_TRUE);
}
return NULL;
@@ -610,8 +600,6 @@
} else if (event_info->MR_call_seqno == MR_edt_start_seqno
&& MR_port_is_entry(event_info->MR_trace_port))
{
- MR_Event_Details event_details;
-
/*
** We are entering the top of the currently
** materialized portion of the annotated trace.
@@ -622,7 +610,7 @@
*/
MR_edt_inside = MR_TRUE;
*jumpaddr = MR_trace_decl_retry_supertree(MR_edt_max_depth,
- event_info, &event_details);
+ event_info);
/*
** Reset the depth since we will now
** be at the top of the supertree to be
@@ -691,11 +679,7 @@
MR_trace_construct_node(MR_Event_Info *event_info)
{
MR_Trace_Node trace;
- MR_Event_Details event_details;
- event_details.MR_call_seqno = MR_trace_call_seqno;
- event_details.MR_call_depth = MR_trace_call_depth;
- event_details.MR_event_number = MR_trace_event_number;
trace = MR_trace_current_node;
MR_debug_enabled = MR_FALSE;
@@ -755,12 +739,6 @@
MR_debug_enabled = MR_TRUE;
MR_update_trace_func_enabled();
- /*
- ** Restore globals from the saved copies.
- */
- MR_trace_call_seqno = event_details.MR_call_seqno;
- MR_trace_call_depth = event_details.MR_call_depth;
- MR_trace_event_number = event_details.MR_event_number;
MR_trace_current_node = trace;
}
@@ -771,7 +749,7 @@
static MR_Code *
MR_trace_decl_retry_supertree(MR_Unsigned max_distance,
- MR_Event_Info *event_info, MR_Event_Details *event_details)
+ MR_Event_Info *event_info)
{
MR_Code *jumpaddr;
int retry_distance;
@@ -796,8 +774,7 @@
retry_mode = MR_RETRY_IO_INTERACTIVE;
}
- retry_result = MR_trace_retry(event_info, event_details,
- retry_distance, retry_mode,
+ retry_result = MR_trace_retry(event_info, retry_distance, retry_mode,
MR_trace_decl_assume_all_io_is_tabled,
MR_DECL_UNTABLED_IO_RETRY_MESSAGE, &unsafe_retry,
&problem, MR_mdb_in, MR_mdb_out, &jumpaddr);
@@ -1569,7 +1546,7 @@
MR_bool
MR_trace_start_decl_debug(MR_Decl_Mode mode, const char *outfile,
MR_bool new_session, MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Code **jumpaddr)
{
MR_Retry_Result result;
const MR_Proc_Layout *entry;
@@ -1589,7 +1566,7 @@
MR_decl_mode = mode;
MR_selected_trace_func_ptr = MR_trace_real_decl;
*jumpaddr = MR_decl_diagnosis((MR_Trace_Node) NULL, cmd,
- event_info, event_details, MR_FALSE);
+ event_info, MR_FALSE);
return MR_TRUE;
}
@@ -1660,7 +1637,7 @@
MR_trace_current_node = (MR_Trace_Node) NULL;
message = MR_trace_start_collecting(event_info->MR_event_number,
event_info->MR_call_seqno, MR_edt_default_depth_limit,
- MR_FALSE, cmd, event_info, event_details, jumpaddr);
+ MR_FALSE, cmd, event_info, jumpaddr);
if (message == NULL) {
first_time = MR_FALSE;
@@ -1677,8 +1654,7 @@
static MR_Code *
MR_trace_restart_decl_debug(MR_Trace_Node call_preceding, MR_Unsigned event,
MR_Unsigned seqno, MR_bool create_supertree, MR_Unsigned depth_limit,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info)
{
const char *message;
MR_Code *jumpaddr;
@@ -1692,7 +1668,7 @@
MR_trace_current_node = call_preceding;
message = MR_trace_start_collecting(event, seqno, depth_limit,
- create_supertree, cmd, event_info, event_details, &jumpaddr);
+ create_supertree, cmd, event_info, &jumpaddr);
if (message != NULL) {
fflush(MR_mdb_out);
@@ -1709,8 +1685,7 @@
static const char *
MR_trace_start_collecting(MR_Unsigned event, MR_Unsigned seqno,
MR_Unsigned maxdepth, MR_bool create_supertree, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
const char *problem;
MR_Retry_Result retry_result;
@@ -1749,7 +1724,7 @@
return problem;
}
- retry_result = MR_trace_retry(event_info, event_details,
+ retry_result = MR_trace_retry(event_info,
retry_distance, MR_RETRY_IO_INTERACTIVE,
MR_trace_decl_assume_all_io_is_tabled,
MR_DECL_UNTABLED_IO_RETRY_MESSAGE, &unsafe_retry,
@@ -1785,7 +1760,7 @@
MR_edt_building_supertree = create_supertree;
MR_edt_suspicion_accumulator = 0;
MR_edt_start_time = MR_get_user_cpu_miliseconds();
- MR_edt_first_event = event_details->MR_event_number;
+ MR_edt_first_event = event_info->MR_event_number;
/*
** The deepest we will build any implicit subtree to will be
@@ -1796,13 +1771,6 @@
MR_edt_desired_nodes_in_subtree / 2 + 1);
/*
- ** Restore globals from the saved copies.
- */
- MR_trace_call_seqno = event_details->MR_call_seqno;
- MR_trace_call_depth = event_details->MR_call_depth;
- MR_trace_event_number = event_details->MR_event_number;
-
- /*
** Single step through every event.
*/
cmd->MR_trace_cmd = MR_CMD_GOTO;
@@ -1818,8 +1786,7 @@
static MR_Code *
MR_decl_diagnosis(MR_Trace_Node root, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_bool new_tree)
+ MR_Event_Info *event_info, MR_bool new_tree)
{
MR_Word response;
MR_bool bug_found;
@@ -1854,9 +1821,6 @@
MR_selected_trace_func_ptr = MR_trace_real;
MR_debug_enabled = MR_TRUE;
MR_update_trace_func_enabled();
- MR_trace_call_seqno = event_details->MR_call_seqno;
- MR_trace_call_depth = event_details->MR_call_depth;
- MR_trace_event_number = event_details->MR_event_number;
return MR_trace_event_internal(cmd, MR_TRUE, NULL, event_info);
}
@@ -1913,18 +1877,12 @@
MR_update_trace_func_enabled();
MR_selected_trace_func_ptr = MR_trace_real_decl;
- MR_trace_call_seqno = event_details->MR_call_seqno;
- MR_trace_call_depth = event_details->MR_call_depth;
- MR_trace_event_number = event_details->MR_event_number;
-
if (bug_found) {
- return MR_decl_go_to_selected_event(bug_event, cmd, event_info,
- event_details);
+ return MR_decl_go_to_selected_event(bug_event, cmd, event_info);
}
if (symptom_found) {
- return MR_decl_go_to_selected_event(symptom_event, cmd, event_info,
- event_details);
+ return MR_decl_go_to_selected_event(symptom_event, cmd, event_info);
}
if (no_bug_found) {
@@ -1933,7 +1891,7 @@
** event where the `dd' command was initially given.
*/
return MR_decl_go_to_selected_event(MR_edt_initial_event, cmd,
- event_info, event_details);
+ event_info);
}
if (require_subtree) {
@@ -1943,8 +1901,7 @@
** limit.
*/
return MR_trace_restart_decl_debug(call_preceding, final_event,
- topmost_seqno, MR_FALSE, requested_subtree_depth, cmd, event_info,
- event_details);
+ topmost_seqno, MR_FALSE, requested_subtree_depth, cmd, event_info);
}
if (require_supertree) {
@@ -1953,7 +1910,7 @@
*/
return MR_trace_restart_decl_debug((MR_Trace_Node) NULL, final_event,
topmost_seqno, MR_TRUE, MR_edt_default_depth_limit, cmd,
- event_info, event_details);
+ event_info);
}
/* We shouldn't ever get here. */
@@ -1962,7 +1919,7 @@
static MR_Code *
MR_decl_go_to_selected_event(MR_Unsigned event, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details)
+ MR_Event_Info *event_info)
{
const char *problem;
MR_Retry_Result retry_result;
@@ -1999,7 +1956,7 @@
MR_print_stack_regs(stdout, event_info->MR_saved_regs);
MR_print_succip_reg(stdout, event_info->MR_saved_regs);
#endif
- retry_result = MR_trace_retry(event_info, event_details,
+ retry_result = MR_trace_retry(event_info,
ancestor_level, MR_RETRY_IO_INTERACTIVE,
MR_trace_decl_assume_all_io_is_tabled,
MR_DECL_UNTABLED_IO_RETRY_MESSAGE,
@@ -2449,7 +2406,6 @@
static void
MR_decl_print_edt_stats(void)
{
- MR_Event_Details event_details;
MR_bool debug_enabled_before = MR_debug_enabled;
pid_t pid;
char cmdstr[200];
@@ -2483,25 +2439,11 @@
MR_debug_enabled = MR_FALSE;
MR_update_trace_func_enabled();
- /*
- ** Save the trace globals in case the called Mercury code is traced.
- */
- event_details.MR_call_seqno = MR_trace_call_seqno;
- event_details.MR_call_depth = MR_trace_call_depth;
- event_details.MR_event_number = MR_trace_event_number;
-
fprintf(stderr, "Benchmarking stats:\n");
MR_TRACE_CALL_MERCURY(
ML_report_stats();
);
- /*
- ** Restore the trace globals in case the called Mercury code is traced.
- */
- MR_trace_call_seqno = event_details.MR_call_seqno;
- MR_trace_call_depth = event_details.MR_call_depth;
- MR_trace_event_number = event_details.MR_event_number;
-
MR_debug_enabled = debug_enabled_before;
MR_update_trace_func_enabled();
Index: trace/mercury_trace_declarative.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.h,v
retrieving revision 1.28
diff -u -r1.28 mercury_trace_declarative.h
--- trace/mercury_trace_declarative.h 10 Oct 2005 07:58:12 -0000 1.28
+++ trace/mercury_trace_declarative.h 4 Feb 2006 18:00:32 -0000
@@ -39,10 +39,9 @@
typedef enum { MR_DECL_NODUMP, MR_DECL_DUMP } MR_Decl_Mode;
extern MR_bool MR_trace_start_decl_debug(MR_Decl_Mode mode,
- const char *out,
- MR_bool new_session, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr);
+ const char *outfile, MR_bool new_session,
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
+ MR_Code **jumpaddr);
/*
** The declarative debugger may need to perform many retries during one
Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.78
diff -u -r1.78 mercury_trace_external.c
--- trace/mercury_trace_external.c 6 Apr 2005 01:11:32 -0000 1.78
+++ trace/mercury_trace_external.c 4 Feb 2006 18:01:25 -0000
@@ -489,7 +489,6 @@
MR_Word type_list;
MR_Word var;
MR_Code *jumpaddr = NULL;
- MR_Event_Details event_details;
const char *message;
MR_bool include_trace_data = MR_TRUE;
const MR_Label_Layout *layout = event_info->MR_event_sll;
@@ -508,18 +507,6 @@
MR_debug_enabled = MR_FALSE;
MR_update_trace_func_enabled();
- /*
- ** These globals can be overwritten when we call Mercury code,
- ** such as the code in browser/debugger_interface.m.
- ** We therefore save them here and restore them before
- ** exiting from this function. However, we store the
- ** saved values in a structure that we pass to MR_trace_debug_cmd,
- ** to allow them to be modified by MR_trace_retry().
- */
- event_details.MR_call_seqno = MR_trace_call_seqno;
- event_details.MR_call_depth = MR_trace_call_depth;
- event_details.MR_event_number = MR_trace_event_number;
-
MR_trace_init_point_vars(event_info->MR_event_sll,
event_info->MR_saved_regs, event_info->MR_trace_port,
MR_FALSE);
@@ -619,8 +606,7 @@
fprintf(stderr, "\nMercury runtime: "
"REQUEST_RETRY\n");
}
- retry_result = MR_trace_retry(event_info,
- &event_details, 0,
+ retry_result = MR_trace_retry(event_info, 0,
MR_RETRY_IO_ONLY_IF_SAFE,
MR_FALSE, "", &unsafe_retry,
&message, NULL, NULL, &jumpaddr);
@@ -907,17 +893,6 @@
|| cmd->MR_trace_check_integrity;
#endif
- /*
- ** Restore the event numbers, in case the Mercury
- ** code that we call from the trace system
- ** (e.g. browser/debugger_interface.m)
- ** clobbered them. That could happen if that code
- ** had been compiled with debugging enabled.
- */
- MR_trace_call_seqno = event_details.MR_call_seqno;
- MR_trace_call_depth = event_details.MR_call_depth;
- MR_trace_event_number = event_details.MR_event_number;
-
MR_debug_enabled = MR_TRUE;
MR_update_trace_func_enabled();
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.219
diff -u -r1.219 mercury_trace_internal.c
--- trace/mercury_trace_internal.c 3 Jan 2006 04:03:07 -0000 1.219
+++ trace/mercury_trace_internal.c 4 Feb 2006 17:52:30 -0000
@@ -317,8 +317,7 @@
*/
typedef MR_Next MR_Trace_Command_Function(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr);
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr);
typedef struct
{
@@ -444,12 +443,11 @@
static void MR_trace_internal_init_from_local(void);
static void MR_trace_internal_init_from_home_dir(void);
static MR_Next MR_trace_debug_cmd(char *line, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr);
+ MR_Event_Info *event_info, MR_Code **jumpaddr);
typedef MR_Next MR_TraceCmdFunc(char **words, int word_count,
MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr);
+ MR_Code **jumpaddr);
static MR_TraceCmdFunc MR_trace_handle_cmd;
@@ -796,7 +794,6 @@
MR_Code *jumpaddr;
char *line;
MR_Next res;
- MR_Event_Details event_details;
const char *prompt;
if (! interactive) {
@@ -828,18 +825,6 @@
MR_trace_event_print_internal_report(event_info);
MR_trace_maybe_sync_source_window(event_info, MR_FALSE);
- /*
- ** These globals can be overwritten when we call Mercury code,
- ** such as the term browser. We therefore save and restore them
- ** across calls to MR_trace_debug_cmd. However, we store the
- ** saved values in a structure that we pass to MR_trace_debug_cmd,
- ** to allow them to be modified by MR_trace_retry().
- */
-
- event_details.MR_event_number = MR_trace_event_number;
- event_details.MR_call_seqno = MR_trace_call_seqno;
- event_details.MR_call_depth = MR_trace_call_depth;
-
MR_trace_init_point_vars(event_info->MR_event_sll,
event_info->MR_saved_regs, event_info->MR_trace_port,
MR_print_optionals);
@@ -851,8 +836,7 @@
do {
line = MR_trace_get_command("mdb> ", MR_mdb_in, MR_mdb_out);
- res = MR_trace_debug_cmd(line, cmd, event_info, &event_details,
- &jumpaddr);
+ res = MR_trace_debug_cmd(line, cmd, event_info, &jumpaddr);
fflush(MR_mdb_err);
} while (res == KEEP_INTERACTING);
@@ -864,10 +848,6 @@
|| cmd->MR_trace_check_integrity;
#endif
- MR_trace_call_seqno = event_details.MR_call_seqno;
- MR_trace_call_depth = event_details.MR_call_depth;
- MR_trace_event_number = event_details.MR_event_number;
-
MR_scroll_next = 0;
MR_turn_debug_back_on(&MR_saved_debug_state);
#if defined(MR_DEEP_PROFILING) && defined(MR_EXEC_TRACE)
@@ -1531,8 +1511,7 @@
static MR_Next
MR_trace_debug_cmd(char *line, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
char **words;
char **orig_words = NULL;
@@ -1573,7 +1552,7 @@
** Call the command dispatcher
*/
next = MR_trace_handle_cmd(words, word_count, cmd, event_info,
- event_details, jumpaddr);
+ jumpaddr);
}
MR_free(line);
@@ -1590,8 +1569,7 @@
static MR_Next
MR_trace_handle_cmd(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
const MR_Trace_Command_Info *cmd_info;
@@ -1607,7 +1585,7 @@
cmd_info = MR_trace_valid_command(words[0]);
if (cmd_info != NULL) {
return (*cmd_info->MR_cmd_function)(words, word_count, cmd,
- event_info, event_details, jumpaddr);
+ event_info, jumpaddr);
} else {
fflush(MR_mdb_out);
fprintf(MR_mdb_err, "Unknown command `%s'. "
@@ -1619,8 +1597,7 @@
static MR_Next
MR_trace_cmd_step(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
@@ -1649,8 +1626,7 @@
static MR_Next
MR_trace_cmd_goto(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Unsigned n;
@@ -1681,8 +1657,7 @@
static MR_Next
MR_trace_cmd_next(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Unsigned depth;
int stop_depth;
@@ -1720,8 +1695,7 @@
static MR_Next
MR_trace_cmd_finish(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Unsigned depth;
int stop_depth;
@@ -1758,8 +1732,7 @@
static MR_Next
MR_trace_cmd_fail(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Determinism detism;
MR_Unsigned depth;
@@ -1813,8 +1786,7 @@
static MR_Next
MR_trace_cmd_exception(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
cmd->MR_trace_strict = MR_TRUE;
cmd->MR_trace_print_level = MR_default_print_level;
@@ -1839,8 +1811,7 @@
static MR_Next
MR_trace_cmd_return(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
cmd->MR_trace_strict = MR_TRUE;
cmd->MR_trace_print_level = MR_default_print_level;
@@ -1865,8 +1836,7 @@
static MR_Next
MR_trace_cmd_forward(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
cmd->MR_trace_strict = MR_TRUE;
cmd->MR_trace_print_level = MR_default_print_level;
@@ -1897,8 +1867,7 @@
static MR_Next
MR_trace_cmd_mindepth(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int newdepth;
@@ -1924,8 +1893,7 @@
static MR_Next
MR_trace_cmd_maxdepth(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int newdepth;
@@ -1951,8 +1919,7 @@
static MR_Next
MR_trace_cmd_continue(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
cmd->MR_trace_strict = MR_FALSE;
cmd->MR_trace_print_level = (MR_Trace_Cmd_Type) -1;
@@ -1984,8 +1951,7 @@
static MR_Next
MR_trace_cmd_retry(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
int ancestor_level;
@@ -2016,7 +1982,7 @@
return KEEP_INTERACTING;
}
- result = MR_trace_retry(event_info, event_details, ancestor_level,
+ result = MR_trace_retry(event_info, ancestor_level,
across_io, assume_all_io_is_tabled, MR_UNTABLED_IO_RETRY_MESSAGE,
&unsafe_retry, &problem, MR_mdb_in, MR_mdb_out,
jumpaddr);
@@ -2062,8 +2028,7 @@
static MR_Next
MR_trace_cmd_level(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
MR_bool detailed;
@@ -2084,8 +2049,7 @@
static MR_Next
MR_trace_cmd_up(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
MR_bool detailed;
@@ -2110,8 +2074,7 @@
static MR_Next
MR_trace_cmd_down(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
MR_bool detailed;
@@ -2136,8 +2099,7 @@
static MR_Next
MR_trace_cmd_vars(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 1) {
const char *problem;
@@ -2156,8 +2118,7 @@
static MR_Next
MR_trace_cmd_held_vars(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 1) {
MR_trace_list_held_vars(MR_mdb_out);
@@ -2170,8 +2131,7 @@
static MR_Next
MR_trace_cmd_print(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Browse_Format format;
MR_bool xml;
@@ -2242,8 +2202,7 @@
static MR_Next
MR_trace_cmd_browse(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Browse_Format format;
MR_bool xml;
@@ -2318,8 +2277,7 @@
static MR_Next
MR_trace_cmd_stack(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_bool detailed;
int frame_limit = 0;
@@ -2370,8 +2328,7 @@
static MR_Next
MR_trace_cmd_current(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 1) {
MR_trace_event_print_internal_report(event_info);
@@ -2384,8 +2341,7 @@
static MR_Next
MR_trace_cmd_set(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Browse_Format format;
MR_Word print_set;
@@ -2406,7 +2362,7 @@
} else if (word_count >= 3 && MR_streq(words[1], "list_path")) {
MR_trace_cmd_set_list_dir_path(words, word_count, cmd, event_info,
- event_details, jumpaddr);
+ jumpaddr);
} else if (word_count == 3 && ( MR_streq(words[1], "fail_trace_count")
|| MR_streq(words[1], "fail_trace_counts")))
@@ -2443,8 +2399,7 @@
static MR_Next
MR_trace_cmd_view(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
const char *window_cmd = NULL;
const char *server_cmd = NULL;
@@ -2481,8 +2436,7 @@
static MR_Next
MR_trace_cmd_hold(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
char *event_var_name;
char *held_var_name;
@@ -2534,8 +2488,7 @@
static MR_Next
MR_trace_cmd_diff(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int start;
int max;
@@ -2594,8 +2547,7 @@
static MR_Next
MR_trace_cmd_save_to_file(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_bool verbose = MR_FALSE;
MR_Word browser_term;
@@ -2693,8 +2645,7 @@
static MR_Next
MR_trace_cmd_list(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
const MR_Proc_Layout *entry_ptr;
const char *filename;
@@ -2733,8 +2684,7 @@
static MR_Next
MR_trace_cmd_set_list_dir_path(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int i;
MR_String aligned_word;
@@ -2757,8 +2707,7 @@
static MR_Next
MR_trace_cmd_push_list_dir(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int i;
MR_String aligned_word;
@@ -2785,8 +2734,7 @@
static MR_Next
MR_trace_cmd_pop_list_dir(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_trace_listing_path_ensure_init();
@@ -2817,8 +2765,7 @@
static MR_Next
MR_trace_cmd_break(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
const MR_Label_Layout *layout;
MR_Proc_Spec spec;
@@ -2995,8 +2942,7 @@
static MR_Next
MR_trace_cmd_condition(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int break_num;
MR_bool require_var;
@@ -3108,8 +3054,7 @@
static MR_Next
MR_trace_cmd_ignore(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
MR_Spy_Ignore_When ignore_when;
@@ -3168,8 +3113,7 @@
static MR_Next
MR_trace_cmd_break_print(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
int i;
@@ -3255,8 +3199,7 @@
static MR_Next
MR_trace_cmd_enable(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
@@ -3304,8 +3247,7 @@
static MR_Next
MR_trace_cmd_disable(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
@@ -3354,8 +3296,7 @@
static MR_Next
MR_trace_cmd_delete(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
@@ -3413,8 +3354,7 @@
static MR_Next
MR_trace_cmd_register(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_bool verbose;
@@ -3433,8 +3373,7 @@
static MR_Next
MR_trace_cmd_modules(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 1) {
MR_register_all_modules_and_procs(MR_mdb_out, MR_TRUE);
@@ -3448,8 +3387,7 @@
static MR_Next
MR_trace_cmd_procedures(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 2) {
MR_register_all_modules_and_procs(MR_mdb_out, MR_TRUE);
@@ -3463,8 +3401,7 @@
static MR_Next
MR_trace_cmd_query(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_trace_query(MR_NORMAL_QUERY, MR_mmc_options, word_count - 1, words + 1);
return KEEP_INTERACTING;
@@ -3472,8 +3409,7 @@
static MR_Next
MR_trace_cmd_cc_query(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_trace_query(MR_CC_QUERY, MR_mmc_options, word_count - 1, words + 1);
return KEEP_INTERACTING;
@@ -3481,8 +3417,7 @@
static MR_Next
MR_trace_cmd_io_query(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_trace_query(MR_IO_QUERY, MR_mmc_options, word_count - 1, words + 1);
return KEEP_INTERACTING;
@@ -3490,8 +3425,7 @@
static MR_Next
MR_trace_cmd_printlevel(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 2) {
if (MR_streq(words[1], "none")) {
@@ -3538,8 +3472,7 @@
static MR_Next
MR_trace_cmd_mmc_options(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
size_t len;
size_t i;
@@ -3565,8 +3498,7 @@
static MR_Next
MR_trace_cmd_scroll(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
@@ -3607,8 +3539,7 @@
static MR_Next
MR_trace_cmd_stack_default_limit(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
@@ -3647,8 +3578,7 @@
static MR_Next
MR_trace_cmd_context(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 2) {
if (MR_streq(words[1], "none")) {
@@ -3693,8 +3623,7 @@
static MR_Next
MR_trace_cmd_goal_paths(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 2) {
if (MR_streq(words[1], "off")) {
@@ -3722,8 +3651,7 @@
static MR_Next
MR_trace_cmd_scope(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 2) {
if (MR_streq(words[1], "all")) {
@@ -3763,8 +3691,7 @@
static MR_Next
MR_trace_cmd_echo(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 2) {
if (MR_streq(words[1], "off")) {
@@ -3803,8 +3730,7 @@
static MR_Next
MR_trace_cmd_alias(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 1) {
MR_trace_print_all_aliases(MR_mdb_out, MR_FALSE);
@@ -3826,8 +3752,7 @@
static MR_Next
MR_trace_cmd_unalias(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 2) {
if (MR_trace_remove_alias(words[1])) {
@@ -3849,8 +3774,7 @@
static MR_Next
MR_trace_cmd_document_category(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int slot;
const char *msg;
@@ -3875,8 +3799,7 @@
static MR_Next
MR_trace_cmd_document(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int slot;
const char *msg;
@@ -3902,8 +3825,7 @@
static MR_Next
MR_trace_cmd_help(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 1) {
MR_trace_help();
@@ -3920,8 +3842,7 @@
static MR_Next
MR_trace_cmd_histogram_all(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
#ifdef MR_TRACE_HISTOGRAM
@@ -3959,8 +3880,7 @@
static MR_Next
MR_trace_cmd_histogram_exp(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
#ifdef MR_TRACE_HISTOGRAM
@@ -3998,8 +3918,7 @@
static MR_Next
MR_trace_cmd_clear_histogram(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
#ifdef MR_TRACE_HISTOGRAM
@@ -4025,8 +3944,7 @@
static MR_Next
MR_trace_cmd_var_details(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
@@ -4047,8 +3965,7 @@
static MR_Next
MR_trace_cmd_term_size(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int n;
@@ -4074,8 +3991,7 @@
static MR_Next
MR_trace_cmd_flag(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
const char *name;
MR_bool *flagptr;
@@ -4159,8 +4075,7 @@
static MR_Next
MR_trace_cmd_subgoal(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
#ifdef MR_USE_MINIMAL_MODEL_STACK_COPY
@@ -4193,8 +4108,7 @@
static MR_Next
MR_trace_cmd_consumer(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
#ifdef MR_USE_MINIMAL_MODEL_STACK_COPY
@@ -4228,8 +4142,7 @@
static MR_Next
MR_trace_cmd_gen_stack(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
#ifdef MR_USE_MINIMAL_MODEL_STACK_COPY
@@ -4257,8 +4170,7 @@
static MR_Next
MR_trace_cmd_cut_stack(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
#ifdef MR_USE_MINIMAL_MODEL_STACK_COPY
@@ -4286,8 +4198,7 @@
static MR_Next
MR_trace_cmd_pneg_stack(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
#ifdef MR_USE_MINIMAL_MODEL_STACK_COPY
@@ -4315,8 +4226,7 @@
static MR_Next
MR_trace_cmd_mm_stacks(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
#ifdef MR_USE_MINIMAL_MODEL_STACK_COPY
@@ -4348,8 +4258,7 @@
static MR_Next
MR_trace_cmd_nondet_stack(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_bool detailed;
int frame_limit = 0;
@@ -4403,8 +4312,7 @@
static MR_Next
MR_trace_cmd_stack_regs(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Word *saved_regs;
@@ -4421,8 +4329,7 @@
static MR_Next
MR_trace_cmd_all_regs(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Word *saved_regs;
@@ -4446,11 +4353,10 @@
static MR_Next
MR_trace_cmd_debug_vars(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 1) {
- MR_print_debug_vars(MR_mdb_out, event_details);
+ MR_print_debug_vars(MR_mdb_out, event_info);
} else {
MR_trace_usage("developer", "debug_vars");
}
@@ -4460,8 +4366,7 @@
static MR_Next
MR_trace_cmd_table_io(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 1) {
if (! MR_io_tabling_allowed) {
@@ -4557,8 +4462,7 @@
static MR_Next
MR_trace_cmd_stats(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
char *filename;
FILE *fp;
@@ -4612,8 +4516,7 @@
static MR_Next
MR_trace_cmd_print_optionals(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 2 && MR_streq(words[1], "off")) {
MR_print_optionals = MR_FALSE;
@@ -4633,8 +4536,7 @@
static MR_Next
MR_trace_cmd_unhide_events(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 2 && MR_streq(words[1], "off")) {
MR_trace_unhide_events = MR_FALSE;
@@ -4707,8 +4609,7 @@
static MR_Next
MR_trace_cmd_table(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Call_Table_Arg *call_table_args;
const MR_Proc_Layout *proc;
@@ -5429,8 +5330,7 @@
static MR_Next
MR_trace_cmd_type_ctor(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
const char *module_name;
const char *name;
@@ -5468,8 +5368,7 @@
static MR_Next
MR_trace_cmd_class_decl(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
const char *module_name;
const char *name;
@@ -5508,8 +5407,7 @@
static MR_Next
MR_trace_cmd_all_type_ctors(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_bool print_rep;
MR_bool print_functors;
@@ -5567,8 +5465,7 @@
static MR_Next
MR_trace_cmd_all_class_decls(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_bool print_methods;
MR_bool print_instances;
@@ -5627,8 +5524,7 @@
static MR_Next
MR_trace_cmd_all_procedures(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
const char *filename;
MR_bool separate;
@@ -5672,8 +5568,7 @@
static MR_Next
MR_trace_cmd_ambiguity(char **words, int word_count,
- MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
- MR_Event_Details *event_details, MR_Code **jumpaddr)
+ MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info, MR_Code **jumpaddr)
{
const char *filename;
FILE *fp;
@@ -5900,8 +5795,7 @@
static MR_Next
MR_trace_cmd_source(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_bool ignore_errors;
@@ -5926,8 +5820,7 @@
static MR_Next
MR_trace_cmd_save(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 2) {
FILE *fp;
@@ -5984,8 +5877,7 @@
static MR_Next
MR_trace_cmd_quit(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_bool confirmed;
@@ -6030,8 +5922,7 @@
static MR_Next
MR_trace_cmd_dd(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Decl_Search_Mode search_mode;
MR_bool search_mode_was_set = MR_FALSE;
@@ -6101,7 +5992,7 @@
}
if (MR_trace_start_decl_debug(decl_mode, filename, new_session, cmd,
- event_info, event_details, jumpaddr))
+ event_info, jumpaddr))
{
return STOP_INTERACTING;
}
@@ -6114,8 +6005,7 @@
static MR_Next
MR_trace_cmd_trust(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
MR_Proc_Spec spec;
MR_Matches_Info matches;
@@ -6208,8 +6098,7 @@
static MR_Next
MR_trace_cmd_untrust(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
int i;
@@ -6225,8 +6114,7 @@
static MR_Next
MR_trace_cmd_trusted(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
if (word_count == 1) {
MR_decl_print_all_trusted(MR_mdb_out, MR_FALSE);
@@ -6238,8 +6126,7 @@
static MR_Next
MR_trace_cmd_dice(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Code **jumpaddr)
{
char *pass_trace_counts_file;
char *fail_trace_counts_file;
Index: trace/mercury_trace_spy.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_spy.c,v
retrieving revision 1.25
diff -u -r1.25 mercury_trace_spy.c
--- trace/mercury_trace_spy.c 11 Jul 2005 07:30:31 -0000 1.25
+++ trace/mercury_trace_spy.c 4 Feb 2006 17:16:31 -0000
@@ -361,6 +361,12 @@
const char *MR_spy_point_cond_problem = NULL;
MR_Spy_Cond *MR_spy_point_cond_bad = NULL;
+/*
+** NOTE: MR_spy_cond_is_true may only be called from within MR_trace_event
+** (or one of its decendents), since it calls Mercury code to evaluate the
+** condition, and the Mercury registers are only saved in MR_trace_event.
+*/
+
static MR_bool
MR_spy_cond_is_true(MR_Spy_Point *point, const MR_Label_Layout *label_layout)
{
Index: trace/mercury_trace_util.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_util.c,v
retrieving revision 1.17
diff -u -r1.17 mercury_trace_util.c
--- trace/mercury_trace_util.c 12 Dec 2005 16:34:36 -0000 1.17
+++ trace/mercury_trace_util.c 4 Feb 2006 17:49:37 -0000
@@ -173,14 +173,14 @@
}
void
-MR_print_debug_vars(FILE *fp, MR_Event_Details *event_details)
+MR_print_debug_vars(FILE *fp, MR_Event_Info *event_info)
{
#ifndef MR_HIGHLEVEL_CODE
- fprintf(fp, "from event details:\n");
+ fprintf(fp, "from event info:\n");
fprintf(fp, "call event %ld, call seq %ld, depth %ld\n",
- (long) event_details->MR_event_number,
- (long) event_details->MR_call_seqno,
- (long) event_details->MR_call_depth);
+ (long) event_info->MR_event_number,
+ (long) event_info->MR_call_seqno,
+ (long) event_info->MR_call_depth);
fprintf(fp, "from global vars:\n");
fprintf(fp, "call event %ld, call seq %ld, depth %ld\n",
(long) MR_trace_event_number,
Index: trace/mercury_trace_util.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_util.h,v
retrieving revision 1.13
diff -u -r1.13 mercury_trace_util.h
--- trace/mercury_trace_util.h 12 Dec 2005 16:34:36 -0000 1.13
+++ trace/mercury_trace_util.h 4 Feb 2006 18:04:11 -0000
@@ -20,7 +20,7 @@
#include "mercury_types.h" /* for MR_Word etc */
#include "mercury_library_types.h" /* for MercuryFile */
#include <stdio.h> /* for FILE */
-#include "mercury_trace.h" /* for MR_Event_Details */
+#include "mercury_trace.h" /* for MR_Event_Info */
/*
** MR_c_file_to_mercury_file is used to convert MR_mdb_in and MR_mdb_out
@@ -67,7 +67,7 @@
extern void MR_print_tabling_regs(FILE *fp, MR_Word *saved_regs);
extern void MR_print_succip_reg(FILE *fp, MR_Word *saved_regs);
extern void MR_print_r_regs(FILE *fp, MR_Word *saved_regs);
-extern void MR_print_debug_vars(FILE *fp, MR_Event_Details *event_details);
+extern void MR_print_debug_vars(FILE *fp, MR_Event_Info *event_info);
/*
** This function returns MR_TRUE if the layout is for exception.builtin_catch
--------------------------------------------------------------------------
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