mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-13 17:36:16 +00:00
Raise SIGABRT when assert fails
This commit is contained in:
parent
3bc826f0ea
commit
0757e27683
1 changed files with 5 additions and 1 deletions
|
@ -220,7 +220,11 @@ void log_cell(RTLIL::Cell *cell, std::string indent = "");
|
||||||
void log_wire(RTLIL::Wire *wire, 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) {
|
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
|
#ifndef NDEBUG
|
||||||
# define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__)
|
# define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue