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 May 31, 2022
1 parent 00c0b02 commit 1aed1cb
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 @@ -1112,6 +1113,10 @@ CAMLprim value caml_domain_spawn(value callback, value mutex)
pthread_t th;
int err;

#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 1aed1cb

Please sign in to comment.