summaryrefslogtreecommitdiff
path: root/src/compiler-support.h
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2017-06-30 13:28:42 -0700
committerGitHub <noreply@github.com>2017-06-30 13:28:42 -0700
commitd1ccc3d33adb191e6728cd136ef6596d98e2a716 (patch)
tree9224fee3e507bcfc7c892168fe24044f812289f6 /src/compiler-support.h
parente488da5adbef2613c08fe205db5b79b1765a4af3 (diff)
downloadbinaryen-d1ccc3d33adb191e6728cd136ef6596d98e2a716.tar.gz
binaryen-d1ccc3d33adb191e6728cd136ef6596d98e2a716.tar.bz2
binaryen-d1ccc3d33adb191e6728cd136ef6596d98e2a716.zip
Use sanitizer runtime to print pretty stack traces on unreachable (#1079)
For even better debugging support.
Diffstat (limited to 'src/compiler-support.h')
-rw-r--r--src/compiler-support.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compiler-support.h b/src/compiler-support.h
index f2e58ff5e..f105271b5 100644
--- a/src/compiler-support.h
+++ b/src/compiler-support.h
@@ -31,6 +31,9 @@
# define WASM_UNREACHABLE() __builtin_unreachable()
#elif defined(_MSC_VER)
# define WASM_UNREACHABLE() __assume(false)
+#elif __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
+# include "sanitizer/common_interface_defs.h"
+# define WASM_UNREACHABLE() do { __sanitizer_print_stack_trace(); __builtin_trap(); } while (0)
#else
# include <stdlib.h>
# define WASM_UNREACHABLE() abort()