My working unpac repository
at opam/upstream/seq 134 lines 4.0 kB view raw
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 19module Sp : sig 20 type t 21 val null : t 22 val base : t -> int -> t 23 val compare : t -> t -> int 24end 25 26type pc = 27 { frag : int; 28 pos : int; } 29 30val main_frag : int 31 32type execution_summary = 33 Event 34 | Breakpoint 35 | Exited 36 | Trap_barrier 37 | Uncaught_exc 38 | Debug_info of Instruct.debug_event list array 39 | Code_loaded of int 40 | Code_unloaded of int 41 42type report = 43 { rep_type : execution_summary; 44 rep_event_count : int64; 45 rep_stack_pointer : Sp.t; 46 rep_program_pointer : pc } 47 48type checkpoint_report = 49 Checkpoint_done of int 50 | Checkpoint_failed 51 52type follow_fork_mode = 53 Fork_child 54 | Fork_parent 55 56(* Set the current connection with the debuggee *) 57val set_current_connection : Primitives.io_channel -> unit 58 59(* Put an event at given pc *) 60val set_event : pc -> unit 61 62(* Put a breakpoint at given pc *) 63val set_breakpoint : pc -> unit 64 65(* Remove breakpoint or event at given pc *) 66val reset_instr : pc -> unit 67 68(* Create a new checkpoint (the current process forks). *) 69val do_checkpoint : unit -> checkpoint_report 70 71(* Step N events. *) 72val do_go : int64 -> report 73 74(* Tell given process to terminate *) 75val stop : Primitives.io_channel -> unit 76 77(* Tell given process to wait for its children *) 78val wait_child : Primitives.io_channel -> unit 79 80(* Move to initial frame (that of current function). *) 81(* Return stack position and current pc *) 82val initial_frame : unit -> Sp.t * pc 83val set_initial_frame : unit -> unit 84 85(* Get the current frame position *) 86(* Return stack position and current pc *) 87val get_frame : unit -> Sp.t * pc 88 89(* Set the current frame *) 90val set_frame : Sp.t -> unit 91 92(* Move up one frame *) 93(* Return stack position and current pc. 94 If there's no frame above, return (null_sp, _). 95 The argument is the size of the current frame. 96 *) 97val up_frame : int -> Sp.t * pc 98 99(* Set the trap barrier to given stack position. *) 100val set_trap_barrier : Sp.t -> unit 101 102(* Set whether the debugger follow the child or the parent process on fork *) 103val fork_mode : follow_fork_mode ref 104val update_follow_fork_mode : unit -> unit 105 106(* Handling of remote values *) 107 108module Remote_value : 109 sig 110 type t 111 112 val repr : 'a -> t 113 val base_obj : t -> 'a 114 val obj : t -> (Obj.t, string) result 115 val is_block : t -> bool 116 val tag : t -> int 117 val size : t -> int 118 val field : t -> int -> t 119 val double_field : t -> int -> float 120 val double_array_tag : int 121 val same : t -> t -> bool 122 123 val of_int : int -> t 124 125 val local : int -> t 126 val from_environment : int -> t 127 val global : int -> t 128 val accu : unit -> t 129 val closure_code : t -> pc 130 131 (* Returns a hexadecimal representation of the remote address, 132 or [""] if the value is local. *) 133 val pointer : t -> string 134 end