Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Crash when debugging a program that calls Unix.fork() #4541
Original bug ID: 4541
When debugging a bytecode program that calls Unix.fork(), ocamlrun
At the point just after the call to Unix.fork(), ocamldebug usually
Ocamlrun usually also terminates itself at this point.
This appears to be happening because ocamldebug is receiving unexpected
Occasionally, though, ocamldebug doesn't crash, but continues to report
The current behaviour is making it difficult for us to debug programs
I'm wondering, is it possible to make ocamlrun aware of Unix.fork(),
Thanks for your help
Comment author: bacam
I've been playing around with ocamldebug support for fork a bit, and I'll attach a patch shortly. It works by closing the connection to one of the processes, and it includes a gdb-like option to pick whether to follow the parent or child process. One small wart is that I've added a stub implementation of the debugging functions to the native code runtime; another option would be to build two versions of the unix library.
The patch was made against 3.11.1, but applies to the trunk version too.