summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/main.c b/main.c
index e76228713f..cbb294ba72 100644
--- a/main.c
+++ b/main.c
@@ -20,10 +20,12 @@
#undef RUBY_EXPORT
#include "ruby.h"
#include "vm_debug.h"
+#include "internal/sanitizers.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
-#if RUBY_DEVEL && !defined RUBY_DEBUG_ENV
+
+#if defined RUBY_DEVEL && !defined RUBY_DEBUG_ENV
# define RUBY_DEBUG_ENV 1
#endif
#if defined RUBY_DEBUG_ENV && !RUBY_DEBUG_ENV
@@ -46,7 +48,7 @@ int rb_wasm_rt_start(int (main)(int argc, char **argv), int argc, char **argv);
int
main(int argc, char **argv)
{
-#ifdef RUBY_DEBUG_ENV
+#if defined(RUBY_DEBUG_ENV) || USE_RUBY_DEBUG_LOG
ruby_set_debug_option(getenv("RUBY_DEBUG"));
#endif
#ifdef HAVE_LOCALE_H
@@ -56,3 +58,14 @@ main(int argc, char **argv)
ruby_sysinit(&argc, &argv);
return rb_main(argc, argv);
}
+
+#ifdef RUBY_ASAN_ENABLED
+/* Compile in the ASAN options Ruby needs, rather than relying on environment variables, so
+ * that even tests which fork ruby with a clean environment will run ASAN with the right
+ * settings */
+const char *
+__asan_default_options(void)
+{
+ return "use_sigaltstack=0:detect_leaks=0";
+}
+#endif