Skip to content

Commit 8521d35

Browse files
authored
Merge pull request #11 from semgrep/nathan/domains_inherit_backtrace
feat: preserve `backtrace_enabled` between domains This is a backport of ocaml#14416 , which fixes ocaml#14411 . This patch subsumes semgrep/semgrep-proprietary#5022 (since it makes the same fix but in the runtime rather than in our user code).
2 parents 7497113 + fe74581 commit 8521d35

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

runtime/domain.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,10 @@ static void domain_create(uintnat initial_minor_heap_wsize,
742742

743743
domain_state->parser_trace = 0;
744744

745-
if (caml_params->backtrace_enabled) {
746-
caml_record_backtraces(1);
747-
}
745+
bool bt_enabled = parent
746+
? parent->backtrace_active
747+
: caml_params->backtrace_enabled;
748+
caml_record_backtraces(bt_enabled);
748749

749750
#ifndef NATIVE_CODE
750751
domain_state->external_raise = NULL;

stdlib/printexc.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ val record_backtrace: bool -> unit
7474
on (if [b = true]) or off (if [b = false]). Initially, backtraces
7575
are not recorded, unless the [b] flag is given to the program
7676
through the [OCAMLRUNPARAM] variable.
77+
@before 5.3-semgrep Spawned domains' backtraces would not be recorded,
78+
even if the parent had called [record_backtrace true].
7779
@since 3.11
7880
*)
7981

0 commit comments

Comments
 (0)