[m-rev.] for review: add line numbers in Morphine
Erwan Jahier
Erwan.Jahier at irisa.fr
Thu Jun 21 02:14:02 AEST 2001
Estimated hours taken: 3
Branch: main
Add line numbers in Morphine.
trace/mercury_trace_external.c
Modify MR_output_current_slots() so that it takes a MR_Event_Info *
rather than a MR_Label_Layout *. The reason is that I need it to
get the parent of the current event. I need the parent of the current
goal because I want the line number where the call is made,
not the one where the procedure is defined.
Add the line number as an output of ML_DI_output_current_slots_*.
browser/util.m
Define the line_number type.
browser/debugger_interface.m
Add the line number as argument of output_current_slots/13.
extras/morphine/source/current_slots.op
Add the line number as argument of current_attributes/12.
extras/morphine/source/display.op
Add the line number as argument of attribute_display/12 and
of the attribute_display parameter.
extras/morphine/source/event_attributes.op
Define the new event attribute alias.
extras/morphine/non-regression-tests/queens.exp:
Update the expected output of the non-regression test.
extras/morphine/non-regression-tests/queens.in:
Disable the testing of the browser as it is currently broken.
-------------- next part --------------
Index: browser/debugger_interface.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/debugger_interface.m,v
retrieving revision 1.18
diff -u -d -u -r1.18 debugger_interface.m
--- browser/debugger_interface.m 2000/10/01 03:13:39 1.18
+++ browser/debugger_interface.m 2001/06/20 16:07:01
@@ -196,7 +196,8 @@
arity,
int, % mode number
determinism,
- goal_path_string
+ goal_path_string,
+ line_number
)
% responses to current_slots for compiler generated event
; current_slots_comp(
@@ -211,7 +212,8 @@
arity,
int, % mode number
determinism,
- goal_path_string
+ goal_path_string,
+ line_number
)
% responses to current_vars
; current_vars(list(univ), list(string))
@@ -275,24 +277,24 @@
% except the list of arguments.
:- pragma export(output_current_slots_user(in, in, in, in, in, in, in, in,
- in, in, in, in, in, di, uo), "ML_DI_output_current_slots_user").
+ in, in, in, in, in, in, di, uo), "ML_DI_output_current_slots_user").
:- pred output_current_slots_user(event_number, call_number, depth_number,
trace_port_type, pred_or_func, /* declarated module name */ string,
/* definition module name */ string, /* pred name */ string, arity,
- /* mode num */ int, determinism, goal_path_string,
+ /* mode num */ int, determinism, goal_path_string, line_number,
io__output_stream, io__state, io__state).
:- mode output_current_slots_user(in, in, in, in, in, in, in, in, in, in,
- in, in, in,di, uo) is det.
+ in, in, in, in, di, uo) is det.
output_current_slots_user(EventNumber, CallNumber, DepthNumber, Port,
PredOrFunc, DeclModuleName, DefModuleName, PredName, Arity, ModeNum,
- Determinism, Path, OutputStream) -->
+ Determinism, Path, LineNo, OutputStream) -->
{ CurrentTraceInfo = current_slots_user(EventNumber, CallNumber,
DepthNumber, Port, PredOrFunc, DeclModuleName, DefModuleName,
- PredName, Arity, ModeNum, Determinism, Path) },
+ PredName, Arity, ModeNum, Determinism, Path, LineNo) },
io__write(OutputStream, CurrentTraceInfo),
io__print(OutputStream, ".\n"),
io__flush_output(OutputStream).
@@ -302,24 +304,24 @@
% except the list of arguments.
:- pragma export(output_current_slots_comp(in, in, in, in, in, in, in,
- in, in, in, in, in, in, di, uo), "ML_DI_output_current_slots_comp").
+ in, in, in, in, in, in, in, di, uo), "ML_DI_output_current_slots_comp").
:- pred output_current_slots_comp(event_number, call_number, depth_number,
trace_port_type, /* name type */ string, /* module type */ string,
/* definition module */ string, /* pred name */ string, arity,
- /* mode num */ int, determinism, goal_path_string,
+ /* mode num */ int, determinism, goal_path_string, line_number,
io__output_stream, io__state, io__state).
:- mode output_current_slots_comp(in, in, in, in, in, in, in, in, in, in,
- in, in, in, di, uo) is det.
+ in, in, in, in, di, uo) is det.
output_current_slots_comp(EventNumber, CallNumber, DepthNumber, Port,
NameType, ModuleType, DefModuleName, PredName, Arity,
- ModeNum, Determinism, Path, OutputStream) -->
+ ModeNum, Determinism, Path, LineNo, OutputStream) -->
{ CurrentTraceInfo = current_slots_comp(EventNumber, CallNumber,
DepthNumber, Port, NameType, ModuleType, DefModuleName,
- PredName, Arity, ModeNum, Determinism, Path) },
+ PredName, Arity, ModeNum, Determinism, Path, LineNo) },
io__write(OutputStream, CurrentTraceInfo),
io__print(OutputStream, ".\n"),
io__flush_output(OutputStream).
Index: browser/util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/util.m,v
retrieving revision 1.12
diff -u -d -u -r1.12 util.m
--- browser/util.m 2001/01/29 06:47:12 1.12
+++ browser/util.m 2001/06/20 16:07:01
@@ -44,6 +44,8 @@
:- type goal_path_string == string.
+:- type line_number == int.
+
% Get user input via the same method used by the internal
% debugger.
:- pred util__trace_getline(string, io__result(string), io__state,
Index: extras/morphine/non-regression-tests/queens.exp
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/non-regression-tests/queens.exp,v
retrieving revision 1.6
diff -u -d -u -r1.6 queens.exp
--- extras/morphine/non-regression-tests/queens.exp 2001/03/08 10:19:08 1.6
+++ extras/morphine/non-regression-tests/queens.exp 2001/06/20 16:07:05
@@ -1,3 +1,5 @@
+ECLiPSe Constraint Logic Programming System [kernel]
+Version 4.1.0, Copyright IC-Parc and ICL, Sun Feb 21 18:37 1999
[morphine 1]:
Copyright (C) 1999-2001 INRIA/INSA de Rennes.
**************************************************
@@ -7,26 +9,26 @@
**************************************************
**** Display the first 20 events:
Start debugging queens program.
- 1: 1 [1] call main(state('<<c_pointer>>'), -) []
- 2: 2 [2] call data(-) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
- 4: 3 [2] call queen([1, 2, 3, 4, 5], -) []
- 5: 4 [3] call qperm([1, 2, 3, 4, 5], -) []
- 6: 4 [3] switch qperm([1, 2, 3, 4, 5], -) [s1]
- 7: 5 [4] call qdelete(-, [1, 2, 3, 4, 5], -) []
- 8: 5 [4] disj qdelete(-, [1, 2, 3, 4, 5], -) [c2, d1]
- 9: 5 [4] exit qdelete(1, [1, 2, 3, 4, 5], [2, 3, 4, 5]) []
- 10: 6 [4] call qperm([2, 3, 4, 5], -) []
- 11: 6 [4] switch qperm([2, 3, 4, 5], -) [s1]
- 12: 7 [5] call nondet (predicate) {queens} queens: qdelete(-, [2, 3, 4, 5] {list__list(int)}, -)/3-0 []
- 13: 7 [5] disj nondet (predicate) {queens} queens: qdelete(-, [2, 3, 4, 5] {list__list(int)}, -)/3-0 [c2, d1]
- 14: 7 [5] exit nondet (predicate) {queens} queens: qdelete(2 {int}, [2, 3, 4, 5] {list__list(int)}, [3, 4, 5] {list__list(int)})/3-0 []
- 15: 8 [5] call nondet (predicate) {queens} queens: qperm([3, 4, 5] {list__list(int)}, -)/2-0 []
- 16: 8 [5] switch nondet (predicate) {queens} queens: qperm([3, 4, 5] {list__list(int)}, -)/2-0 [s1]
- 17: 9 [6] call nondet (predicate) {queens} queens: qdelete(-, [3, 4, 5] {list__list(int)}, -)/3-0 []
- 18: 9 [6] disj nondet (predicate) {queens} queens: qdelete(-, [3, 4, 5] {list__list(int)}, -)/3-0 [c2, d1]
- 19: 9 [6] exit nondet (predicate) {queens} queens: qdelete(3 {int}, [3, 4, 5] {list__list(int)}, [4, 5] {list__list(int)})/3-0 []
- 20: 10 [6] call nondet (predicate) {queens} queens: qperm([4, 5] {list__list(int)}, -)/2-0 []
+ 1: 1 [1] call main(state('<<c_pointer>>'), -) [] 0
+ 2: 2 [2] call data(-) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
+ 4: 3 [2] call queen([1, 2, 3, 4, 5], -) [] 16
+ 5: 4 [3] call qperm([1, 2, 3, 4, 5], -) [] 43
+ 6: 4 [3] switch qperm([1, 2, 3, 4, 5], -) [s1] 47
+ 7: 5 [4] call qdelete(-, [1, 2, 3, 4, 5], -) [] 48
+ 8: 5 [4] disj qdelete(-, [1, 2, 3, 4, 5], -) [c2, d1] 52
+ 9: 5 [4] exit qdelete(1, [1, 2, 3, 4, 5], [2, 3, 4, 5]) [] 48
+ 10: 6 [4] call qperm([2, 3, 4, 5], -) [] 50
+ 11: 6 [4] switch qperm([2, 3, 4, 5], -) [s1] 47
+ 12: 7 [5] call nondet (predicate) {queens} queens: qdelete(-, [2, 3, 4, 5] {list__list(int)}, -)/3-0 [] 48
+ 13: 7 [5] disj nondet (predicate) {queens} queens: qdelete(-, [2, 3, 4, 5] {list__list(int)}, -)/3-0 [c2, d1] 52
+ 14: 7 [5] exit nondet (predicate) {queens} queens: qdelete(2 {int}, [2, 3, 4, 5] {list__list(int)}, [3, 4, 5] {list__list(int)})/3-0 [] 48
+ 15: 8 [5] call nondet (predicate) {queens} queens: qperm([3, 4, 5] {list__list(int)}, -)/2-0 [] 50
+ 16: 8 [5] switch nondet (predicate) {queens} queens: qperm([3, 4, 5] {list__list(int)}, -)/2-0 [s1] 47
+ 17: 9 [6] call nondet (predicate) {queens} queens: qdelete(-, [3, 4, 5] {list__list(int)}, -)/3-0 [] 48
+ 18: 9 [6] disj nondet (predicate) {queens} queens: qdelete(-, [3, 4, 5] {list__list(int)}, -)/3-0 [c2, d1] 52
+ 19: 9 [6] exit nondet (predicate) {queens} queens: qdelete(3 {int}, [3, 4, 5] {list__list(int)}, [4, 5] {list__list(int)})/3-0 [] 48
+ 20: 10 [6] call nondet (predicate) {queens} queens: qperm([4, 5] {list__list(int)}, -)/2-0 [] 50
[1, 3, 5, 2, 4]
End of connection with the traced program
*** the first 20 events: ok.
@@ -38,53 +40,53 @@
**** Testing toggle/1...
run(./, queens, )
Start debugging queens program.
- 1: 1 [1] call main(state('<<c_pointer>>'), -) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 1: 1 [1] call main(state('<<c_pointer>>'), -) [] 0
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle chrono attribute:
- 2 [2] exit data([1, 2, 3, 4, 5]) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle call attribute:
- 3: [2] exit data([1, 2, 3, 4, 5]) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: [2] exit data([1, 2, 3, 4, 5]) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle port attribute:
- 3: 2 [2] data([1, 2, 3, 4, 5]) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] data([1, 2, 3, 4, 5]) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle depth attribute:
- 3: 2 exit data([1, 2, 3, 4, 5]) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 exit data([1, 2, 3, 4, 5]) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle deter attribute:
- 3: 2 [2] exit det data([1, 2, 3, 4, 5]) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] exit det data([1, 2, 3, 4, 5]) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle proc_type attribute:
- 3: 2 [2] exit (predicate) data([1, 2, 3, 4, 5]) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] exit (predicate) data([1, 2, 3, 4, 5]) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle decl_module attribute:
- 3: 2 [2] exit queens: data([1, 2, 3, 4, 5]) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] exit queens: data([1, 2, 3, 4, 5]) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle def_module attribute:
- 3: 2 [2] exit {queens} data([1, 2, 3, 4, 5]) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] exit {queens} data([1, 2, 3, 4, 5]) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle name attribute:
- 3: 2 [2] exit ([1, 2, 3, 4, 5]) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] exit ([1, 2, 3, 4, 5]) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle arity attribute:
- 3: 2 [2] exit data([1, 2, 3, 4, 5])/1 []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] exit data([1, 2, 3, 4, 5])/1 [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle mode_number attribute:
- 3: 2 [2] exit data([1, 2, 3, 4, 5])-0 []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] exit data([1, 2, 3, 4, 5])-0 [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle arg attribute:
- 3: 2 [2] exit data() []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] exit data() [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle local_vars attribute:
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle type attribute:
- 3: 2 [2] exit data([1, 2, 3, 4, 5] {list__list(int)}) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] exit data([1, 2, 3, 4, 5] {list__list(int)}) [] 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
toggle goal_path attribute:
- 3: 2 [2] exit data([1, 2, 3, 4, 5])
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) 16
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
no (more) solution.
[morphine 3]: [1, 3, 5, 2, 4]
End of connection with the traced program
@@ -94,8 +96,8 @@
**** Testing one by one variable retrieval...
run(./, queens, )
Start debugging queens program.
- 1: 1 [1] call main(state('<<c_pointer>>'), -) []
-673: 3 [2] exit queen([1, 2, 3, 4, 5], [1, 3, 5, 2, 4]) []
+ 1: 1 [1] call main(state('<<c_pointer>>'), -) [] 0
+673: 3 [2] exit queen([1, 2, 3, 4, 5], [1, 3, 5, 2, 4]) [] 16
[live_var_names_and_types(HeadVar__1, list:list(int)), live_var_names_and_types(HeadVar__2, list:list(int))]
[1, 2, 3, 4, 5][1, 3, 5, 2, 4]
End of connection with the traced program
@@ -109,8 +111,8 @@
**** Testing current...
run(./, queens, )
Start debugging queens program.
- 1: 1 [1] call main(state('<<c_pointer>>'), -) []
-673: 3 [2] exit queen([1, 2, 3, 4, 5], [1, 3, 5, 2, 4]) []
+ 1: 1 [1] call main(state('<<c_pointer>>'), -) [] 0
+673: 3 [2] exit queen([1, 2, 3, 4, 5], [1, 3, 5, 2, 4]) [] 16
current_live_var: [(HeadVar__1, [1, 2, 3, 4, 5], list : list(int)), (HeadVar__2, [1, 3, 5, 2, 4], list : list(int))]
chrono = 673
call = 3
@@ -225,9 +227,9 @@
**** Testing retry/1...
run(./, queens, )
Start debugging queens program.
- 1: 1 [1] call main(state('<<c_pointer>>'), -) []
-673: 3 [2] exit queen([1, 2, 3, 4, 5], [1, 3, 5, 2, 4]) []
- 4: 3 [2] call queen([1, 2, 3, 4, 5], -) []
+ 1: 1 [1] call main(state('<<c_pointer>>'), -) [] 0
+673: 3 [2] exit queen([1, 2, 3, 4, 5], [1, 3, 5, 2, 4]) [] 16
+ 4: 3 [2] call queen([1, 2, 3, 4, 5], -) [] 16
[1, 3, 5, 2, 4]
End of connection with the traced program
*** retry: ok.
@@ -236,8 +238,8 @@
**** Testing stack dumps...
run(./, queens, )
Start debugging queens program.
- 1: 1 [1] call main(state('<<c_pointer>>'), -) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
+ 1: 1 [1] call main(state('<<c_pointer>>'), -) [] 0
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
Level 0: (chrono=2, call=2, depth=2) pred queens:data/1-0 (det)
Level 1: (chrono=1, call=1, depth=1) pred queens:main/2-0 (cc_multi)
@@ -251,94 +253,9 @@
**** Testing the term browser...
run(./, queens, )
Start debugging queens program.
- 1: 1 [1] call main(state('<<c_pointer>>'), -) []
- 3: 2 [2] exit data([1, 2, 3, 4, 5]) []
-browser> .
-1-1
-2-.
- 1-2
- 2-.
- 1-3
- 2-.
- 1-4
- 2-.
- 1-5
- 2-[]
-
-browser> browser> Commands are:
- ls [path] -- list subterm (expanded)
- cd [path] -- cd current subterm (default is root)
- help -- show this help message
- set var value -- set a setting
- set -- show settings
- print -- show single line representation of current term
- quit -- quit browser
-SICStus Prolog style commands are:
- p -- print
- < n -- set depth
- ^ [path] -- cd [path] (default is root)
- ? -- help
- h -- help
-
--- settings:
--- size; depth; path; format (flat raw_pretty verbose pretty); width; lines
--- Paths can be Unix-style or SICStus-style: /2/3/1 or ^2^3^1
-
-browser> Commands are:
- ls [path] -- list subterm (expanded)
- cd [path] -- cd current subterm (default is root)
- help -- show this help message
- set var value -- set a setting
- set -- show settings
- print -- show single line representation of current term
- quit -- quit browser
-SICStus Prolog style commands are:
- p -- print
- < n -- set depth
- ^ [path] -- cd [path] (default is root)
- ? -- help
- h -- help
-
--- settings:
--- size; depth; path; format (flat raw_pretty verbose pretty); width; lines
--- Paths can be Unix-style or SICStus-style: /2/3/1 or ^2^3^1
-
-browser> Commands are:
- ls [path] -- list subterm (expanded)
- cd [path] -- cd current subterm (default is root)
- help -- show this help message
- set var value -- set a setting
- set -- show settings
- print -- show single line representation of current term
- quit -- quit browser
-SICStus Prolog style commands are:
- p -- print
- < n -- set depth
- ^ [path] -- cd [path] (default is root)
- ? -- help
- h -- help
-
--- settings:
--- size; depth; path; format (flat raw_pretty verbose pretty); width; lines
--- Paths can be Unix-style or SICStus-style: /2/3/1 or ^2^3^1
-
-browser> Max depth is: 10
-Max size is: 30
-X clip is: 80
-Y clip is: 25
-Current path is: /
-Ls format is verbose
-Print format is flat
-browser> browser> browser> Max depth is: 2
-Max size is: 30
-X clip is: 80
-Y clip is: 25
-Current path is: /
-Ls format is pretty
-Print format is pretty
-browser> .(1, .(2, .(3, .(4, .(5, [])))))
-browser> .(1, .(2, .(3, .(4, .(5, [])))))
-browser> [1, 3, 5, 2, 4]
+ 1: 1 [1] call main(state('<<c_pointer>>'), -) [] 0
+ 3: 2 [2] exit data([1, 2, 3, 4, 5]) [] 16
+[1, 3, 5, 2, 4]
End of connection with the traced program
*** browser: ok.
[morphine 9]:
@@ -346,7 +263,7 @@
**** Testing collect...
run(./, queens, )
Start debugging queens program.
- 1: 1 [1] call main(state('<<c_pointer>>'), -) []
+ 1: 1 [1] call main(state('<<c_pointer>>'), -) [] 0
[1, 3, 5, 2, 4]
End of connection with the traced program
[sol(proc(predicate, "queens", "main", 2, 0), [univ_cons(state('<<c_pointer>>'))]), sol(proc(predicate, "queens", "print_list", 3, 0), [univ_cons([1, 3, 5, 2, 4]), univ_cons(state('<<c_pointer>>'))]), sol(proc(predicate, "queens", "print_list_2", 3, 0), [univ_cons([1, 3, 5, 2, 4]), univ_cons(state('<<c_pointer>>'))]), sol(proc(predicate, "queens", "print_list_2", 3, 0), [univ_cons([3, 5, 2, 4]), univ_cons(state('<<c_pointer>>'))]), sol(proc(predicate, "queens", "print_list_2", 3, 0), [univ_cons([5, 2, 4]), univ_cons(state('<<c_pointer>>'))]), sol(proc(predicate, "queens", "print_list_2", 3, 0), [univ_cons([2, 4]), univ_cons(state('<<c_pointer>>'))]), sol(proc(predicate, "queens", "print_list_2", 3, 0), [univ_cons([4]), univ_cons(state('<<c_pointer>>'))]), sol(proc(predicate, "queens", "queen", 2, 0), [univ_cons([1, 2, 3, 4, 5]), univ_cons([1, 3, 5, 2, 4])]), sol(proc(predicate, "queens", "safe", 1, 0), [univ_cons([1, 3, 5, 2, 4])]), sol(proc(predicate, "queens", "safe", 1, !
0), [univ_cons([3, 5, 2, 4])]), sol(proc(predicate, "queens", "safe", 1, 0), [univ_cons([5, 2, 4])]), sol(proc(predicate, "queens", "safe", 1, 0), [univ_cons([2, 4])]), sol(proc(predicate, "queens", "safe", 1, 0), [univ_cons([4])]), sol(proc(predicate, "queens", "safe", 1, 0), [univ_cons([])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(4), univ_cons(1), univ_cons([])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(2), univ_cons(1), univ_cons([4])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(2), univ_cons(2), univ_cons([])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(5), univ_cons(1), univ_cons([2, 4])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(5), univ_cons(2), univ_cons([4])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(5), univ_cons(3), univ_cons([])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(3), univ_cons(1), univ_cons([5, 2, 4])]), sol(proc(predicate, "queens"!
, "nodiag", 3, 0), [univ_cons(3), univ_cons(2), univ_cons([2, 4])]), s
ol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(3), univ_cons(3), univ_cons([4])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(3), univ_cons(4), univ_cons([])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(1), univ_cons([3, 5, 2, 4])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(2), univ_cons([5, 2, 4])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(3), univ_cons([2, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([1, 2, 3, 4, 5]), univ_cons([1, 3, 5, 2, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 3, 4, 5]), univ_cons([3, 5, 2, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 4, 5]), univ_cons([5, 2, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 4]), univ_cons([2, 4])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(2), univ_cons([2, 4]), univ_cons([4])]), sol(proc(predicate,!
"queens", "qdelete", 3, 0), [univ_cons(5), univ_cons([2, 4, 5]), univ_cons([2, 4])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(1), univ_cons([3, 4, 5, 2])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(2), univ_cons([4, 5, 2])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(3), univ_cons([5, 2])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(4), univ_cons([2])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([1, 2, 3, 4, 5]), univ_cons([1, 3, 4, 5, 2])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 3, 4, 5]), univ_cons([3, 4, 5, 2])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 4, 5]), univ_cons([4, 5, 2])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 5]), univ_cons([5, 2])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2]), univ_cons([2])]), sol(proc(predicate, "queens", "qdelete", 3!
, 0), [univ_cons(2), univ_cons([2]), univ_cons([])]), sol(proc(predica
te, "queens", "qdelete", 3, 0), [univ_cons(5), univ_cons([2, 5]), univ_cons([2])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([1, 2, 3, 4, 5]), univ_cons([1, 3, 4, 2, 5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 3, 4, 5]), univ_cons([3, 4, 2, 5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 4, 5]), univ_cons([4, 2, 5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 5]), univ_cons([2, 5])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(2), univ_cons([2, 5]), univ_cons([5])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(4), univ_cons([2, 4, 5]), univ_cons([2, 5])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(1), univ_cons([3, 2, 5, 4])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(2), univ_cons([2, 5, 4])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(3), univ_cons([5, 4])]), sol(proc(predic!
ate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(4), univ_cons([4])]), sol(proc(predicate, "queens", "nodiag", 3, 0), [univ_cons(1), univ_cons(5), univ_cons([])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([1, 2, 3, 4, 5]), univ_cons([1, 3, 2, 5, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 3, 4, 5]), univ_cons([3, 2, 5, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 4, 5]), univ_cons([2, 5, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([1, 2, 3, 4, 5]), univ_cons([1, 3, 2, 4, 5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 3, 4, 5]), univ_cons([3, 2, 4, 5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 4, 5]), univ_cons([2, 4, 5])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(2), univ_cons([2, 4, 5]), univ_cons([4, 5])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(3), univ_cons([2, 3, 4, 5]), univ_cons([2, 4, 5])]), sol(!
proc(predicate, "queens", "qperm", 2, 0), [univ_cons([1, 2, 3, 4, 5]),
univ_cons([1, 2, 5, 4, 3])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 3, 4, 5]), univ_cons([2, 5, 4, 3])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([3, 4, 5]), univ_cons([5, 4, 3])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([3, 4]), univ_cons([4, 3])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(4), univ_cons([3, 4]), univ_cons([3])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([1, 2, 3, 4, 5]), univ_cons([1, 2, 5, 3, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 3, 4, 5]), univ_cons([2, 5, 3, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([3, 4, 5]), univ_cons([5, 3, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([3, 4]), univ_cons([3, 4])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(3), univ_cons([3, 4]), univ_cons([4])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(5), univ_cons([3, 4, 5]), univ_cons(!
[3, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([1, 2, 3, 4, 5]), univ_cons([1, 2, 4, 5, 3])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 3, 4, 5]), univ_cons([2, 4, 5, 3])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([3, 4, 5]), univ_cons([4, 5, 3])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([3, 5]), univ_cons([5, 3])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([3]), univ_cons([3])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(3), univ_cons([3]), univ_cons([])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(5), univ_cons([3, 5]), univ_cons([3])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([1, 2, 3, 4, 5]), univ_cons([1, 2, 4, 3, 5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 3, 4, 5]), univ_cons([2, 4, 3, 5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([3, 4, 5]), univ_cons([4, 3, 5])]), sol(proc(predicate,!
"queens", "qperm", 2, 0), [univ_cons([3, 5]), univ_cons([3, 5])]), so
l(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(3), univ_cons([3, 5]), univ_cons([5])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(4), univ_cons([3, 4, 5]), univ_cons([3, 5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([1, 2, 3, 4, 5]), univ_cons([1, 2, 3, 5, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([2, 3, 4, 5]), univ_cons([2, 3, 5, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([3, 4, 5]), univ_cons([3, 5, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([4, 5]), univ_cons([5, 4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([4]), univ_cons([4])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(4), univ_cons([4]), univ_cons([])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(5), univ_cons([4, 5]), univ_cons([4])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([1, 2, 3, 4, 5]), univ_cons([1, 2, 3, 4, 5])]), sol(proc(predicate,!
"queens", "qperm", 2, 0), [univ_cons([2, 3, 4, 5]), univ_cons([2, 3, 4, 5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([3, 4, 5]), univ_cons([3, 4, 5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([4, 5]), univ_cons([4, 5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([5]), univ_cons([5])]), sol(proc(predicate, "queens", "qperm", 2, 0), [univ_cons([]), univ_cons([])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(5), univ_cons([5]), univ_cons([])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(4), univ_cons([4, 5]), univ_cons([5])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(3), univ_cons([3, 4, 5]), univ_cons([4, 5])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(2), univ_cons([2, 3, 4, 5]), univ_cons([3, 4, 5])]), sol(proc(predicate, "queens", "qdelete", 3, 0), [univ_cons(1), univ_cons([1, 2, 3, 4, 5]), univ_cons([2, 3, 4, 5])]), sol(proc(predicate, "queens", "data"!
, 1, 0), [univ_cons([1, 2, 3, 4, 5])])]
Index: extras/morphine/non-regression-tests/queens.in
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/non-regression-tests/queens.in,v
retrieving revision 1.5
diff -u -d -u -r1.5 queens.in
--- extras/morphine/non-regression-tests/queens.in 2001/02/28 12:06:02 1.5
+++ extras/morphine/non-regression-tests/queens.in 2001/06/20 16:07:05
@@ -170,10 +170,10 @@
write("\n**** Testing the term browser...\n"),
rerun,
fget(name = data and port = exit),
- open("browse.in", read, browse_stream),
- set_stream(input, browse_stream),
- browse("HeadVar__1"),
- close(browse_stream),
+% open("browse.in", read, browse_stream),
+% set_stream(input, browse_stream),
+% browse("HeadVar__1"),
+% close(browse_stream),
no_trace,
write("*** browser: ok.\n").
Index: extras/morphine/source/current_slots.op
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/source/current_slots.op,v
retrieving revision 1.6
diff -u -d -u -r1.6 current_slots.op
--- extras/morphine/source/current_slots.op 2001/06/15 13:02:33 1.6
+++ extras/morphine/source/current_slots.op 2001/06/20 16:07:05
@@ -59,6 +59,8 @@
procedure determinism, \n\
goal_path: \n\
goal path of the call of the procedure, \n\
+line_number: \n\
+ line number of the call of the procedure, \n\
args: \n\
list of procedure arguments (*), \n\
arg_names: \n\
@@ -118,14 +120,14 @@
name : current_attributes,
arg_list : [Chrono, Call, Depth, Port, PredOrFunc, DeclModule,
DefModule, Name, Arity, ModeNumber, Det,
- GoalPath /* , LineNumber */],
+ GoalPath, LineNumber],
arg_type_list : [is_integer_or_var, is_integer_or_var,
is_integer_or_var, is_port_or_var,
is_atom_or_var, is_atom_or_var,
is_atom_or_var, is_atom_or_var,
is_integer_or_var, is_integer_or_var,
- is_det_marker_or_var, is_goal_path_or_var
- /* , is_integer_or_var */],
+ is_det_marker_or_var, is_goal_path_or_var ,
+ is_integer_or_var],
abbrev : _,
implementation : current_attributes_Op,
message :
@@ -137,8 +139,8 @@
% Determinism is coded by an integer so we need to wrap the
% the call of current_attributes with determinism conversion.
current_attributes_Op(Chrono, Call, Depth, Port, PredOrFunc, DeclModule,
- DefModule, Name, Arity, ModeNumber, Det, GoalPath /* ,
- LineNumber */) :-
+ DefModule, Name, Arity, ModeNumber, Det, GoalPath,
+ LineNumber) :-
send_message_to_socket(current_slots),
read_message_from_socket(Response),
@@ -148,8 +150,8 @@
RetrievedTypeNameStr, RetrievedTypeModuleStr,
RetrievedDefModuleStr, RetrievedNameStr,
RetrievedArity, RetrievedModeNumber,
- RetrievedDeterminism, RetrievedGoalPath
- /*, RetrievedLineNumber */ )
+ RetrievedDeterminism, RetrievedGoalPath,
+ RetrievedLineNumber)
->
write("The current event is compiler generated event, "),
write("they are not handled yet in Morphine.\n"),
@@ -163,8 +165,8 @@
RetrievedPredOrFunc, RetrievedDeclModuleStr,
RetrievedDefModuleStr, RetrievedNameStr,
RetrievedArity, RetrievedModeNumber,
- RetrievedDeterminism, RetrievedGoalPath
- /*, RetrievedLineNumber */ )
+ RetrievedDeterminism, RetrievedGoalPath,
+ RetrievedLineNumber)
->
% for 'decl_module', 'def_module' and 'name' attributes,
% Mercury sends string whereas we prefer to manipulate
@@ -219,8 +221,8 @@
unify_attribute(RetrievedArity, Arity),
unify_attribute(RetrievedModeNumber, ModeNumber),
unify_attribute(UncodedDet, Det),
- unify_attribute(GoalPathList, GoalPath)
- /*, unify_attribute(RetrievedLineNumber, LineNumber) */
+ unify_attribute(GoalPathList, GoalPath),
+ unify_attribute(RetrievedLineNumber, LineNumber)
;
% I should uncomment that when [EOT] is fix.
% Response = eot
@@ -230,12 +232,12 @@
%;
Response = error(ErrorMessage)
->
- write(stderr, "Error in current_attributes/11 (current_slots.op)\n"),
+ write(stderr, "Error in current_attributes/13 (current_slots.op)\n"),
write(stderr, " An error occured in the Mercury process: "),
write(stderr, ErrorMessage),
morphine_abort
;
- write(stderr, "Error in current_attributes/11 (current_slots.op)\n"),
+ write(stderr, "Error in current_attributes/13 (current_slots.op)\n"),
write(stderr, "The Mercury process sends: "),
write(Response),
write(stderr, "\n"),
@@ -331,153 +333,153 @@
current_one(Attribute = Chrono) :-
is_alias_for(chrono, Attribute),
- current_attributes(Chrono, -, -, -, -, -, -, -, -, -, -, - /*, - */),
+ current_attributes(Chrono, -, -, -, -, -, -, -, -, -, -, - , -),
!.
current_one(Attribute = Call) :-
is_alias_for(call, Attribute),
- current_attributes(-, Call, -, -, -, -, -, -, -, -, -, - /*, - */),
+ current_attributes(-, Call, -, -, -, -, -, -, -, -, -, - , -),
!.
current_one(Attribute = Depth) :-
is_alias_for(depth, Attribute),
- current_attributes(-, -, Depth, -, -, -, -, -, -, -, -, - /*, - */),
+ current_attributes(-, -, Depth, -, -, -, -, -, -, -, -, - , -),
!.
current_one(Attribute = Port) :-
is_alias_for(port, Attribute),
- current_attributes(-, -, -, Port, -, -, -, -, -, -, -, - /*, - */),
+ current_attributes(-, -, -, Port, -, -, -, -, -, -, -, - , -),
!.
current_one(Attribute = PredOrFunc) :-
is_alias_for(proc_type, Attribute),
current_attributes(-, -, -, -, PredOrFunc, -, -, -, -, -, -, -
- /*, - */),
+ , -),
!.
current_one(Attribute = DeclModule) :-
is_alias_for(decl_module, Attribute),
current_attributes(-, -, -, -, -, DeclModule, -, -, -, -, -, -
- /*, - */),
+ , -),
!.
current_one(Attribute = DefModule) :-
is_alias_for(def_module, Attribute),
- current_attributes(-, -, -, -, -, -, DefModule, -, -, -, -, - /*, - */),
+ current_attributes(-, -, -, -, -, -, DefModule, -, -, -, -, - , -),
!.
current_one(Attribute = Name) :-
is_alias_for(name, Attribute),
- current_attributes(-, -, -, -, -, -, -, Name, -, -, -, - /*, - */),
+ current_attributes(-, -, -, -, -, -, -, Name, -, -, -, - , -),
!.
current_one(Attribute = Arity) :-
is_alias_for(arity, Attribute),
- current_attributes(-, -, -, -, -, -, -, -, Arity, -, -, - /*, - */),
+ current_attributes(-, -, -, -, -, -, -, -, Arity, -, -, - , -),
!.
current_one(Attribute = ModeNumber) :-
is_alias_for(mode_number, Attribute),
current_attributes(-, -, -, -, -, -, -, -, -, ModeNumber, -, -
- /*, - */),
+ , -),
!.
current_one(Attribute = Proc) :-
is_alias_for(proc, Attribute),
(
free(Proc),
- current_attributes(-,-,-,-, PT, M, -, N, A, MN,-,- /*,-*/),
+ current_attributes(-,-,-,-, PT, M, -, N, A, MN,-,- , -),
Proc = (PT->(M:(N/A-MN))),
!
;
Proc = N,
is_atom_or_var(N),
- current_attributes(-,-,-,-, -, -, -, N, -, -,-,- /*,-*/),!
+ current_attributes(-,-,-,-, -, -, -, N, -, -,-,- , -),!
;
Proc = (PT->N),
is_atom_or_var(N),
is_atom_or_var(PT),
- current_attributes(-,-,-,-, PT, -, -, N, -, -,-,- /*,-*/),
+ current_attributes(-,-,-,-, PT, -, -, N, -, -,-,- , -),
!
;
Proc = M:N,
- current_attributes(-,-,-,-, -, M, -, N, -, -,-,- /*,-*/),
+ current_attributes(-,-,-,-, -, M, -, N, -, -,-,- , -),
!
;
Proc = N/A,
- current_attributes(-,-,-,-, -, -, -, N, A,-,-,- /*,-*/),
+ current_attributes(-,-,-,-, -, -, -, N, A,-,-,- , -),
!
;
Proc = N-MN,
is_atom_or_var(N),
is_atom_or_var(MN),
- current_attributes(-,-,-,-, -, -, -, N,-, MN,-,- /*,-*/),
+ current_attributes(-,-,-,-, -, -, -, N,-, MN,-,- , -),
!
;
Proc = (N/A-MN),
is_atom_or_var(N),
is_atom_or_var(A),
is_atom_or_var(MN),
- current_attributes(-,-,-,-, -, -, -, N, A, MN,-,- /*,-*/),
+ current_attributes(-,-,-,-, -, -, -, N, A, MN,-,- , -),
!
;
Proc = M:(N-MN),
- current_attributes(-,-,-,-, -, M, -, N, -, MN,-,- /*,-*/),
+ current_attributes(-,-,-,-, -, M, -, N, -, MN,-,- , -),
!
;
Proc = M:(N/A),
- current_attributes(-,-,-,-, -, M, -, N, A, -,-,- /*,-*/),
+ current_attributes(-,-,-,-, -, M, -, N, A, -,-,- , -),
!
;
Proc = (PT->(N-MN)),
- current_attributes(-,-,-,-, PT, -, -, N, -, MN,-,- /*,-*/),
+ current_attributes(-,-,-,-, PT, -, -, N, -, MN,-,- , -),
!
;
Proc = (PT->(N/A)),
- current_attributes(-,-,-,-, PT, -, -, N, A, -,-,- /*,-*/),
+ current_attributes(-,-,-,-, PT, -, -, N, A, -,-,- , -),
!
;
Proc = (PT->M:N),
- current_attributes(-,-,-,-, PT, M, -, N, -, -,-,- /*,-*/),
+ current_attributes(-,-,-,-, PT, M, -, N, -, -,-,- , -),
!
;
Proc = M:(N/A-MN),
- current_attributes(-,-,-,-, -, M, -, N, A, MN,-,- /*,-*/),
+ current_attributes(-,-,-,-, -, M, -, N, A, MN,-,- , -),
!
;
Proc = (PT->(N/A-MN)),
- current_attributes(-,-,-,-, PT, -, -, N, A, MN,-,- /*,-*/),
+ current_attributes(-,-,-,-, PT, -, -, N, A, MN,-,- , -),
!
;
Proc = (PT->M:(N-MN)),
- current_attributes(-,-,-,-, PT, M, -, N, -, MN,-,- /*,-*/),
+ current_attributes(-,-,-,-, PT, M, -, N, -, MN,-,- , -),
!
;
Proc = (PT->M:(N/A)),
- current_attributes(-,-,-,-, PT, M, -, N, A, -,-,- /*,-*/),
+ current_attributes(-,-,-,-, PT, M, -, N, A, -,-,- , -),
!
;
Proc = (PT->M:(N/A-MN)),
- current_attributes(-,-,-,-, PT, M, -, N, A, MN,-,- /*,-*/)
+ current_attributes(-,-,-,-, PT, M, -, N, A, MN,-,- , -)
).
current_one(Attribute = Determinism) :-
is_alias_for(det, Attribute),
current_attributes(-, -, -, -, -, -, -, -, -, -, Determinism, -
- /*, - */),
+ , -),
!.
current_one(Attribute = GoalPath) :-
is_alias_for(goal_path, Attribute),
- current_attributes(-, -, -, -, -, -, -, -, -, -, -, GoalPath /*, - */),
+ current_attributes(-, -, -, -, -, -, -, -, -, -, -, GoalPath, -),
!.
-% current_one(line_number = LineNumber) :-
-% is_alias_for(, Attribute),
-% current_attributes(-, -, -, -, -, -, -, -, -, -, -, -, LineNumber),
-% !.
+current_one(Attribute = LineNumber) :-
+ is_alias_for(line_number, Attribute),
+ current_attributes(-, -, -, -, -, -, -, -, -, -, -, -, LineNumber),
+ !.
%------------------------------------------------------------------------------%
opium_type(
@@ -537,6 +539,10 @@
;
Attribute = goal_path,
is_goal_path_or_var(Term),
+ !
+ ;
+ Attribute = line_number,
+ is_integer_or_var(Term),
!
;
Attribute = port,
Index: extras/morphine/source/display.op
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/source/display.op,v
retrieving revision 1.5
diff -u -d -u -r1.5 display.op
--- extras/morphine/source/display.op 2001/06/15 13:02:34 1.5
+++ extras/morphine/source/display.op 2001/06/20 16:07:05
@@ -42,9 +42,9 @@
attribute_display(ChronoFlag, CallFlag, PortFlag, DepthFlag, DeterFlag,
PredOrFuncFlag, DeclModuleFlag, DefModuleFlag,
NameFlag, ArityFlag, ModeNumFlag, ArgFlag,
- ListVarFlag, TypeFlag, GoalPathFlag),
+ ListVarFlag, TypeFlag, GoalPathFlag, LineNumberFlag),
current_attributes(Chrono, Call, Depth, Port, PredOrFunc, DeclModule,
- DefModule, Name, Arity, ModeNum, Deter, GoalPath),
+ DefModule, Name, Arity, ModeNum, Deter, GoalPath, LineNumber),
indent_display(IndentFlag, IndentValue, IndentDepth),
print_line_attribute(chrono, Chrono, ChronoFlag),
write_indent(IndentFlag, IndentValue, IndentDepth, Depth),
@@ -79,7 +79,7 @@
print_line_attribute(arity, Arity, ArityFlag),
print_line_attribute(mode_number, ModeNum, ModeNumFlag),
print_line_attribute(goal_path, GoalPath, GoalPathFlag),
-% print_line_number(Port, LineNumber, LineNumberFlag),
+ print_line_attribute(line_number, LineNumber, LineNumberFlag),
print_line_attribute(listvar, ListVar, ListVarFlag),
write_trace('\n')
;
@@ -117,7 +117,7 @@
attribute_display(ChronoFlag, CallFlag, PortFlag, DepthFlag, DeterFlag,
PredOrFuncFlag, DeclModuleFlag, DefModuleFlag,
NameFlag, ArityFlag, ModeNumFlag, ArgFlag,
- ListVarFlag, TypeFlag, GoalPathFlag),
+ ListVarFlag, TypeFlag, GoalPathFlag, LineNumFlag),
indent_display(IndentFlag, IndentValue, IndentDepth),
(ChronoFlag = on -> write_trace("chrono: ") ; true),
@@ -140,7 +140,7 @@
print_line_attribute(arity, arity, ArityFlag),
print_line_attribute(mode_number, mode_number, ModeNumFlag),
print_line_attribute(goal_path, goal_path, GoalPathFlag),
-% print_line_number(Port, LineNumber, LineNumberFlag),
+ print_line_number(line_number, line_number, LineNumberFlag),
write_trace('\n'),
print_line_attribute(listvar, listvar, ListVarFlag),
!.
@@ -166,7 +166,7 @@
print_full_event_Op :-
get_parameter(attribute_display, L),
set_parameter(attribute_display,
- [on, on, on, on, on, on, on, on, on, on, on, on, on, on, on]),
+ [on, on, on, on, on, on, on, on, on, on, on, on, on, on, on, on]),
print_event_Op,
set_parameter(attribute_display, L).
@@ -204,7 +204,7 @@
print_line_attribute(arity, arity, on),
print_line_attribute(mode_number, mode_number, on),
print_line_attribute(goal_path, goal_path, on),
-% print_line_number(Port, LineNumber, on),
+ print_line_attribute(line_number, line_number, on),
write_trace('\n'),
!.
@@ -314,8 +314,8 @@
"Displays an attribute of the trace line. `AttributeName' is \
a member of the following list: [chrono, call, depth, port, proc_type, \
decl_module, def_module, arity, mode_number, args, deter, goal_path, \
-non_arg_var]. To customize the way arguments are displayed, you should \
-rather modify `write_arg/1'."
+line_number, non_arg_var]. To customize the way arguments are displayed, you \
+should rather modify `write_arg/1'."
).
%:- pred write_attribute_Op(atom, atom).
@@ -370,6 +370,11 @@
write_trace(V),
write_trace(' ').
+write_attribute_Op(line_number, V) :-
+ write_trace(' '),
+ write_trace(V),
+ write_trace(' ').
+
write_attribute_Op(type_arg, Type) :-
write_trace(" {"),
replace_dotdot_by_underscore_in_term(Type, Type2),
@@ -1155,7 +1160,7 @@
arg_list : [Chrono, Call, Port, Depth, Deter, PredOrFunc,
DeclModule, DefModule, Name, Arity,
ModeNumber, ListArg, ListNonArgVar, Type,
- GoalPath /*, LineNumber */ ],
+ GoalPath, LineNumber],
arg_type_list : [is_member([on,off]), is_member([on,off]),
is_member([on,off]), is_member([on,off]),
is_member([on,off]), is_member([on,off]),
@@ -1163,10 +1168,10 @@
is_member([on,off]), is_member([on,off]),
is_member([on,off]), is_member([on,off]),
is_member([on,off]), is_member([on,off]),
- is_member([on,off]) /*,is_member([on,off])*/ ],
+ is_member([on,off]), is_member([on,off])],
parameter_type : single,
default : [on, on, on, on, off, off, off, off, on, off, off,
- on, off, off, on /* , on */ ],
+ on, off, off, on, on],
commands : [print_event],
message :
"Parameter which contains the flags for the selective display of attributes. \
@@ -1334,180 +1339,192 @@
(
is_alias_for(chrono, Keyword),
ListDisplay = [S, O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,O12,O13,
- O14,O15],
+ O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [NewS, O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
!
;
is_alias_for(call, Keyword),
ListDisplay = [O1, S,O3,O4,O5,O6,O7,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1, NewS,O3,O4,O5,O6,O7,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
!
;
is_alias_for(port, Keyword),
ListDisplay = [O1,O2, S,O4,O5,O6,O7,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2, NewS,O4,O5,O6,O7,O8,O9,O10,O11,
- O12,O13, O14,O15],
+ O12,O13, O14,O15,O16],
!
;
is_alias_for(depth, Keyword),
ListDisplay = [O1,O2,O3, S,O5,O6,O7,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3, NewS,O5,O6,O7,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
!
;
is_alias_for(det, Keyword),
ListDisplay = [O1,O2,O3,O4,S,O6,O7,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3,O4,NewS,O6,O7,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
!
;
is_alias_for(proc_type, Keyword),
ListDisplay = [O1,O2,O3,O4,O5,S,O7,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3,O4,O5,NewS,O7,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
!
;
is_alias_for(decl_module, Keyword),
ListDisplay = [O1,O2,O3,O4,O5,O6,S,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3,O4,O5,O6,NewS,O8,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
!
;
is_alias_for(def_module, Keyword),
ListDisplay = [O1,O2,O3,O4,O5,O6,O7,S,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3,O4,O5,O6,O7,NewS,O9,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
!
;
is_alias_for(name, Keyword),
ListDisplay = [O1,O2,O3,O,O5,O6,O7,O8,S,O10,O11,O12,
- O13,O14,O15],
+ O13,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3,O,O5,O6,O7,O8,NewS,O10,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
!
;
is_alias_for(arity, Keyword),
- ListDisplay = [O1,O2,O3,O,O5,O6,O7,O8,O9,S,O11,O12,O13,O14,O15],
+ ListDisplay = [O1,O2,O3,O,O5,O6,O7,O8,O9,S,O11,O12,O13,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3,O,O5,O6,O7,O8,O9,NewS,O11,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
!
;
is_alias_for(mode_number, Keyword),
- ListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,S,O12,O13,O14,O15],
+ ListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,S,O12,O13,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,NewS,
- O12,O13,O14,O15],
+ O12,O13,O14,O15,O16],
!
;
is_alias_for(args, Keyword),
ListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,S,
- O13,O14,O15],
+ O13,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,
- O11,NewS,O13,O14,O15],
+ O11,NewS,O13,O14,O15,O16],
!
;
is_alias_for(local_vars, Keyword),
ListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,
- O12,S,O14,O15],
+ O12,S,O14,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,
- O12,NewS,O14,O15],
+ O12,NewS,O14,O15,O16],
!
;
is_alias_for(arg_types, Keyword),
ListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,O12,
- O13,S,O15],
+ O13,S,O15,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,
- O12,O13,NewS,O15],
+ O12,O13,NewS,O15,O16],
!
;
is_alias_for(goal_path, Keyword),
ListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,O12,
- O13,O14,S],
+ O13,O14,S,O16],
( S = off ->
NewS = on
;
NewS = off
),
NewListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,
- O12,O13,O14,NewS]
+ O12,O13,O14,NewS,O16],
+ !
+ ;
+ is_alias_for(line_number, Keyword),
+ ListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,O12,
+ O13,O14,O15,S],
+ ( S = off ->
+ NewS = on
+ ;
+ NewS = off
+ ),
+ NewListDisplay = [O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,
+ O12,O13,O14,O15,NewS]
).
Index: extras/morphine/source/event_attributes.op
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/morphine/source/event_attributes.op,v
retrieving revision 1.4
diff -u -d -u -r1.4 event_attributes.op
--- extras/morphine/source/event_attributes.op 2001/06/15 13:02:34 1.4
+++ extras/morphine/source/event_attributes.op 2001/06/20 16:07:06
@@ -649,6 +649,9 @@
is_alias_for(goal_path, goal_path).
is_alias_for(goal_path, gp).
+is_alias_for(line_number, line_number).
+is_alias_for(line_number, ln).
+
% XXX Those ones are not hanled in fget yet.
is_alias_for(args, arguments).
Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.56
diff -u -d -u -r1.56 mercury_trace_external.c
--- trace/mercury_trace_external.c 2001/05/31 06:00:25 1.56
+++ trace/mercury_trace_external.c 2001/06/20 16:07:12
@@ -173,7 +173,7 @@
MR_Unsigned depth,
/* XXX registers */
const char *path, MR_Word search_data);
-static void MR_output_current_slots(const MR_Label_Layout *layout,
+static void MR_output_current_slots(const MR_Event_Info *event_info,
MR_Trace_Port port, MR_Unsigned seqno,
MR_Unsigned depth, const char *path);
static void MR_output_current_vars(MR_Word var_list, MR_Word string_list);
@@ -596,7 +596,7 @@
fprintf(stderr, "\nMercury runtime: "
"REQUEST_CURRENT_SLOTS\n");
}
- MR_output_current_slots(layout, port, seqno,
+ MR_output_current_slots(event_info, port, seqno,
depth, path);
break;
@@ -898,10 +898,38 @@
}
static void
-MR_output_current_slots(const MR_Label_Layout *layout,
+MR_output_current_slots(const MR_Event_Info *event_info,
MR_Trace_Port port, MR_Unsigned seqno, MR_Unsigned depth,
const char *path)
{
+ const char *filename;
+ const MR_Label_Layout *layout = event_info->MR_event_sll;
+ const MR_Label_Layout *parent_layout;
+ const char *problem;
+ int lineno = 0;
+ MR_Word *base_sp, *base_curfr;
+
+
+ if ( port == MR_PORT_CALL || port == MR_PORT_EXIT ||
+ port == MR_PORT_REDO || port == MR_PORT_FAIL )
+ /*
+ ** At external events, we want the line number where the call is made,
+ ** not the one where the procedure is defined.
+ */
+ {
+ base_sp = MR_saved_sp(event_info->MR_saved_regs);
+ base_curfr = MR_saved_curfr(event_info->MR_saved_regs);
+ parent_layout = MR_find_nth_ancestor(layout, 1,
+ &base_sp, &base_curfr, &problem);
+ if (parent_layout != NULL) {
+ (void) MR_find_context(parent_layout, &filename, &lineno);
+ }
+
+ } else {
+ (void) MR_find_context(layout, &filename, &lineno);
+ } ;
+
+
if (MR_PROC_LAYOUT_COMPILER_GENERATED(layout->MR_sll_entry)) {
MR_TRACE_CALL_MERCURY(
ML_DI_output_current_slots_comp(
@@ -921,6 +949,7 @@
layout->MR_sll_entry->MR_sle_comp.MR_comp_mode,
layout->MR_sll_entry->MR_sle_detism,
(MR_String) (MR_Word) path,
+ lineno,
(MR_Word) &MR_debugger_socket_out);
);
} else {
@@ -941,6 +970,7 @@
layout->MR_sll_entry->MR_sle_user.MR_user_mode,
layout->MR_sll_entry->MR_sle_detism,
(MR_String) (MR_Word) path,
+ lineno,
(MR_Word) &MR_debugger_socket_out);
);
}
-------------- next part --------------
R1.
More information about the reviews
mailing list