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 committed May 17, 2022
1 parent 3a4746d commit 0a3e028
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/eventlog.h"
Expand Down Expand Up @@ -946,6 +947,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
CAML_EV_BEGIN(EV_DOMAIN_SPAWN);
p.parent = &domain_self->interruptor;
p.status = Dom_starting;
Expand Down

0 comments on commit 0a3e028

Please sign in to comment.