From: Gabe Black Date: Sun, 7 Feb 2021 10:13:31 +0000 (-0800) Subject: scons: Simplify backtrace implementation detection. X-Git-Tag: develop-gem5-snapshot~85 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=452ff429b496a671a6b24227c6215e60c9ea4aea;p=gem5.git scons: Simplify backtrace implementation detection. There are really only two options current, glibc or none. If there's a working implementation there's no real reason to select none, and if there isn't there's no other option but to select none. Instead of building up a list, having a default, and making what option on the list is selected configurable, boil it down to either using glibc if that implementation is detected, or warning and using none. Also merge the "normal" and *BSD versions of the checks to reduce redundancy. The complexity can be added back in if/when there are other implementations to choose from. Change-Id: I27c77996a00018302f4daea40924cf059d5a4323 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40864 Tested-by: kokoro Maintainer: Gabe Black Reviewed-by: Andreas Sandberg --- diff --git a/SConstruct b/SConstruct index d4acd19e1..a3c330f69 100755 --- a/SConstruct +++ b/SConstruct @@ -649,22 +649,11 @@ if not GetOption('without_tcmalloc'): "on Ubuntu or RedHat).") -# Detect back trace implementations. The last implementation in the -# list will be used by default. -backtrace_impls = [ "none" ] - -backtrace_checker = 'char temp;' + \ - ' backtrace_symbols_fd((void*)&temp, 0, 0);' -if conf.CheckLibWithHeader(None, 'execinfo.h', 'C', backtrace_checker): - backtrace_impls.append("glibc") -elif conf.CheckLibWithHeader('execinfo', 'execinfo.h', 'C', - backtrace_checker): - # NetBSD and FreeBSD need libexecinfo. - backtrace_impls.append("glibc") - main.Append(LIBS=['execinfo']) - -if backtrace_impls[-1] == "none": - default_backtrace_impl = "none" +if conf.CheckLibWithHeader([None, 'execinfo'], 'execinfo.h', 'C', + 'char temp; backtrace_symbols_fd((void *)&temp, 0, 0);'): + main['BACKTRACE_IMPL'] = 'glibc' +else: + main['BACKTRACE_IMPL'] = 'none' warning("No suitable back trace implementation found.") # Check for (C99 FP environment control) @@ -866,8 +855,6 @@ sticky_vars.AddVariables( BoolVariable('BUILD_GPU', 'Build the compute-GPU model', False), EnumVariable('PROTOCOL', 'Coherence protocol for Ruby', 'None', all_protocols), - EnumVariable('BACKTRACE_IMPL', 'Post-mortem dump implementation', - backtrace_impls[-1], backtrace_impls), ('NUMBER_BITS_PER_SET', 'Max elements in set (default 64)', 64), BoolVariable('USE_HDF5', 'Enable the HDF5 support', have_hdf5),