diff --git a/src/common/Assert.cpp b/src/common/Assert.cpp index c4d7528872..8802c202f3 100644 --- a/src/common/Assert.cpp +++ b/src/common/Assert.cpp @@ -15,11 +15,17 @@ #include "common/Assert.h" #include "common/Log.h" +#include + void HandleAssertionFailure(const char* file, const char* function, int line, const char* condition) { dawn::ErrorLog() << "Assertion failure at " << file << ":" << line << " (" << function << "): " << condition; +#if defined(DAWN_ABORT_ON_ASSERT) + abort(); +#else DAWN_BREAKPOINT(); +#endif } diff --git a/src/common/BUILD.gn b/src/common/BUILD.gn index 80ee2c25e0..a005613109 100644 --- a/src/common/BUILD.gn +++ b/src/common/BUILD.gn @@ -25,6 +25,12 @@ if (build_with_chromium) { dcheck_always_on = false } +if (build_with_chromium) { + import("//build/config/sanitizers/sanitizers.gni") +} else { + use_fuzzing_engine = false +} + ############################################################################### # Common dawn configs ############################################################################### @@ -43,10 +49,16 @@ config("dawn_internal") { ] defines = [] - if (dawn_always_assert || dcheck_always_on || is_debug) { + if (dawn_always_assert || dcheck_always_on || is_debug || + use_fuzzing_engine) { defines += [ "DAWN_ENABLE_ASSERTS" ] } + if (use_fuzzing_engine) { + # Does a hard abort when an assertion fails so that fuzzers catch and parse the failure. + defines += [ "DAWN_ABORT_ON_ASSERT" ] + } + if (dawn_enable_d3d12) { defines += [ "DAWN_ENABLE_BACKEND_D3D12" ] }