summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2015-12-04 00:12:58 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2015-12-04 00:12:58 +0000
commitdaa53da594d04925d10e792df804110d6a7bf2a2 (patch)
treef60a1b5722256718fea2fe93fb70e45b28022268 /SConstruct
parenta1aeff27ce2978bb5fd0a3da66878d914cfb4da2 (diff)
downloadgem5-daa53da594d04925d10e792df804110d6a7bf2a2.tar.xz
sim: Add support for generating back traces on errors
Add functionality to generate a back trace if gem5 crashes (SIGABRT or SIGSEGV). The current implementation uses glibc's stack traversal support if available and stubs out the call to print_backtrace() otherwise.
Diffstat (limited to 'SConstruct')
-rwxr-xr-xSConstruct17
1 files changed, 17 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index 45cfb0b89..b8db543b8 100755
--- a/SConstruct
+++ b/SConstruct
@@ -983,6 +983,21 @@ if not GetOption('without_tcmalloc'):
"installing tcmalloc (libgoogle-perftools-dev package "\
"on Ubuntu or RedHat)." + termcap.Normal
+
+# Detect back trace implementations. The last implementation in the
+# list will be used by default.
+backtrace_impls = [ "none" ]
+
+if conf.CheckLibWithHeader(None, 'execinfo.h', 'C',
+ 'backtrace_symbols_fd((void*)0, 0, 0);'):
+ backtrace_impls.append("glibc")
+
+if backtrace_impls[-1] == "none":
+ default_backtrace_impl = "none"
+ print termcap.Yellow + termcap.Bold + \
+ "No suitable back trace implementation found." + \
+ termcap.Normal
+
if not have_posix_clock:
print "Can't find library for POSIX clocks."
@@ -1131,6 +1146,8 @@ sticky_vars.AddVariables(
BoolVariable('USE_KVM', 'Enable hardware virtualized (KVM) CPU models', have_kvm),
EnumVariable('PROTOCOL', 'Coherence protocol for Ruby', 'None',
all_protocols),
+ EnumVariable('BACKTRACE_IMPL', 'Post-mortem dump implementation',
+ backtrace_impls[-1], backtrace_impls)
)
# These variables get exported to #defines in config/*.hh (see src/SConscript).