Add debugger flags for sanitizer script
Fix for https://github.com/ocaml/ocaml/issues/14058
We set the -g -O0 flags to enable generating debug information and disable optimised C for the test suite, which is required by the native-debug tests.
I suspect that the -fno-omit-frame-pointer flag is not required here either, the unwinding should be using CFI. But I haven't found a good way to test that.
cc @OlivierNicole
cf. https://ci.inria.fr/ocaml/job/precheck-sanitizers/9
Thanks for trying to fix this!
For now we get a bunch of times the warning:
clang-18: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled: -fsanitize=bool,builtin,bounds,enum,nonnull-attribute,nullability,object-size,pointer-overflow,returns-nonnull-attribute,shift-exponent,unreachable [-Winvalid-command-line-argument]
which makes the tests fail.
Is it necessary to disable optimization?
There is now a failure in the following tests on the "normal" CI configuration:
tests/native-debugger/linux-gdb-amd64.ml
tests/native-debugger/linux-lldb-amd64.ml
The observed diff in the CI result is as follows:
@@ -20,7 +20,7 @@
frame 6: caml_main
frame 7: main
Breakpoint 3, ocaml_to_c (unit=1) at meander_c.c:XX
-5 caml_callback(*caml_named_value
+4 value ocaml_to_c (value unit) {
frame 0: ocaml_to_c
frame 1: caml_c_call
frame 2: camlMeander$omain
)
Update on the original comment.
I have tried to make the sanitizer script agree with the native-debugger tests but have not managed to get both working with the same set of flags. The santizer tests require at least -Og to work, while native-debugger tests produce better results (accurate backtraces and source locations) with -O0 -g. Additionally the debug tests are not going to benefit from running with a sanitizer, they're primarily testing basic CFI. So I have added those linux debugger tests to OCAMLTEST_SKIP_TESTS which prevents them running with the inria sanitizer script.
https://ci.inria.fr/ocaml/job/precheck-sanitizers/11/consoleFull Which now shows two legitimate failures, neither of which I've looked into:
List of failed tests:
tests/tsan/exn_in_callback.ml
tests/weak-ephe-final/weak_array_par.ml
Since this is just a CI script change it doesn't require a change log entry.
Thanks for looking into it!
Which now shows two legitimate failures, neither of which I've looked into:
I think the first one is fixed by #14059 and the second one is #14061.