Skip to content

Commit 79a99ec

Browse files
lukemaurergretay-js
authored andcommitted
Add a test for frametable setup in natdynlinked libraries (#983)
1 parent 3824760 commit 79a99ec

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

ocaml/testsuite/tests/lib-dynlink-native/main.reference

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Registering module Plugin2
77
2
88
6
99
1
10+
Raised by primitive operation at Plugin2.foo in file "plugin2.ml", line 4, characters 38-64
11+
Called from Plugin2.test_frametable in file "plugin2.ml", line 10, characters 2-72
12+
Called from Plugin2 in file "plugin2.ml", line 19, characters 2-20
1013
XXX
1114
Loading plugin_thread.so
1215
Registering module Plugin_thread
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
(*external ex: int -> int = "caml_ex"*)
22

3+
let foo a1 a2 a3 a4 a5 a6 a7 a8 a9 =
4+
Printexc.print_raw_backtrace stdout (Printexc.get_callstack 4);
5+
fun a10 a11 a12 a13 a14 a15 a16 a17 a18 -> ()
6+
7+
(* Ensure that the frametable is set up correctly so that a [caml_curry_18]
8+
frame can be traversed *)
9+
let[@inline never] test_frametable () =
10+
(Sys.opaque_identity foo) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18;
11+
(* force non-tail call *)
12+
Sys.opaque_identity ()
13+
314
let () =
415
Api.reg_mod "Plugin2";
516
Api.add_cb (fun () -> print_endline "Callback from plugin2");
617
(* let i = ex 3 in*)
718
List.iter (fun i -> Printf.printf "%i\n" i) Plugin.facts;
19+
test_frametable ();
820
Printf.printf "XXX\n"

0 commit comments

Comments
 (0)