From daa53da594d04925d10e792df804110d6a7bf2a2 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Fri, 4 Dec 2015 00:12:58 +0000 Subject: 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. --- SConstruct | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'SConstruct') 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). -- cgit v1.2.3