diff options
-rw-r--r-- | byterun/debugger.c | 1 | ||||
-rw-r--r-- | debugger/program_management.ml | 12 |
2 files changed, 7 insertions, 6 deletions
diff --git a/byterun/debugger.c b/byterun/debugger.c index 237c24ef1..d615e485e 100644 --- a/byterun/debugger.c +++ b/byterun/debugger.c @@ -76,6 +76,7 @@ static void open_connection() if (!debugger_in_use) register_global_root((value *) &dbg_in); dbg_out = open_descr(dbg_socket); if (!debugger_in_use) register_global_root((value *) &dbg_out); + if (!debugger_in_use) putword(dbg_out, -1); /* first connection */ putword(dbg_out, getpid()); flush(dbg_out); } diff --git a/debugger/program_management.ml b/debugger/program_management.ml index 8619017ae..dbd2d8c5c 100644 --- a/debugger/program_management.ml +++ b/debugger/program_management.ml @@ -43,16 +43,14 @@ let control_connection pid fd = end (* Accept a connection from another process. *) -let loaded = ref false - let accept_connection continue fd = let (sock, _) = accept fd.io_fd in let io_chan = io_channel_of_descr sock in let pid = input_binary_int io_chan.io_in in - if not !loaded then begin - (*loaded := true;*) - new_checkpoint pid io_chan; - Input_handling.add_file io_chan (control_connection pid); + if pid = -1 then begin + let pid' = input_binary_int io_chan.io_in in + new_checkpoint pid' io_chan; + Input_handling.add_file io_chan (control_connection pid'); continue () end else begin @@ -96,6 +94,8 @@ let close_connection () = end (*** Kill program. ***) +let loaded = ref false + let kill_program () = loaded := false; close_connection (); |