author | wenzelm |
Sat, 02 Apr 2016 21:55:32 +0200 | |
changeset 62821 | 48c24d0b6d85 |
parent 62819 | d3ff367a16a0 |
child 62822 | 941b6a48ff67 |
permissions | -rw-r--r-- |
62508
d0b68218ea55
discontinued RAW session: bootstrap directly from isabelle_process RAW_ML_SYSTEM;
wenzelm
parents:
62503
diff
changeset
|
1 |
(* Title: Pure/ML/ml_debugger.ML |
60729 | 2 |
Author: Makarius |
3 |
||
61794
4c232a2ddeab
discontinued intermediate polyml-5.5.3, assuming the coming release will be polyml-5.6;
wenzelm
parents:
60954
diff
changeset
|
4 |
ML debugger interface -- for Poly/ML 5.6, or later. |
60729 | 5 |
*) |
6 |
||
60852
1c51a2ca8204
clarified signature, to make debugger.ML compile with current official ML versions;
wenzelm
parents:
60745
diff
changeset
|
7 |
signature ML_DEBUGGER = |
1c51a2ca8204
clarified signature, to make debugger.ML compile with current official ML versions;
wenzelm
parents:
60745
diff
changeset
|
8 |
sig |
60954
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
9 |
type exn_id |
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
10 |
val exn_id: exn -> exn_id |
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
11 |
val print_exn_id: exn_id -> string |
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
12 |
val eq_exn_id: exn_id * exn_id -> bool |
62821 | 13 |
val on_entry: (string * ML_Compiler0.polyml_location -> unit) option -> unit |
14 |
val on_exit: (string * ML_Compiler0.polyml_location -> unit) option -> unit |
|
15 |
val on_exit_exception: (string * ML_Compiler0.polyml_location -> exn -> unit) option -> unit |
|
16 |
val on_breakpoint: (ML_Compiler0.polyml_location * bool Unsynchronized.ref -> unit) option -> unit |
|
60852
1c51a2ca8204
clarified signature, to make debugger.ML compile with current official ML versions;
wenzelm
parents:
60745
diff
changeset
|
17 |
type state |
1c51a2ca8204
clarified signature, to make debugger.ML compile with current official ML versions;
wenzelm
parents:
60745
diff
changeset
|
18 |
val state: Thread.thread -> state list |
1c51a2ca8204
clarified signature, to make debugger.ML compile with current official ML versions;
wenzelm
parents:
60745
diff
changeset
|
19 |
val debug_function: state -> string |
1c51a2ca8204
clarified signature, to make debugger.ML compile with current official ML versions;
wenzelm
parents:
60745
diff
changeset
|
20 |
val debug_function_arg: state -> ML_Name_Space.valueVal |
1c51a2ca8204
clarified signature, to make debugger.ML compile with current official ML versions;
wenzelm
parents:
60745
diff
changeset
|
21 |
val debug_function_result: state -> ML_Name_Space.valueVal |
62821 | 22 |
val debug_location: state -> ML_Compiler0.polyml_location |
60852
1c51a2ca8204
clarified signature, to make debugger.ML compile with current official ML versions;
wenzelm
parents:
60745
diff
changeset
|
23 |
val debug_name_space: state -> ML_Name_Space.T |
61886 | 24 |
val debug_local_name_space: state -> ML_Name_Space.T |
60852
1c51a2ca8204
clarified signature, to make debugger.ML compile with current official ML versions;
wenzelm
parents:
60745
diff
changeset
|
25 |
end; |
1c51a2ca8204
clarified signature, to make debugger.ML compile with current official ML versions;
wenzelm
parents:
60745
diff
changeset
|
26 |
|
60729 | 27 |
structure ML_Debugger: ML_DEBUGGER = |
28 |
struct |
|
29 |
||
60954
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
30 |
(* exceptions *) |
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
31 |
|
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
32 |
abstype exn_id = Exn_Id of string * int Unsynchronized.ref |
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
33 |
with |
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
34 |
|
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
35 |
fun exn_id exn = |
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
36 |
Exn_Id (General.exnName exn, RunCall.run_call2 RuntimeCalls.POLY_SYS_load_word (exn, 0)); |
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
37 |
|
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
38 |
fun print_exn_id (Exn_Id (name, _)) = name; |
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
39 |
fun eq_exn_id (Exn_Id (_, id1), Exn_Id (_, id2)) = PolyML.pointerEq (id1, id2); |
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
40 |
|
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
41 |
end; |
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
42 |
|
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
43 |
val _ = |
62819
d3ff367a16a0
careful export of type-dependent functions, without losing their special status;
wenzelm
parents:
62508
diff
changeset
|
44 |
ML_system_pp (fn _ => fn _ => fn exn_id => |
60954
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
45 |
let val s = print_exn_id exn_id |
62503 | 46 |
in ML_Pretty.to_polyml (ML_Pretty.String (s, FixedInt.fromInt (size s))) end); |
60954
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
47 |
|
eeee8349e9eb
abstract exn_id based on getExnId in polyml/basis/FinalPolyML.sml (NB: the mutable machine word cannot be inspected in ML, e.g. toplevel pp dumps core);
wenzelm
parents:
60853
diff
changeset
|
48 |
|
60729 | 49 |
(* hooks *) |
50 |
||
51 |
val on_entry = PolyML.DebuggerInterface.setOnEntry; |
|
52 |
val on_exit = PolyML.DebuggerInterface.setOnExit; |
|
53 |
val on_exit_exception = PolyML.DebuggerInterface.setOnExitException; |
|
60744 | 54 |
val on_breakpoint = PolyML.DebuggerInterface.setOnBreakPoint; |
60729 | 55 |
|
56 |
||
57 |
(* debugger operations *) |
|
58 |
||
59 |
type state = PolyML.DebuggerInterface.debugState; |
|
60 |
||
61 |
val state = PolyML.DebuggerInterface.debugState; |
|
62 |
val debug_function = PolyML.DebuggerInterface.debugFunction; |
|
63 |
val debug_function_arg = PolyML.DebuggerInterface.debugFunctionArg; |
|
64 |
val debug_function_result = PolyML.DebuggerInterface.debugFunctionResult; |
|
65 |
val debug_location = PolyML.DebuggerInterface.debugLocation; |
|
66 |
val debug_name_space = PolyML.DebuggerInterface.debugNameSpace; |
|
61886 | 67 |
val debug_local_name_space = PolyML.DebuggerInterface.debugLocalNameSpace; |
60729 | 68 |
|
69 |
end; |