Skip to content

Commit d1ccc3d

Browse files
authored
Use sanitizer runtime to print pretty stack traces on unreachable (#1079)
For even better debugging support.
1 parent e488da5 commit d1ccc3d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/compiler-support.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
# define WASM_UNREACHABLE() __builtin_unreachable()
3232
#elif defined(_MSC_VER)
3333
# define WASM_UNREACHABLE() __assume(false)
34+
#elif __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
35+
# include "sanitizer/common_interface_defs.h"
36+
# define WASM_UNREACHABLE() do { __sanitizer_print_stack_trace(); __builtin_trap(); } while (0)
3437
#else
3538
# include <stdlib.h>
3639
# define WASM_UNREACHABLE() abort()

0 commit comments

Comments
 (0)