From 0757e27683d8bf55607fb83d5ea1977e542fbc39 Mon Sep 17 00:00:00 2001 From: Akash Levy Date: Tue, 17 Dec 2024 09:58:54 -0800 Subject: [PATCH] Raise SIGABRT when assert fails --- kernel/log.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/log.h b/kernel/log.h index f0de32973..10ca05a09 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -220,7 +220,11 @@ void log_cell(RTLIL::Cell *cell, std::string indent = ""); void log_wire(RTLIL::Wire *wire, std::string indent = ""); static inline void log_assert_worker(bool cond, const char *expr, const char *file, int line) { - if (!cond) log_error("Assert `%s' failed in %s:%d.\n", expr, file, line); + if (!cond) { + log("ERROR: Assert `%s' failed in %s:%d.\n", expr, file, line); + log_flush(); + raise(SIGABRT); + } } #ifndef NDEBUG # define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__)