Skip to content

Commit

Permalink
Stop cleanly if a program being debugged spawns a domain
Browse files Browse the repository at this point in the history
Otherwise the debugger gets all confused.

It is still possible to debug the program up to the point it spawns a
new domain.  This is the same solution we used in ocaml#10594 for programs
that create threads.
  • Loading branch information
xavierleroy authored and damiendoligez committed Jun 15, 2022
1 parent 68136c7 commit 9b26e61
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions runtime/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "caml/alloc.h"
#include "caml/backtrace.h"
#include "caml/callback.h"
#include "caml/debugger.h"
#include "caml/domain.h"
#include "caml/domain_state.h"
#include "caml/runtime_events.h"
Expand Down Expand Up @@ -1104,6 +1105,10 @@ CAMLprim value caml_domain_spawn(value callback, value mutex)
sigset_t mask, old_mask;
#endif

#ifndef NATIVE_CODE
if (caml_debugger_in_use)
caml_fatal_error("ocamldebug does not support spawning multiple domains");
#endif
p.parent = &domain_self->interruptor;
p.status = Dom_starting;

Expand Down

0 comments on commit 9b26e61

Please sign in to comment.