diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | kernel/log.cc | 4 |
2 files changed, 6 insertions, 2 deletions
@@ -264,9 +264,9 @@ endif ifeq ($(ENABLE_DEBUG),1) ifeq ($(CONFIG),clang) -CXXFLAGS := -O0 $(filter-out -Os,$(CXXFLAGS)) +CXXFLAGS := -O0 -DDEBUG $(filter-out -Os,$(CXXFLAGS)) else -CXXFLAGS := -Og $(filter-out -Os,$(CXXFLAGS)) +CXXFLAGS := -Og -DDEBUG $(filter-out -Os,$(CXXFLAGS)) endif endif diff --git a/kernel/log.cc b/kernel/log.cc index 7be95204b..8b12008bc 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -375,6 +375,9 @@ void log_backtrace(const char *prefix, int levels) if (levels <= 1) return; +#ifndef DEBUG + log("%sframe #2: [build Yosys with ENABLE_DEBUG for deeper backtraces]\n", prefix); +#else if ((p = __builtin_extract_return_addr(__builtin_return_address(1))) && dladdr(p, &dli)) { log("%sframe #2: %p %s(%p) %s(%p)\n", prefix, p, dli.dli_fname, dli.dli_fbase, dli.dli_sname, dli.dli_saddr); } else { @@ -446,6 +449,7 @@ void log_backtrace(const char *prefix, int levels) } if (levels <= 9) return; +#endif } #else void log_backtrace(const char*, int) { } |