From: Clifford Wolf Date: Sat, 3 Feb 2018 14:04:39 +0000 (+0100) Subject: Do not create deep backtraces unless in ENABLE_DEBUG mode X-Git-Tag: yosys-0.8~222 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=82c436587c31cd760aef4db3661d54553ab88b87;p=yosys.git Do not create deep backtraces unless in ENABLE_DEBUG mode Signed-off-by: Clifford Wolf --- diff --git a/Makefile b/Makefile index dcc8be3eb..39e173a26 100644 --- a/Makefile +++ b/Makefile @@ -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) { }