diff -aur original/command_line.ml patched/command_line.ml --- original/command_line.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/command_line.ml 2010-01-24 20:13:08.000000000 +0100 @@ -77,11 +77,7 @@ raise Toplevel let check_not_windows feature = - match Sys.os_type with - | "Win32" -> - error ("'"^feature^"' feature not supported on Windows") - | _ -> - () + ignore (error ("'" ^ feature ^ "' feature not supported")) let eol = end_of_line Lexer.lexeme diff -aur original/debugcom.ml patched/debugcom.ml --- original/debugcom.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/debugcom.ml 2010-01-24 20:14:44.000000000 +0100 @@ -100,12 +100,7 @@ let do_checkpoint () = match Sys.os_type with - "Win32" -> failwith "do_checkpoint" - | _ -> - output_char !conn.io_out 'c'; - flush !conn.io_out; - let pid = input_binary_int !conn.io_in in - if pid = -1 then Checkpoint_failed else Checkpoint_done pid + | _ -> failwith "do_checkpoint" (* Kill the given process. *) let stop chan = @@ -197,7 +192,7 @@ let is_block = function | Local obj -> Obj.is_block obj - | Remote v -> Obj.is_block (Array.unsafe_get (Obj.magic v : Obj.t array) 0) + | Remote v -> ((Char.code v.[0]) land 1) = 0 let tag = function | Local obj -> Obj.tag obj @@ -232,9 +227,14 @@ else begin let buf = String.create 8 in really_input !conn.io_in buf 0 8; - let floatbuf = float n (* force allocation of a new float *) in - String.unsafe_blit buf 0 (Obj.magic floatbuf) 0 8; - Local(Obj.repr floatbuf) + let bits = ref Int64.zero in + for i = 0 to pred (String.length buf) do + bits := Int64.logor + (Int64.shift_left !bits 8) + (Int64.of_int (Char.code buf.[i])) + done; + let res = Int64.float_of_bits !bits in + Local(Obj.repr res) end let of_int n = diff -aur original/debugger_config.ml patched/debugger_config.ml --- original/debugger_config.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/debugger_config.ml 2010-01-24 20:13:53.000000000 +0100 @@ -76,7 +76,4 @@ let checkpoint_max_count = ref 15 (* Whether to keep checkpoints or not. *) -let make_checkpoints = ref - (match Sys.os_type with - "Win32" -> false - | _ -> true) +let make_checkpoints = ref false diff -aur original/exec.ml patched/exec.ml --- original/exec.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/exec.ml 2010-01-24 20:15:43.000000000 +0100 @@ -26,10 +26,7 @@ let _ = match Sys.os_type with - "Win32" -> () - | _ -> - Sys.set_signal Sys.sigint (Sys.Signal_handle break); - Sys.set_signal Sys.sigpipe (Sys.Signal_handle (fun _ -> raise End_of_file)) + | _ -> () let protect f = if !is_protected then diff -aur original/input_handling.ml patched/input_handling.ml --- original/input_handling.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/input_handling.ml 2010-01-24 20:16:49.000000000 +0100 @@ -70,13 +70,13 @@ while !continue_main_loop do try let (input, _, _) = - select (List.map fst !active_files) [] [] (-1.) + (List.map fst !active_files), [], [] in List.iter (function fd -> let (funct, iochan) = (List.assoc fd !active_files) in funct iochan) - input + [(List.hd input)] with Unix_error (EINTR, _, _) -> () done; diff -aur original/main.ml patched/main.ml --- original/main.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/main.ml 2010-01-24 20:18:17.000000000 +0100 @@ -178,15 +178,14 @@ ] let main () = + Random.self_init (); try socket_name := (match Sys.os_type with - "Win32" -> + | _ -> (Unix.string_of_inet_addr Unix.inet_addr_loopback)^ ":"^ - (string_of_int (10000 + ((Unix.getpid ()) mod 10000))) - | _ -> Filename.concat Filename.temp_dir_name - ("camldebug" ^ (string_of_int (Unix.getpid ()))) + (string_of_int (10000 + ((Random.bits ()) mod 10000))) ); begin try Arg.parse speclist anonymous ""; diff -aur original/program_loading.ml patched/program_loading.ml --- original/program_loading.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/program_loading.ml 2010-01-24 20:21:25.000000000 +0100 @@ -35,86 +35,6 @@ (*** Launching functions. ***) -(* A generic function for launching the program *) -let generic_exec_unix cmdline = function () -> - if !debug_loading then - prerr_endline "Launching program..."; - let child = - try - fork () - with x -> - Unix_tools.report_error x; - raise Toplevel in - match child with - 0 -> - begin try - match fork () with - 0 -> (* Try to detach the process from the controlling terminal, - so that it does not receive SIGINT on ctrl-C. *) - begin try ignore(setsid()) with Invalid_argument _ -> () end; - execv shell [| shell; "-c"; cmdline() |] - | _ -> exit 0 - with x -> - Unix_tools.report_error x; - exit 1 - end - | _ -> - match wait () with - (_, WEXITED 0) -> () - | _ -> raise Toplevel - -let generic_exec_win cmdline = function () -> - if !debug_loading then - prerr_endline "Launching program..."; - try ignore(create_process "cmd.exe" [| "/C"; cmdline() |] stdin stdout stderr) - with x -> - Unix_tools.report_error x; - raise Toplevel - -let generic_exec = - match Sys.os_type with - "Win32" -> generic_exec_win - | _ -> generic_exec_unix - -(* Execute the program by calling the runtime explicitely *) -let exec_with_runtime = - generic_exec - (function () -> - match Sys.os_type with - "Win32" -> - (* This fould fail on a file name with spaces - but quoting is even worse because Unix.create_process - thinks each command line parameter is a file. - So no good solution so far *) - Printf.sprintf "set CAML_DEBUG_SOCKET=%s && %s %s %s" - !socket_name - runtime_program - !program_name - !arguments - | _ -> - Printf.sprintf "CAML_DEBUG_SOCKET=%s %s %s %s" - !socket_name - (Filename.quote runtime_program) - (Filename.quote !program_name) - !arguments) - -(* Excute the program directly *) -let exec_direct = - generic_exec - (function () -> - match Sys.os_type with - "Win32" -> - (* See the comment above *) - Printf.sprintf "set CAML_DEBUG_SOCKET=%s && %s %s" - !socket_name - !program_name - !arguments - | _ -> - Printf.sprintf "CAML_DEBUG_SOCKET=%s %s %s" - !socket_name - (Filename.quote !program_name) - !arguments) - (* Ask the user. *) let exec_manual = function () -> @@ -128,9 +48,7 @@ type launching_function = (unit -> unit) let loading_modes = - ["direct", exec_direct; - "runtime", exec_with_runtime; - "manual", exec_manual] + ["manual", exec_manual] let set_launching_function func = launching_func := func @@ -138,7 +56,7 @@ (* Initialization *) let _ = - set_launching_function exec_direct + set_launching_function exec_manual (*** Connection. ***) diff -aur original/unix_tools.ml patched/unix_tools.ml --- original/unix_tools.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/unix_tools.ml 2010-01-24 20:24:23.000000000 +0100 @@ -37,8 +37,7 @@ failwith "Can't convert address"))) with Not_found -> match Sys.os_type with - "Win32" -> failwith "Unix sockets not supported" - | _ -> (PF_UNIX, ADDR_UNIX address) + | _ -> failwith "Unix sockets not supported" (*** Report a unix error. ***) let report_error = function