1 (**************************************************************************)
2 (* *)
3 (* OCaml *)
4 (* *)
5 (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *)
6 (* OCaml port by John Malecki and Xavier Leroy *)
7 (* *)
8 (* Copyright 1996 Institut National de Recherche en Informatique et *)
9 (* en Automatique. *)
10 (* *)
11 (* All rights reserved. This file is distributed under the terms of *)
12 (* the GNU Lesser General Public License version 2.1, with the *)
13 (* special exception on linking described in the file LICENSE. *)
14 (* *)
15 (**************************************************************************)
16
17 (* Low-level communication with the debuggee *)
18
19 type pc =
20 { frag : int;
21 pos : int; }
22
23 type execution_summary =
24 Event
25 | Breakpoint
26 | Exited
27 | Trap_barrier
28 | Uncaught_exc
29 | Debug_info of Instruct.debug_event list array
30 | Code_loaded of int
31 | Code_unloaded of int
32
33 type report =
34 { rep_type : execution_summary;
35 rep_event_count : int64;
36 rep_stack_pointer : int;
37 rep_program_pointer : pc }
38
39 type checkpoint_report =
40 Checkpoint_done of int
41 | Checkpoint_failed
42
43 type follow_fork_mode =
44 Fork_child
45 | Fork_parent
46
47 (* Set the current connection with the debuggee *)
48 val set_current_connection : Primitives.io_channel -> unit
49
50 (* Put an event at given pc *)
51 val set_event : pc -> unit
52
53 (* Put a breakpoint at given pc *)
54 val set_breakpoint : pc -> unit
55
56 (* Remove breakpoint or event at given pc *)
57 val reset_instr : pc -> unit
58
59 (* Create a new checkpoint (the current process forks). *)
60 val do_checkpoint : unit -> checkpoint_report
61
62 (* Step N events. *)
63 val do_go : int64 -> report
64
65 (* Tell given process to terminate *)
66 val stop : Primitives.io_channel -> unit
67
68 (* Tell given process to wait for its children *)
69 val wait_child : Primitives.io_channel -> unit
70
71 (* Move to initial frame (that of current function). *)
72 (* Return stack position and current pc *)
73 val initial_frame : unit -> int * pc
74 val set_initial_frame : unit -> unit
75
76 (* Get the current frame position *)
77 (* Return stack position and current pc *)
78 val get_frame : unit -> int * pc
79
80 (* Set the current frame *)
81 val set_frame : int -> unit
82
83 (* Move up one frame *)
84 (* Return stack position and current pc.
85 If there's no frame above, return (-1, 0). *)
86 val up_frame : int -> int * pc
87
88 (* Set the trap barrier to given stack position. *)
89 val set_trap_barrier : int -> unit
90
91 (* Set whether the debugger follow the child or the parent process on fork *)
92 val fork_mode : follow_fork_mode ref
93 val update_follow_fork_mode : unit -> unit
94
95 (* Handling of remote values *)
96
97 exception Marshalling_error
98
99 module Remote_value :
100 sig
101 type t
102
103 val repr : 'a -> t
104 val obj : t -> 'a
105 val is_block : t -> bool
106 val tag : t -> int
107 val size : t -> int
108 val field : t -> int -> t
109 val double_field : t -> int -> float
110 val double_array_tag : int
111 val same : t -> t -> bool
112
113 val of_int : int -> t
114
115 val local : int -> t
116 val from_environment : int -> t
117 val global : int -> t
118 val accu : unit -> t
119 val closure_code : t -> pc
120
121 (* Returns a hexadecimal representation of the remote address,
122 or [""] if the value is local. *)
123 val pointer : t -> string
124 end
125