aboutsummaryrefslogtreecommitdiff
path: root/src/asan-options
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-06-17 23:47:51 -0700
committerJade Lovelace <lix@jade.fyi>2024-07-31 14:13:39 -0700
commit19ae87e5cec71912c7e7ecec5dc8ff18d18c60ee (patch)
tree11976a4030158b0b3ccd00eb10ab7e867e503811 /src/asan-options
parentc347d3df8f1aebe124b6a3179d4dd83ccadd44b5 (diff)
tree-wide: add support for asan!
What if you could find memory bugs in Lix without really trying very hard? I've had variously scuffed patches to do this, but this is blocked on boost coroutines removal at this point tbh. Change-Id: Id762af076aa06ad51e77a6c17ed10275929ed578
Diffstat (limited to 'src/asan-options')
-rw-r--r--src/asan-options/asan-options.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/asan-options/asan-options.cc b/src/asan-options/asan-options.cc
new file mode 100644
index 000000000..c4cf360af
--- /dev/null
+++ b/src/asan-options/asan-options.cc
@@ -0,0 +1,17 @@
+/// @file This is very bothersome code that has to be included in every
+/// executable to get the correct default ASan options. I am so sorry.
+
+extern "C" [[gnu::retain]] const char *__asan_default_options()
+{
+ // We leak a bunch of memory knowingly on purpose. It's not worthwhile to
+ // diagnose that memory being leaked for now.
+ //
+ // Instruction bytes are useful for finding the actual code that
+ // corresponds to an ASan report.
+ //
+ // TODO: setting log_path=asan.log or not: neither works, since you can't
+ // write to the fs in certain places in the testsuite, but you also cannot
+ // write arbitrarily to stderr in other places so the reports get eaten.
+ // pain 🥖
+ return "halt_on_error=1:abort_on_error=1:detect_leaks=0:print_summary=1:dump_instruction_bytes=1";
+}