[m-rev.] for review: add `info' declarative debugger response
Ian MacLarty
maclarty at cs.mu.OZ.AU
Sat Feb 26 22:24:55 AEDT 2005
For review by anyone.
Estimated hours taken: 6
Branches: main
Add a new declarative debugger response, `info', which shows some information
about the current question and the state of the bug search.
browser/declarative_analyser.m
Add the show_info predicate.
browser/declarative_debugger.m
Handle the oracle show_info response.
browser/declarative_edt.m
Add a new method to the mercury_edt typeclass, edt_context,
which returns the filename and line number of the predicate for
a node.
browser/declarative_execution.m
Instead of recording the goal path of a call in its parent, record
the return label. The goal path and the parent context can then
be derived from the return label.
Add a function to get the goal path from a return label.
Add a function to get the context of a label.
Modify the exported predicates used to build the annotated trace
to take a return label instead of the goal path.
browser/declarative_oracle.m
Add a `show_info' oracle response.
browser/declarative_tree.m
Implement trace_context which returns the filename and line number
of the predicate that corresponds with a node in the annotated trace.
Derive a call's goal path in its caller from the return label where
necessary.
browser/declarative_user.m
Add and document the user response `info'.
browser/dice.m
Fix a line that was over 79 characters.
tests/debugger/declarative/Mmakefile
tests/debugger/declarative/info.exp
tests/debugger/declarative/info.inp
tests/debugger/declarative/info.m
Test the new response.
trace/mercury_trace_declarative.c
Pass the return label when constructing the annotated trace.
Index: browser/declarative_analyser.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_analyser.m,v
retrieving revision 1.19
diff -u -r1.19 declarative_analyser.m
--- browser/declarative_analyser.m 13 Jan 2005 11:14:47 -0000 1.19
+++ browser/declarative_analyser.m 26 Feb 2005 10:34:31 -0000
@@ -22,7 +22,7 @@
:- import_module mdb.io_action.
:- import_module mdb.declarative_edt.
-:- import_module std_util.
+:- import_module std_util, io.
:- type analyser_response(T)
@@ -87,6 +87,12 @@
analyser_response(T)::out, analyser_state(T)::in,
analyser_state(T)::out) is det <= mercury_edt(S, T).
+ % Display information about the current question and the state
+ % of the search to the supplied output stream.
+ %
+:- pred show_info(S::in, io.output_stream::in, analyser_state(T)::in,
+ analyser_response(T)::out, io::di, io::uo) is det <= mercury_edt(S, T).
+
% Revise the current analysis. This is done when a bug determined
% by the analyser has been overruled by the oracle.
%
@@ -106,7 +112,8 @@
:- import_module mdb.declarative_edt.
:- import_module mdbcomp.program_representation.
-:- import_module exception, string, map, int, counter, array, list.
+:- import_module exception, counter, array, list, float.
+:- import_module math, string, map, int.
% Describes what search strategy is being used by the analyser and the
% state of the search.
@@ -344,6 +351,12 @@
SearchSpace),
!:Analyser = !.Analyser ^ search_space := SearchSpace.
+ % process_answer shouldn't be called with a show_info oracle response.
+ %
+process_answer(_, show_info(_), _, _, _) :-
+ throw(internal_error("process_answer", "called with show_info/1")).
+
+
process_answer(Store, suspicious_subterm(Node, ArgPos, TermPath), SuspectId,
!Analyser) :-
%
@@ -1011,3 +1024,97 @@
NewMax = PrevMax,
NewSuspectId = PrevSuspectId
).
+
+%-----------------------------------------------------------------------------%
+
+show_info(Store, OutStream, Analyser, Response, !IO) :-
+ SearchSpace = Analyser ^ search_space,
+ some [!FieldNames, !Data] (
+ !:FieldNames = [],
+ !:Data = [],
+ %
+ % Get the context of the current question.
+ %
+ (
+ Analyser ^ last_search_question = yes(LastQuestionId),
+ (
+ edt_context(Store, get_edt_node(SearchSpace,
+ LastQuestionId), FileName - LineNo,
+ MaybeReturnContext)
+ ->
+ (
+ MaybeReturnContext =
+ yes(ReturnFileName -
+ ReturnLineNo),
+ ContextStr = FileName ++ ":" ++
+ int_to_string(LineNo) ++
+ " (" ++ ReturnFileName ++ ":"
+ ++ int_to_string(ReturnLineNo)
+ ++ ")"
+ ;
+ MaybeReturnContext = no,
+ ContextStr = FileName ++ ":" ++
+ int_to_string(LineNo)
+ ),
+ list.append(!.FieldNames,
+ ["Context of current question"],
+ !:FieldNames),
+ list.append(!.Data, [ContextStr], !:Data)
+ ;
+ true
+ )
+ ;
+ Analyser ^ last_search_question = no,
+ throw(internal_error("show_info", "no last question"))
+ ),
+
+ list.append(!.FieldNames, ["Search mode"],
+ !:FieldNames),
+ list.append(!.Data, [search_mode_to_string(
+ Analyser ^ search_mode)], !:Data),
+
+ (
+ Analyser ^ search_mode = divide_and_query
+ ->
+ list.append(!.FieldNames,
+ ["Estimated questions remaining"],
+ !:FieldNames),
+ EstimatedQuestions = float.ceiling_to_int(
+ math.log2(float(Weight))),
+ list.append(!.Data,
+ [int_to_string(EstimatedQuestions)], !:Data)
+ ;
+ true
+ ),
+
+ list.append(!.FieldNames, ["Number of suspect events"],
+ !:FieldNames),
+ (
+ root(SearchSpace, RootId)
+ ->
+ StartId = RootId
+ ;
+ topmost_det(SearchSpace, StartId)
+ ),
+ Weight = get_weight(SearchSpace, StartId),
+ list.append(!.Data, [int_to_string_thousands(Weight)], !:Data),
+
+ InfoMessage = string.format_table([left(!.FieldNames),
+ left(!.Data)], " : ")
+ ),
+ io.nl(OutStream, !IO),
+ io.write_string(OutStream, InfoMessage, !IO),
+ io.nl(OutStream, !IO),
+ io.nl(OutStream, !IO),
+ Node = get_edt_node(SearchSpace, LastQuestionId),
+ edt_question(Analyser ^ io_action_map, Store, Node,
+ OracleQuestion),
+ Response = oracle_question(OracleQuestion).
+
+:- func search_mode_to_string(search_mode) = string.
+
+search_mode_to_string(top_down) = "top down".
+search_mode_to_string(follow_subterm_end(_, _, _, _)) =
+ "tracking marked sub-term".
+search_mode_to_string(binary(_, _, _)) = "binary search on path".
+search_mode_to_string(divide_and_query) = "divide and query".
Index: browser/declarative_debugger.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_debugger.m,v
retrieving revision 1.52
diff -u -r1.52 declarative_debugger.m
--- browser/declarative_debugger.m 22 Feb 2005 05:17:28 -0000 1.52
+++ browser/declarative_debugger.m 24 Feb 2005 03:07:40 -0000
@@ -184,7 +184,12 @@
; ignore(T)
% The oracle has deferred answering this question.
- ; skip(T).
+ ; skip(T)
+
+ % The oracle has requested that the analyser display
+ % information about the state of the search and
+ % the last question asked.
+ ; show_info(io.output_stream).
% The evidence that a certain node is a bug. This consists of the
% smallest set of questions whose answers are sufficient to
@@ -465,6 +470,14 @@
continue_analysis(wrap(Store), Answer, AnalyserResponse,
Analyser0, Analyser),
diagnoser_set_analyser(Analyser, !Diagnoser),
+ debug_analyser_state(Analyser, MaybeOrigin),
+ handle_analyser_response(Store, AnalyserResponse, MaybeOrigin,
+ Response, !Diagnoser, !IO).
+
+handle_oracle_response(Store, show_info(OutStream), Response, !Diagnoser, !IO)
+ :-
+ diagnoser_get_analyser(!.Diagnoser, Analyser),
+ show_info(wrap(Store), OutStream, Analyser, AnalyserResponse, !IO),
debug_analyser_state(Analyser, MaybeOrigin),
handle_analyser_response(Store, AnalyserResponse, MaybeOrigin,
Response, !Diagnoser, !IO).
Index: browser/declarative_edt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_edt.m,v
retrieving revision 1.4
diff -u -r1.4 declarative_edt.m
--- browser/declarative_edt.m 13 Jan 2005 11:14:47 -0000 1.4
+++ browser/declarative_edt.m 26 Feb 2005 10:38:19 -0000
@@ -146,7 +146,16 @@
% comment at the top of this module for the meaning of
% the weight of a node.
%
- pred edt_weight(S::in, T::in, int::out, int::out) is det
+ pred edt_weight(S::in, T::in, int::out, int::out) is det,
+
+ % Return the filename and line number of the predicate
+ % associated with the given node. Also return the parent
+ % context if available. Sometimes the main context may
+ % not be available (for example exception nodes). In this case
+ % fail.
+ %
+ pred edt_context(S::in, T::in, pair(string, int)::out,
+ maybe(pair(string, int))::out) is semidet
].
:- type subterm_mode
Index: browser/declarative_execution.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_execution.m,v
retrieving revision 1.38
diff -u -r1.38 declarative_execution.m
--- browser/declarative_execution.m 22 Feb 2005 05:17:28 -0000 1.38
+++ browser/declarative_execution.m 24 Feb 2005 09:16:46 -0000
@@ -50,9 +50,9 @@
% At the maximum depth?
call_proc_rep :: maybe(proc_rep),
% Body of the called procedure.
- call_goal_path :: goal_path_string,
- % The goal path of the call
- % *in its parent*.
+ call_return_label :: maybe(label_layout),
+ % The return label, if there
+ % is one.
call_label :: label_layout,
call_io_seq_num :: int
% The I/O action sequence
@@ -228,6 +228,11 @@
:- func get_goal_path_from_label_layout(label_layout) = goal_path_string.
+:- func get_goal_path_from_maybe_label(maybe(label_layout)) = goal_path_string.
+
+:- pred get_context_from_label_layout(label_layout::in, string::out, int::out)
+ is semidet.
+
%-----------------------------------------------------------------------------%
% If the following type is modified, some of the macros in
@@ -618,6 +623,22 @@
GoalPath = (MR_String)MR_label_goal_path(Label);
").
+get_goal_path_from_maybe_label(yes(Label))
+ = get_goal_path_from_label_layout(Label).
+get_goal_path_from_maybe_label(no) = "".
+
+:- pragma foreign_proc("C", get_context_from_label_layout(Label::in,
+ FileName::out, LineNo::out),
+ [will_not_call_mercury, thread_safe, promise_pure],
+"
+ const char *filename;
+
+ SUCCESS_INDICATOR = MR_find_context(Label, &filename, &LineNo);
+ MR_TRACE_USE_HP(
+ MR_make_aligned_string(FileName, (MR_String) filename);
+ );
+").
+
%-----------------------------------------------------------------------------%
get_trace_exit_atom(exit(_, _, _, AtomArgs, _, Label, _)) = Atom :-
@@ -1106,28 +1127,38 @@
%
:- func construct_call_node(trace_node_id, list(trace_atom_arg),
- sequence_number, event_number, bool, string, label_layout, int)
- = trace_node(trace_node_id).
+ sequence_number, event_number, bool, maybe(label_layout),
+ label_layout, int) = trace_node(trace_node_id).
:- pragma export(construct_call_node(in, in, in, in, in, in, in, in) = out,
"MR_DD_construct_call_node").
-construct_call_node(Preceding, AtomArgs, SeqNo, EventNo, MaxDepth, Path, Label,
- IoSeqNum) = Call :-
+construct_call_node(Preceding, AtomArgs, SeqNo, EventNo, MaxDepth,
+ MaybeReturnLabel, Label, IoSeqNum) = Call :-
Call = call(Preceding, Answer, AtomArgs, SeqNo, EventNo, MaxDepth,
- no, Path, Label, IoSeqNum),
+ no, MaybeReturnLabel, Label, IoSeqNum),
null_trace_node_id(Answer).
:- func construct_call_node_with_goal(trace_node_id, list(trace_atom_arg),
- sequence_number, event_number, bool, proc_rep, string, label_layout,
- int) = trace_node(trace_node_id).
+ sequence_number, event_number, bool, proc_rep, maybe(label_layout),
+ label_layout, int) = trace_node(trace_node_id).
:- pragma export(construct_call_node_with_goal(in, in, in, in, in, in, in, in,
in) = out, "MR_DD_construct_call_node_with_goal").
construct_call_node_with_goal(Preceding, AtomArgs, SeqNo, EventNo, MaxDepth,
- ProcRep, Path, Label, IoSeqNum) = Call :-
+ ProcRep, MaybeReturnLabel, Label, IoSeqNum) = Call :-
Call = call(Preceding, Answer, AtomArgs, SeqNo, EventNo, MaxDepth,
- yes(ProcRep), Path, Label, IoSeqNum),
+ yes(ProcRep), MaybeReturnLabel, Label, IoSeqNum),
null_trace_node_id(Answer).
+
+:- func make_yes_maybe_label(label_layout) = maybe(label_layout).
+:- pragma export(make_yes_maybe_label(in) = out, "MR_DD_make_yes_maybe_label").
+
+make_yes_maybe_label(Label) = yes(Label).
+
+:- func make_no_maybe_label = maybe(label_layout).
+:- pragma export(make_no_maybe_label = out, "MR_DD_make_no_maybe_label").
+
+make_no_maybe_label = no.
:- func construct_exit_node(trace_node_id, trace_node_id, trace_node_id,
list(trace_atom_arg), event_number, label_layout, int)
Index: browser/declarative_oracle.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_oracle.m,v
retrieving revision 1.39
diff -u -r1.39 declarative_oracle.m
--- browser/declarative_oracle.m 1 Feb 2005 07:11:26 -0000 1.39
+++ browser/declarative_oracle.m 24 Feb 2005 03:08:51 -0000
@@ -38,6 +38,7 @@
%
:- type oracle_response(T)
---> oracle_answer(decl_answer(T))
+ ; show_info(io.output_stream)
; exit_diagnosis(T)
; abort_diagnosis.
@@ -190,6 +191,9 @@
OracleResponse = oracle_answer(
ignore(get_decl_question_node(Question)))
;
+ UserResponse = show_info(OutStream),
+ OracleResponse = show_info(OutStream)
+ ;
UserResponse = exit_diagnosis(Node),
OracleResponse = exit_diagnosis(Node)
;
@@ -571,6 +575,8 @@
assert_oracle_kb(_, ignore(_), KB, KB).
assert_oracle_kb(_, skip(_), KB, KB).
+
+assert_oracle_kb(_, show_info(_), KB, KB).
assert_oracle_kb(wrong_answer(_, _, Atom), truth_value(_, Truth), KB0, KB) :-
get_kb_ground_map(KB0, Map0),
Index: browser/declarative_tree.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_tree.m,v
retrieving revision 1.21
diff -u -r1.21 declarative_tree.m
--- browser/declarative_tree.m 22 Feb 2005 05:17:29 -0000 1.21
+++ browser/declarative_tree.m 26 Feb 2005 09:38:13 -0000
@@ -65,7 +65,8 @@
pred(edt_is_implicit_root/2) is trace_is_implicit_root,
pred(edt_same_nodes/3) is trace_same_event_numbers,
pred(edt_topmost_node/2) is trace_topmost_node,
- pred(edt_weight/4) is trace_weight
+ pred(edt_weight/4) is trace_weight,
+ pred(edt_context/4) is trace_context
].
%-----------------------------------------------------------------------------%
@@ -378,6 +379,31 @@
"not a final event"))
).
+:- pred trace_context(wrap(S)::in, edt_node(R)::in, pair(string, int)::out,
+ maybe(pair(string, int))::out) is semidet <= annotated_trace(S, R).
+
+trace_context(wrap(Store), dynamic(Ref), FileName - LineNo, MaybeReturnContext)
+ :-
+ det_trace_node_from_id(Store, Ref, Final),
+ (
+ Final = exit(_, CallId, _, _, _, Label, _)
+ ;
+ Final = fail(_, CallId, _, _, Label)
+ ;
+ Final = excp(_, CallId, _, _, _, Label)
+ ),
+ get_context_from_label_layout(Label, FileName, LineNo),
+ call_node_from_id(Store, CallId, Call),
+ (
+ Call ^ call_return_label = yes(ReturnLabel),
+ get_context_from_label_layout(ReturnLabel, ReturnFileName,
+ ReturnLineNo),
+ MaybeReturnContext = yes(ReturnFileName - ReturnLineNo)
+ ;
+ Call ^ call_return_label = no,
+ MaybeReturnContext = no
+ ).
+
:- pred missing_answer_special_case(trace_atom::in) is semidet.
missing_answer_special_case(Atom) :-
@@ -814,7 +840,8 @@
find_chain_start_inside(Store, CallId, CallNode, ArgPos, ChainStart) :-
CallPrecId = CallNode ^ call_preceding,
CallAtom = get_trace_call_atom(CallNode),
- CallPathStr = CallNode ^ call_goal_path,
+ CallPathStr = get_goal_path_from_maybe_label(
+ CallNode ^ call_return_label),
path_from_string_det(CallPathStr, CallPath),
StartLoc = parent_goal(CallId, CallNode),
absolute_arg_num(ArgPos, CallAtom, ArgNum),
@@ -1038,8 +1065,9 @@
:- pred contour_at_end_path(assoc_list(R, trace_node(R))::in,
maybe(goal_path)::in) is semidet.
-contour_at_end_path([_ - call(_, _, _, _, _, _, _, CallPathStr, _, _)],
+contour_at_end_path([_ - call(_, _, _, _, _, _, _, MaybeReturnLabel, _, _)],
yes(EndPath)) :-
+ CallPathStr = get_goal_path_from_maybe_label(MaybeReturnLabel),
path_from_string_det(CallPathStr, CallPath),
CallPath = EndPath.
@@ -1253,8 +1281,10 @@
->
(
ContourHeadNode = call(_, _, _, _, _, _, _,
- CallPathStr, _, _),
+ MaybeReturnLabel, _, _),
Atom = get_trace_call_atom(ContourHeadNode),
+ CallPathStr = get_goal_path_from_maybe_label(
+ MaybeReturnLabel),
path_from_string_det(CallPathStr, CallPath),
CallPath = EndPath
->
Index: browser/declarative_user.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_user.m,v
retrieving revision 1.44
diff -u -r1.44 declarative_user.m
--- browser/declarative_user.m 22 Feb 2005 22:27:48 -0000 1.44
+++ browser/declarative_user.m 26 Feb 2005 11:05:48 -0000
@@ -29,6 +29,10 @@
---> user_answer(decl_question(T), decl_answer(T))
; trust_predicate(decl_question(T))
; trust_module(decl_question(T))
+ % Request that the analyser display some information
+ % about the state of the search and the current
+ % question to the given output stream.
+ ; show_info(io.output_stream)
; exit_diagnosis(T)
; abort_diagnosis.
@@ -202,6 +206,8 @@
!User, !IO) :-
Question = get_decl_question(UserQuestion).
+handle_command(info, _, show_info(!.User ^ outstr), !User, !IO).
+
handle_command(browse_io(ActionNum), UserQuestion, Response,
!User, !IO) :-
Question = get_decl_question(UserQuestion),
@@ -641,7 +647,10 @@
% Trust the module being asked about.
; trust_module
-
+
+ % Print some information about the current question.
+ ; info
+
% Abort this diagnosis session.
; abort
@@ -682,6 +691,8 @@
"\tp io <n-m>\tprint io <n-m>\tprint the atom's nth to mth I/O actions\n",
"\tset [-APBfpv] <param> <value>\t",
"set a term browser parameter value\n",
+ "\tinfo\t\t\tDisplay some information about the current\n",
+ "\t\t\t\tquestion and the state of the bug search.\n",
"\tpd\t\t\tcommence procedural debugging from this point\n",
"\ta\tabort\t\t",
"abort this diagnosis session and return to mdb\n",
@@ -752,6 +763,7 @@
cmd_handler("?", one_word_cmd(help)).
cmd_handler("h", one_word_cmd(help)).
cmd_handler("help", one_word_cmd(help)).
+cmd_handler("info", one_word_cmd(info)).
cmd_handler("b", browse_arg_cmd).
cmd_handler("browse", browse_arg_cmd).
cmd_handler("p", print_arg_cmd).
Index: browser/dice.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/dice.m,v
retrieving revision 1.2
diff -u -r1.2 dice.m
--- browser/dice.m 18 Feb 2005 04:05:33 -0000 1.2
+++ browser/dice.m 26 Feb 2005 06:22:00 -0000
@@ -427,7 +427,8 @@
:- func format_float(int, float) = string.
-format_float(DecimalPlaces, Flt) = string.format("%.*f", [i(DecimalPlaces), f(Flt)]).
+format_float(DecimalPlaces, Flt)
+ = string.format("%.*f", [i(DecimalPlaces), f(Flt)]).
:- pred deconstruct_label_count(label_count::in, proc_label::out,
path_port::out, int::out, int::out, int::out, int::out) is det.
Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.72
diff -u -r1.72 Mmakefile
--- tests/debugger/declarative/Mmakefile 19 Jan 2005 09:55:20 -0000 1.72
+++ tests/debugger/declarative/Mmakefile 24 Feb 2005 09:35:44 -0000
@@ -39,6 +39,7 @@
ignore \
if_then_else \
inadmissible \
+ info \
input_term_dep \
io_stream_test \
ite_2 \
@@ -322,6 +323,10 @@
inadmissible.out: inadmissible inadmissible.inp
$(MDB_STD) ./inadmissible < inadmissible.inp \
> inadmissible.out 2>&1 \
+ || { grep . $@ /dev/null; exit 1; }
+
+info.out: info info.inp
+ $(MDB_STD) ./info < info.inp > info.out 2>&1 \
|| { grep . $@ /dev/null; exit 1; }
input_term_dep.out: input_term_dep input_term_dep.inp
Index: tests/debugger/declarative/info.exp
===================================================================
RCS file: tests/debugger/declarative/info.exp
diff -N tests/debugger/declarative/info.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/info.exp 26 Feb 2005 10:29:03 -0000
@@ -0,0 +1,34 @@
+ E1: C1 CALL pred info.main/2-0 (det) info.m:13
+mdb> mdb> Contexts will not be printed.
+mdb> echo on
+Command echo enabled.
+mdb> s
+ E2: C2 CALL pred info.p/1-0 (det)
+mdb> f
+ E3: C2 EXIT pred info.p/1-0 (det)
+mdb> dd
+p(1)
+Valid? info
+
+Context of current question : info.m:19 (info.m:14)
+Search mode : top down
+Number of suspect events : 2
+
+p(1)
+Valid? a
+Diagnosis aborted.
+ E3: C2 EXIT pred info.p/1-0 (det)
+mdb> dd -s divide_and_query
+p(1)
+Valid? info
+
+Context of current question : info.m:19 (info.m:14)
+Search mode : divide and query
+Estimated questions remaining : 1
+Number of suspect events : 2
+
+p(1)
+Valid? a
+Diagnosis aborted.
+ E3: C2 EXIT pred info.p/1-0 (det)
+mdb> quit -y
Index: tests/debugger/declarative/info.inp
===================================================================
RCS file: tests/debugger/declarative/info.inp
diff -N tests/debugger/declarative/info.inp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/info.inp 26 Feb 2005 10:21:27 -0000
@@ -0,0 +1,12 @@
+register --quiet
+context none
+echo on
+s
+f
+dd
+info
+a
+dd -s divide_and_query
+info
+a
+quit -y
Index: tests/debugger/declarative/info.m
===================================================================
RCS file: tests/debugger/declarative/info.m
diff -N tests/debugger/declarative/info.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/info.m 24 Feb 2005 09:29:38 -0000
@@ -0,0 +1,19 @@
+:- module info.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module int.
+
+main(!IO) :-
+ p(X),
+ io.write(X, !IO).
+
+:- pred p(int::out) is det.
+
+p(1).
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.80
diff -u -r1.80 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c 22 Feb 2005 05:17:29 -0000 1.80
+++ trace/mercury_trace_declarative.c 24 Feb 2005 09:21:28 -0000
@@ -565,6 +565,7 @@
MR_String goal_path;
MR_Word *base_sp;
MR_Word *base_curfr;
+ MR_Word maybe_return_label;
if (MR_edt_depth == MR_edt_max_depth) {
at_depth_limit = MR_TRUE;
@@ -592,10 +593,10 @@
*/
if (result == MR_STEP_OK && return_label_layout != NULL) {
- goal_path = (MR_String) (MR_Integer)
- MR_label_goal_path(return_label_layout);
+ maybe_return_label = MR_DD_make_yes_maybe_label(
+ return_label_layout);
} else {
- goal_path = (MR_String) (MR_Integer) "";
+ maybe_return_label = MR_DD_make_no_maybe_label();
}
MR_TRACE_CALL_MERCURY(
@@ -606,7 +607,7 @@
(MR_Word) event_info->MR_call_seqno,
(MR_Word) event_info->MR_event_number,
(MR_Word) at_depth_limit, proc_rep,
- goal_path, event_label_layout,
+ maybe_return_label, event_label_layout,
MR_io_tabling_counter);
} else {
node = (MR_Trace_Node)
@@ -614,8 +615,8 @@
atom_args,
(MR_Word) event_info->MR_call_seqno,
(MR_Word) event_info->MR_event_number,
- (MR_Word) at_depth_limit, goal_path,
- event_label_layout,
+ (MR_Word) at_depth_limit,
+ maybe_return_label, event_label_layout,
MR_io_tabling_counter);
}
);
--------------------------------------------------------------------------
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