For review: Add MR_Event_Info to hold trace data
Mark Anthony BROWN
dougl at cs.mu.OZ.AU
Fri Feb 19 04:29:29 AEDT 1999
Hi,
Fergus, this is the change we discussed a short while ago. Could
you review it please?
Cheers,
Mark
--
Estimated hours taken: 6
Pass around event information for the tracing system in an
MR_Event_Info struct instead of passing each item as a separate
argument. Use Unsigned consistently for the type of the call
depth and call sequence number.
trace/mercury_trace.h:
Add the new MR_Event_Info structure.
trace/mercury_trace.{c,h}:
trace/mercury_trace_declarative.{c,h}:
trace/mercury_trace_external.{c,h}:
trace/mercury_trace_internal.{c,h}:
Use the new structure.
runtime/mercury_trace_base.c:
Use Unsigned as the type of the call depth and sequence number.
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.10
diff -u -t -r1.10 mercury_trace_base.c
--- mercury_trace_base.c 1999/02/04 10:52:55 1.10
+++ mercury_trace_base.c 1999/02/18 17:02:26
@@ -140,7 +140,7 @@
Code *
MR_trace_fake(const MR_Stack_Layout_Label *layout, MR_Trace_Port port,
- Word seqno, Word depth, const char * path, int max_mr_num)
+ Unsigned seqno, Unsigned depth, const char * path, int max_mr_num)
{
fatal_error("This executable is not set up for debugging.\n"
"Rebuild the <main>_init.c file, "
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.5
diff -u -t -r1.5 mercury_trace.c
--- mercury_trace.c 1999/02/12 00:16:42 1.5
+++ mercury_trace.c 1999/02/18 17:02:46
@@ -226,18 +226,25 @@
const MR_Stack_Layout_Label *layout, MR_Trace_Port port,
Unsigned seqno, Unsigned depth, const char *path, int max_r_num)
{
- int max_mr_num;
- Code *jumpaddr;
- Word saved_regs[MAX_FAKE_REG];
+ Code *jumpaddr;
+ MR_Event_Info event_info;
+ Word *saved_regs = event_info.MR_saved_regs;
+
+ event_info.MR_event_number = MR_trace_event_number;
+ event_info.MR_call_seqno = seqno;
+ event_info.MR_call_depth = depth;
+ event_info.MR_trace_port = port;
+ event_info.MR_event_sll = layout;
+ event_info.MR_event_path = path;
if (max_r_num + MR_NUM_SPECIAL_REG > MR_MAX_SPECIAL_REG_MR) {
- max_mr_num = max_r_num + MR_NUM_SPECIAL_REG;
+ event_info.MR_max_mr_num = max_r_num + MR_NUM_SPECIAL_REG;
} else {
- max_mr_num = MR_MAX_SPECIAL_REG_MR;
+ event_info.MR_max_mr_num = MR_MAX_SPECIAL_REG_MR;
}
/* This also saves the regs in MR_fake_regs. */
- MR_copy_regs_to_saved_regs(max_mr_num, saved_regs);
+ MR_copy_regs_to_saved_regs(event_info.MR_max_mr_num, saved_regs);
#ifdef MR_USE_EXTERNAL_DEBUGGER
if (MR_trace_handler == MR_TRACE_EXTERNAL) {
@@ -245,12 +252,10 @@
fatal_error("reporting event for external debugger");
}
- jumpaddr = MR_trace_event_external(cmd, layout, saved_regs,
- port, seqno, depth, path, &max_mr_num);
+ jumpaddr = MR_trace_event_external(cmd, &event_info);
} else {
jumpaddr = MR_trace_event_internal(cmd, interactive,
- layout, saved_regs, port, seqno,
- depth, path, &max_mr_num);
+ &event_info);
}
#else
/*
@@ -258,9 +263,7 @@
** This is enforced by mercury_wrapper.c.
*/
- jumpaddr = MR_trace_event_internal(cmd, interactive,
- layout, saved_regs, port, seqno,
- depth, path, &max_mr_num);
+ jumpaddr = MR_trace_event_internal(cmd, interactive, &event_info);
#endif
/*
@@ -276,14 +279,13 @@
restore_transient_registers(); /* in case MR_global_hp is transient */
MR_saved_global_hp(saved_regs) = MR_global_hp;
- MR_copy_saved_regs_to_regs(max_mr_num, saved_regs);
+ MR_copy_saved_regs_to_regs(event_info.MR_max_mr_num, saved_regs);
return jumpaddr;
}
const char *
-MR_trace_retry(const MR_Stack_Layout_Label *this_label, Word *saved_regs,
- MR_Event_Details *event_details, int seqno, int depth,
- int *max_mr_num, Code **jumpaddr)
+MR_trace_retry(MR_Event_Info *event_info, MR_Event_Details *event_details,
+ Code **jumpaddr)
{
const MR_Stack_Layout_Entry *entry;
const MR_Stack_Layout_Label *call_label;
@@ -295,8 +297,10 @@
int i;
bool succeeded;
const char *message;
+ Word *saved_regs;
- entry = this_label->MR_sll_entry;
+ saved_regs = event_info->MR_saved_regs;
+ entry = event_info->MR_event_sll->MR_sll_entry;
call_label = entry->MR_sle_call_label;
if (call_label->MR_sll_var_count < 0) {
@@ -319,8 +323,9 @@
arg_max = 0;
for (i = 0; i < call_label->MR_sll_var_count; i++) {
- arg_value = MR_trace_find_input_arg(this_label, saved_regs,
- input_args->MR_slvs_names[i], &succeeded);
+ arg_value = MR_trace_find_input_arg(event_info->MR_event_sll,
+ saved_regs, input_args->MR_slvs_names[i],
+ &succeeded);
if (! succeeded) {
message = "Cannot perform retry because the values of "
@@ -339,8 +344,8 @@
}
}
- MR_trace_call_seqno = seqno - 1;
- MR_trace_call_depth = depth - 1;
+ MR_trace_call_seqno = event_info->MR_call_seqno - 1;
+ MR_trace_call_depth = event_info->MR_call_depth - 1;
if (MR_DETISM_DET_STACK(entry->MR_sle_detism)) {
MR_Live_Lval location;
@@ -390,7 +395,7 @@
free(args);
}
- *max_mr_num = max(*max_mr_num, arg_max);
+ event_info->MR_max_mr_num = max(event_info->MR_max_mr_num, arg_max);
*jumpaddr = entry->MR_sle_code_addr;
/*
Index: trace/mercury_trace.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.h,v
retrieving revision 1.5
diff -u -t -r1.5 mercury_trace.h
--- mercury_trace.h 1999/02/12 00:16:43 1.5
+++ mercury_trace.h 1999/02/18 17:02:48
@@ -21,6 +21,29 @@
#ifndef MERCURY_TRACE_H
#define MERCURY_TRACE_H
+/*
+** MR_Event_Info is used to hold the information for a trace event. One
+** of these is built by MR_trace_event and is passed (by reference)
+** throughout the tracing system.
+*/
+
+typedef struct MR_Event_Info_Struct {
+ Unsigned MR_event_number;
+ Unsigned MR_call_seqno;
+ Unsigned MR_call_depth;
+ MR_Trace_Port MR_trace_port;
+ const MR_Stack_Layout_Label *MR_event_sll;
+ const char *MR_event_path;
+ Word MR_saved_regs[MAX_FAKE_REG];
+ int MR_max_mr_num;
+} 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 {
int MR_call_seqno;
int MR_call_depth;
@@ -30,10 +53,8 @@
/* The initial size of arrays of argument values. */
#define MR_INIT_ARG_COUNT 20
-const char * MR_trace_retry(const MR_Stack_Layout_Label *layout,
- Word *saved_regs, MR_Event_Details *event_details,
- int seqno, int depth, int *max_mr_num,
- Code **jumpaddr);
+const char * MR_trace_retry(MR_Event_Info *event_info,
+ MR_Event_Details *event_details, Code **jumpaddr);
Word MR_trace_find_input_arg(const MR_Stack_Layout_Label *label,
Word *saved_regs, const char *name, bool *succeeded);
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.1
diff -u -t -r1.1 mercury_trace_declarative.c
--- mercury_trace_declarative.c 1999/01/11 03:52:31 1.1
+++ mercury_trace_declarative.c 1999/02/18 17:03:01
@@ -62,27 +62,19 @@
static void
MR_trace_decl_wrong_answer_call(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth, const char *path,
- int *max_mr_num, int decl_slot);
+ MR_Event_Info *event_info, int decl_slot);
static void
MR_trace_decl_wrong_answer_exit(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth, const char *path,
- int *max_mr_num, int decl_slot);
+ MR_Event_Info *event_info, int decl_slot);
static void
MR_trace_decl_wrong_answer_redo(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth, const char *path,
- int *max_mr_num, int decl_slot);
+ MR_Event_Info *event_info, int decl_slot);
static void
MR_trace_decl_wrong_answer_fail(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth, const char *path,
- int *max_mr_num, int decl_slot);
+ MR_Event_Info *event_info, int decl_slot);
static void
MR_trace_decl_update_path(const MR_Stack_Layout_Label *layout,
@@ -104,18 +96,19 @@
Code *
MR_trace_decl_wrong_answer(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth, const char *path,
- int *max_mr_num)
+ MR_Event_Info *event_info)
{
int decl_slot;
- MR_Stack_Layout_Entry *entry = layout->MR_sll_entry;
+ MR_Stack_Layout_Entry *entry;
MR_Edt_Node *edt_node;
+ Unsigned depth;
+
+ entry = event_info->MR_event_sll->MR_sll_entry;
+ depth = event_info->MR_call_depth;
if (MR_trace_event_number > MR_edt_last_event) {
MR_trace_decl_mode = MR_TRACE_INTERACTIVE;
- return MR_trace_event_internal(cmd, TRUE, layout, saved_regs,
- port, seqno, depth, path, max_mr_num);
+ return MR_trace_event_internal(cmd, TRUE, event_info);
}
if (!MR_ENTRY_LAYOUT_HAS_EXEC_TRACE(entry)) {
@@ -138,33 +131,30 @@
MR_trace_enabled = FALSE;
decl_slot = entry->MR_sle_maybe_decl_debug;
- switch (port) {
+ switch (event_info->MR_trace_port) {
case MR_PORT_CALL:
- MR_trace_decl_wrong_answer_call(cmd, layout,
- saved_regs, port, seqno, depth, path,
- max_mr_num, decl_slot);
+ MR_trace_decl_wrong_answer_call(cmd, event_info,
+ decl_slot);
break;
case MR_PORT_EXIT:
- MR_trace_decl_wrong_answer_exit(cmd, layout,
- saved_regs, port, seqno, depth, path,
- max_mr_num, decl_slot);
+ MR_trace_decl_wrong_answer_exit(cmd, event_info,
+ decl_slot);
break;
case MR_PORT_REDO:
- MR_trace_decl_wrong_answer_redo(cmd, layout,
- saved_regs, port, seqno, depth, path,
- max_mr_num, decl_slot);
+ MR_trace_decl_wrong_answer_redo(cmd, event_info,
+ decl_slot);
break;
case MR_PORT_FAIL:
- MR_trace_decl_wrong_answer_fail(cmd, layout,
- saved_regs, port, seqno, depth, path,
- max_mr_num, decl_slot);
+ MR_trace_decl_wrong_answer_fail(cmd, event_info,
+ decl_slot);
break;
case MR_PORT_THEN:
case MR_PORT_ELSE:
case MR_PORT_DISJ:
case MR_PORT_SWITCH:
- MR_trace_decl_update_path(layout, saved_regs, path,
- decl_slot);
+ MR_trace_decl_update_path(event_info->MR_event_sll,
+ event_info->MR_saved_regs,
+ event_info->MR_event_path, decl_slot);
case MR_PORT_PRAGMA_FIRST:
case MR_PORT_PRAGMA_LATER:
break;
@@ -186,15 +176,17 @@
static void
MR_trace_decl_wrong_answer_call(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth, const char *path,
- int *max_mr_num, int decl_slot)
+ MR_Event_Info *event_info, int decl_slot)
{
MR_Edt_Node *edt_node;
MR_Edt_Node_Type node_tag;
- MR_Stack_Layout_Entry *entry = layout->MR_sll_entry;
+ MR_Stack_Layout_Entry *entry;
+ Word *saved_regs;
+
+ entry = event_info->MR_event_sll->MR_sll_entry;
+ saved_regs = event_info->MR_saved_regs;
- if (depth < MR_edt_max_depth) {
+ if (event_info->MR_call_depth < MR_edt_max_depth) {
node_tag = MR_EDT_WRONG_ANSWER_EXPLICIT;
} else {
/*
@@ -204,7 +196,7 @@
node_tag = MR_EDT_WRONG_ANSWER_IMPLICIT;
}
- edt_node = MR_edt_node_construct(layout, node_tag,
+ edt_node = MR_edt_node_construct(event_info->MR_event_sll, node_tag,
MR_trace_event_number);
if (MR_DETISM_DET_STACK(entry->MR_sle_detism)) {
@@ -228,14 +220,16 @@
static void
MR_trace_decl_wrong_answer_exit(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth, const char *path,
- int *max_mr_num, int decl_slot)
+ MR_Event_Info *event_info, int decl_slot)
{
MR_Edt_Node *edt_node;
- MR_Stack_Layout_Entry *entry = layout->MR_sll_entry;
+ const MR_Stack_Layout_Label *layout;
+ Word *saved_regs;
+
+ layout = event_info->MR_event_sll;
+ saved_regs = event_info->MR_saved_regs;
- if (MR_DETISM_DET_STACK(entry->MR_sle_detism)) {
+ if (MR_DETISM_DET_STACK(layout->MR_sll_entry->MR_sle_detism)) {
edt_node = (MR_Edt_Node *) MR_based_stackvar(
MR_saved_sp(saved_regs), decl_slot);
MR_edt_parent = (MR_Edt_Node *) MR_based_stackvar(
@@ -249,7 +243,7 @@
edt_node->MR_edt_node_layout = layout;
edt_node->MR_edt_node_end_event = MR_trace_event_number;
- edt_node->MR_edt_node_seqno = seqno;
+ edt_node->MR_edt_node_seqno = event_info->MR_call_seqno;
MR_trace_decl_save_args(layout, saved_regs, edt_node);
@@ -262,12 +256,14 @@
static void
MR_trace_decl_wrong_answer_redo(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth, const char *path,
- int *max_mr_num, int decl_slot)
+ MR_Event_Info *event_info, int decl_slot)
{
MR_Edt_Node *edt_node;
- MR_Stack_Layout_Entry *entry = layout->MR_sll_entry;
+ MR_Stack_Layout_Entry *entry;
+ Word *saved_regs;
+
+ entry = event_info->MR_event_sll->MR_sll_entry;
+ saved_regs = event_info->MR_saved_regs;
/*
** Re-use the node that was allocated at the CALL event.
@@ -302,12 +298,14 @@
static void
MR_trace_decl_wrong_answer_fail(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth, const char *path,
- int *max_mr_num, int decl_slot)
+ MR_Event_Info *event_info, int decl_slot)
{
MR_Edt_Node *edt_node;
- MR_Stack_Layout_Entry *entry = layout->MR_sll_entry;
+ MR_Stack_Layout_Entry *entry;
+ Word *saved_regs;
+
+ entry = event_info->MR_event_sll->MR_sll_entry;
+ saved_regs = event_info->MR_saved_regs;
if (MR_DETISM_DET_STACK(entry->MR_sle_detism)) {
edt_node = (MR_Edt_Node *) MR_based_stackvar(
@@ -403,14 +401,14 @@
}
bool
-MR_trace_start_wrong_answer(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Event_Details *event_details, int seqno, int depth,
- int *max_mr_num, Code **jumpaddr)
+MR_trace_start_wrong_answer(MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info,
+ MR_Event_Details *event_details, Code **jumpaddr)
{
- MR_Stack_Layout_Entry *entry = layout->MR_sll_entry;
+ MR_Stack_Layout_Entry *entry;
int decl_slot;
+ entry = event_info->MR_event_sll->MR_sll_entry;
+
if (!MR_ENTRY_LAYOUT_HAS_EXEC_TRACE(entry)) {
return FALSE;
}
@@ -423,13 +421,12 @@
MR_trace_decl_mode = MR_TRACE_WRONG_ANSWER;
MR_edt_parent = MR_edt_node_construct(NULL,
- MR_EDT_WRONG_ANSWER_EXPLICIT, 0);
+ MR_EDT_WRONG_ANSWER_EXPLICIT, 0);
MR_edt_last_event = MR_trace_event_number;
- MR_edt_min_depth = depth;
- MR_edt_max_depth = depth + MR_EDT_DEPTH_STEP_SIZE;
+ MR_edt_min_depth = event_info->MR_call_depth;
+ MR_edt_max_depth = event_info->MR_call_depth + MR_EDT_DEPTH_STEP_SIZE;
- MR_trace_retry(layout, saved_regs, event_details, seqno, depth,
- max_mr_num, jumpaddr);
+ MR_trace_retry(event_info, event_details, jumpaddr);
cmd->MR_trace_cmd = MR_CMD_GOTO;
cmd->MR_trace_stop_event = MR_trace_event_number + 1;
Index: trace/mercury_trace_declarative.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.h,v
retrieving revision 1.1
diff -u -t -r1.1 mercury_trace_declarative.h
--- mercury_trace_declarative.h 1999/01/11 03:52:31 1.1
+++ mercury_trace_declarative.h 1999/02/18 17:03:03
@@ -63,12 +63,12 @@
** The event numbers of the CALL and EXIT events for
** this proof.
*/
- int MR_edt_node_start_event;
- int MR_edt_node_end_event;
+ Unsigned MR_edt_node_start_event;
+ Unsigned MR_edt_node_end_event;
/*
** The sequence number of the CALL and EXIT events.
*/
- int MR_edt_node_seqno;
+ Unsigned MR_edt_node_seqno;
/*
** The rightmost child of this node, or NULL if there
** are no children.
@@ -87,10 +87,7 @@
*/
extern Code *MR_trace_decl_wrong_answer(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout,
- Word *saved_regs, MR_Trace_Port port,
- int seqno, int depth,
- const char *path, int *max_mr_num);
+ MR_Event_Info *event_info);
/*
** The internal (interactive) debugger calls this function to enter
@@ -100,9 +97,7 @@
*/
extern bool MR_trace_start_wrong_answer(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout,
- Word *saved_regs, MR_Event_Details *event_details,
- int seqno, int depth, int *max_mr_num,
- Code **jumpaddr);
+ MR_Event_Info *event_info,
+ MR_Event_Details *event_details, Code **jumpaddr);
#endif /* MERCURY_TRACE_DECLARATIVE_H */
Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.6
diff -u -t -r1.6 mercury_trace_external.c
--- mercury_trace_external.c 1999/02/10 22:31:23 1.6
+++ mercury_trace_external.c 1999/02/18 17:03:09
@@ -327,10 +327,7 @@
}
Code *
-MR_trace_event_external(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, Unsigned seqno, Unsigned depth, const char *path,
- int *max_mr_num)
+MR_trace_event_external(MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info)
{
static bool searching = FALSE;
static Word search_data;
@@ -345,6 +342,13 @@
MR_Event_Details event_details;
char *message;
+ const MR_Stack_Layout_Label *layout = event_info->MR_event_sll;
+ Unsigned seqno = event_info->MR_call_seqno;
+ Unsigned depth = event_info->MR_call_depth;
+ MR_Trace_Port port = event_info->MR_trace_port;
+ const char *path = event_info->MR_event_path;
+ Word *saved_regs = event_info->MR_saved_regs;
+
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;
@@ -430,9 +434,8 @@
fprintf(stderr, "\nMercury runtime: "
"REQUEST_RETRY\n");
}
- message = MR_trace_retry(layout, saved_regs,
- &event_details, seqno, depth,
- max_mr_num, &jumpaddr);
+ message = MR_trace_retry(event_info,
+ &event_details, &jumpaddr);
if (message == NULL) {
MR_send_message_to_socket("ok");
cmd->MR_trace_cmd = MR_CMD_GOTO;
Index: trace/mercury_trace_external.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.h,v
retrieving revision 1.3
diff -u -t -r1.3 mercury_trace_external.h
--- mercury_trace_external.h 1999/02/10 22:31:24 1.3
+++ mercury_trace_external.h 1999/02/18 17:03:09
@@ -12,9 +12,7 @@
extern void MR_trace_init_external(void);
extern void MR_trace_final_external(void);
extern Code *MR_trace_event_external(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout,
- Word *saved_regs, MR_Trace_Port port, Unsigned seqno,
- Unsigned depth, const char *path, int *max_mr_num);
+ MR_Event_Info *event_info);
#endif /* MR_USE_EXTERNAL_DEBUGGER */
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.26
diff -u -t -r1.26 mercury_trace_internal.c
--- mercury_trace_internal.c 1999/02/12 02:50:01 1.26
+++ mercury_trace_internal.c 1999/02/18 17:03:29
@@ -143,11 +143,9 @@
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,
- const MR_Stack_Layout_Label *layout,
- Word *saved_regs, MR_Event_Details *event_details,
- MR_Trace_Port port, int seqno, int depth,
- const char *path, int *ancestor_level,
- int *max_mr_num, Code **jumpaddr);
+ MR_Event_Info *event_info,
+ MR_Event_Details *event_details, int *ancestor_level,
+ Code **jumpaddr);
static bool MR_trace_options_strict_print(MR_Trace_Cmd_Info *cmd,
char ***words, int *word_count,
const char *cat, const char *item);
@@ -208,18 +206,14 @@
static void MR_insert_line_at_tail(const char *line);
static void MR_trace_event_print_internal_report(
- const MR_Stack_Layout_Label *layout,
- MR_Trace_Port port, int seqno, int depth,
- const char *path);
+ MR_Event_Info *event_info);
static void MR_trace_print_port(MR_Trace_Port port);
static bool MR_trace_valid_command(const char *word);
Code *
MR_trace_event_internal(MR_Trace_Cmd_Info *cmd, bool interactive,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth,
- const char *path, int *max_mr_num)
+ MR_Event_Info *event_info)
{
int i;
int c;
@@ -232,21 +226,19 @@
MR_Event_Details event_details;
if (! interactive) {
- return MR_trace_event_internal_report(cmd, layout, saved_regs,
- port, seqno, depth, path, max_mr_num);
+ return MR_trace_event_internal_report(cmd, event_info);
}
#ifdef MR_USE_DECLARATIVE_DEBUGGER
if (MR_trace_decl_mode == MR_TRACE_WRONG_ANSWER) {
- return MR_trace_decl_wrong_answer(cmd, layout, saved_regs,
- port, seqno, depth, path, max_mr_num);
+ return MR_trace_decl_wrong_answer(cmd, event_info);
}
#endif MR_USE_DECLARATIVE_DEBUGGER
MR_trace_enabled = FALSE;
MR_trace_internal_ensure_init();
- MR_trace_event_print_internal_report(layout, port, seqno, depth, path);
+ MR_trace_event_print_internal_report(event_info);
/*
** These globals can be overwritten when we call Mercury code,
@@ -268,9 +260,8 @@
do {
line = MR_trace_getline("mdb> ", MR_mdb_in);
- res = MR_trace_debug_cmd(line, cmd, layout, saved_regs,
- &event_details, port, seqno, depth, path,
- &ancestor_level, max_mr_num, &jumpaddr);
+ res = MR_trace_debug_cmd(line, cmd, event_info, &event_details,
+ &ancestor_level, &jumpaddr);
} while (res == KEEP_INTERACTING);
cmd->MR_trace_must_check = (! cmd->MR_trace_strict) ||
@@ -416,10 +407,8 @@
static MR_Next
MR_trace_debug_cmd(char *line, MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Event_Details *event_details, MR_Trace_Port port,
- int seqno, int depth, const char *path,
- int *ancestor_level, int *max_mr_num, Code **jumpaddr)
+ MR_Event_Info *event_info, MR_Event_Details *event_details,
+ int *ancestor_level, Code **jumpaddr)
{
char **words;
char **orig_words = NULL;
@@ -430,6 +419,13 @@
int i;
int n;
+ Unsigned depth = event_info->MR_call_depth;
+ MR_Trace_Port port = event_info->MR_trace_port;
+ const MR_Stack_Layout_Label
+ *layout = event_info->MR_event_sll;
+ Word *saved_regs = event_info->MR_saved_regs;
+
+
if (line == NULL) {
/*
** We got an EOF.
@@ -673,9 +669,8 @@
}
if (stop_depth == depth && MR_port_is_final(port)) {
- message = MR_trace_retry(layout, saved_regs,
- event_details, seqno, depth, max_mr_num,
- jumpaddr);
+ message = MR_trace_retry(event_info, event_details,
+ jumpaddr);
if (message != NULL) {
fflush(MR_mdb_out);
fprintf(MR_mdb_err, "%s\n", message);
@@ -799,8 +794,7 @@
}
} else if (streq(words[0], "current")) {
if (word_count == 1) {
- MR_trace_event_print_internal_report(layout, port,
- seqno, depth, path);
+ MR_trace_event_print_internal_report(event_info);
} else {
MR_trace_usage("browsing", "current");
}
@@ -1273,9 +1267,8 @@
fprintf(MR_mdb_err,
"mdb: wrong answer analysis is only "
"available from EXIT events.\n");
- } else if (MR_trace_start_wrong_answer(cmd, layout,
- saved_regs, event_details, seqno, depth,
- max_mr_num, jumpaddr)) {
+ } else if (MR_trace_start_wrong_answer(cmd, event_info,
+ event_details, jumpaddr)) {
goto return_stop_interacting;
} else {
fflush(MR_mdb_out);
@@ -2254,9 +2247,7 @@
Code *
MR_trace_event_internal_report(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth, const char *path,
- int *max_mr_num)
+ MR_Event_Info *event_info)
{
char *buf;
int i;
@@ -2290,12 +2281,7 @@
free(buf);
return MR_trace_event_internal(
cmd, TRUE,
- layout,
- saved_regs,
- port,
- seqno, depth,
- path,
- max_mr_num);
+ event_info);
default:
fflush(MR_mdb_out);
@@ -2313,21 +2299,23 @@
MR_scroll_next = 0;
}
- MR_trace_event_print_internal_report(layout, port, seqno, depth, path);
+ MR_trace_event_print_internal_report(event_info);
MR_scroll_next++;
return NULL;
}
void
-MR_trace_event_print_internal_report(const MR_Stack_Layout_Label *layout,
- MR_Trace_Port port, int seqno, int depth, const char *path)
+MR_trace_event_print_internal_report(MR_Event_Info *event_info)
{
fprintf(MR_mdb_out, "%8ld: %6ld %2ld ",
- (long) MR_trace_event_number, (long) seqno, (long) depth);
-
- MR_trace_print_port(port);
- MR_print_proc_id(MR_mdb_out, layout->MR_sll_entry, path, NULL, NULL);
+ (long) event_info->MR_event_number,
+ (long) event_info->MR_call_seqno,
+ (long) event_info->MR_call_depth);
+
+ MR_trace_print_port(event_info->MR_trace_port);
+ MR_print_proc_id(MR_mdb_out, event_info->MR_event_sll->MR_sll_entry,
+ event_info->MR_event_path, NULL, NULL);
}
static void
Index: trace/mercury_trace_internal.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.h,v
retrieving revision 1.5
diff -u -t -r1.5 mercury_trace_internal.h
--- mercury_trace_internal.h 1999/02/10 22:31:22 1.5
+++ mercury_trace_internal.h 1999/02/18 17:03:30
@@ -36,17 +36,11 @@
#endif /* MR_USE_DECLARATIVE_DEBUGGER */
extern Code *MR_trace_event_internal(MR_Trace_Cmd_Info *cmd,
- bool interactive,
- const MR_Stack_Layout_Label *layout,
- Word *saved_regs, MR_Trace_Port port,
- int seqno, int depth,
- const char *path, int *max_mr_num);
+ bool interactive, MR_Event_Info *event_info);
extern Code *MR_trace_event_internal_report(MR_Trace_Cmd_Info *cmd,
- const MR_Stack_Layout_Label *layout, Word *saved_regs,
- MR_Trace_Port port, int seqno, int depth,
- const char *path, int *max_mr_num);
+ MR_Event_Info *event_info);
/*
** Debugger I/O streams.
--
Mark Brown (dougl at cs.mu.oz.au) )O+ | For Microsoft to win,
MEngSc student, | the customer must lose
Dept of Computer Science, Melbourne Uni | -- Eric S. Raymond
More information about the developers
mailing list