···88888989### Standard library:
90909191+- #14363: Preserve the backtrace at exceptional domain termination. Domain.join
9292+ on an exceptionally terminated domain re-raises the exception with the
9393+ backtrace.
9494+ (KC Sivaramakrishnan, report by Nathan Taylor, review by Gabriel Scherer,
9595+ David Allsopp)
9696+9197- #13372: New Format and Printf printf-like functions that accept a
9298 heterogeneous list as arguments.
9399 (Leonardo Santos, review by Florian Angeletti and Gabriel Scherer)
···25252626 type 'a state =
2727 | Running
2828- | Finished of ('a, exn) result [@warning "-unused-constructor"]
2828+ | Finished of ('a, exn * Printexc.raw_backtrace) result
2929+ [@warning "-unused-constructor"]
29303031 type 'a term_sync = {
3132 (* protected by [mut] *)
···299300 in
300301 match Mutex.protect term_sync.mut loop with
301302 | Ok x -> x
302302- | Error ex -> raise ex
303303+ | Error (ex, bt) -> Printexc.raise_with_backtrace ex bt
303304304305let count = Raw.get_domain_count
305306let recommended_domain_count = Raw.get_recommended_domain_count
···11+(* TEST_BELOW
22+(* Blank lines added here to preserve locations. *)
33+44+*)
55+66+(* A test for backtraces on [Domain.join] *)
77+88+let rec bar n =
99+ if n = 0 then failwith "bar raised"
1010+ else foo (n-1) + 1
1111+1212+and foo n =
1313+ if n = 0 then failwith "foo raised"
1414+ else bar (n-1) + 1
1515+1616+let f () = foo 10
1717+1818+let _ =
1919+ match Domain.spawn f |> Domain.join with
2020+ | v -> ()
2121+ | exception e ->
2222+ let bt = Printexc.get_raw_backtrace () in
2323+ Printexc.print_raw_backtrace stdout bt
2424+2525+(* TEST
2626+ flags = "-g";
2727+ ocamlrunparam += ",b=1";
2828+*)
···11+Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
22+Called from Backtrace_domain_join.bar in file "backtrace_domain_join.ml", line 10, characters 7-16
33+Called from Backtrace_domain_join.foo in file "backtrace_domain_join.ml", line 14, characters 7-16
44+Called from Backtrace_domain_join.bar in file "backtrace_domain_join.ml", line 10, characters 7-16
55+Called from Backtrace_domain_join.foo in file "backtrace_domain_join.ml", line 14, characters 7-16
66+Called from Backtrace_domain_join.bar in file "backtrace_domain_join.ml", line 10, characters 7-16
77+Called from Backtrace_domain_join.foo in file "backtrace_domain_join.ml", line 14, characters 7-16
88+Called from Backtrace_domain_join.bar in file "backtrace_domain_join.ml", line 10, characters 7-16
99+Called from Backtrace_domain_join.foo in file "backtrace_domain_join.ml", line 14, characters 7-16
1010+Called from Backtrace_domain_join.bar in file "backtrace_domain_join.ml", line 10, characters 7-16
1111+Called from Backtrace_domain_join.foo in file "backtrace_domain_join.ml", line 14, characters 7-16
1212+Called from Stdlib__Domain.spawn.body in file "domain.ml", line 270, characters 16-20
1313+Re-raised at Stdlib__Domain.spawn.body in file "domain.ml", line 286, characters 8-17
1414+Re-raised at Stdlib__Domain.join in file "domain.ml", line 303, characters 22-57
1515+Called from Backtrace_domain_join in file "backtrace_domain_join.ml", line 19, characters 8-37