Skip to content

Add a test for frametable setup in natdynlinked libraries #983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ocaml/testsuite/tests/lib-dynlink-native/main.reference
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Registering module Plugin2
2
6
1
Raised by primitive operation at Plugin2.foo in file "plugin2.ml", line 4, characters 38-64
Called from Plugin2.test_frametable in file "plugin2.ml", line 10, characters 2-72
Called from Plugin2 in file "plugin2.ml", line 19, characters 2-20
XXX
Loading plugin_thread.so
Registering module Plugin_thread
Expand Down
12 changes: 12 additions & 0 deletions ocaml/testsuite/tests/lib-dynlink-native/plugin2.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
(*external ex: int -> int = "caml_ex"*)

let foo a1 a2 a3 a4 a5 a6 a7 a8 a9 =
Printexc.print_raw_backtrace stdout (Printexc.get_callstack 4);
fun a10 a11 a12 a13 a14 a15 a16 a17 a18 -> ()

(* Ensure that the frametable is set up correctly so that a [caml_curry_18]
frame can be traversed *)
let[@inline never] test_frametable () =
(Sys.opaque_identity foo) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18;
(* force non-tail call *)
Sys.opaque_identity ()

let () =
Api.reg_mod "Plugin2";
Api.add_cb (fun () -> print_endline "Callback from plugin2");
(* let i = ex 3 in*)
List.iter (fun i -> Printf.printf "%i\n" i) Plugin.facts;
test_frametable ();
Printf.printf "XXX\n"