diff --git a/Control/AthenaCommon/python/AthOptionsParser.py b/Control/AthenaCommon/python/AthOptionsParser.py index fc01a7ee194637c6e87a36434aca1f4618909e7f..5daf9bf6f761186b1928bc95b087bc17326d0b0c 100644 --- a/Control/AthenaCommon/python/AthOptionsParser.py +++ b/Control/AthenaCommon/python/AthOptionsParser.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration # @file AthenaCommon.AthOptionsParser # @purpose the central module to parse command line options of athena.py @@ -30,7 +30,7 @@ _userlongopts = [ "enable-ers-hdlr=", "keep-configuration","drop-configuration", "drop-and-reload", "config-only=", "dump-configuration=", - "tcmalloc", "stdcmalloc", "stdcmath", "imf", "preloadlib=", + "tcmalloc", "stdcmalloc", "stdcmath", "imf", "exctrace", "preloadlib=", "nprocs=", "debugWorker", "pycintex_minvmem=", "cppyy_minvmem", @@ -94,6 +94,7 @@ Accepted command line options: --tcmalloc ... use tcmalloc.so for memory allocation [DEFAULT]. This disables leak-check --stdcmalloc ... use libc malloc for memory allocation --stdcmath ... use glibc math functions [DEFAULT] + --exctrace ... enable collecting tracebacks for exceptions --imf ... use Intel Math Function library: faster, but may give different numerical results from --stdcmath --preloadlib=<lib> ... localized preload of library <lib> --nprocs=n ... enable AthenaMP if n>=1 or n==-1 diff --git a/Control/AthenaCommon/share/athena.py b/Control/AthenaCommon/share/athena.py index 2140470dc9019f10a9995a392aee570bab31447b..088d1d09fc8cbf1bac7e5e878b4160ddd022ee64 100755 --- a/Control/AthenaCommon/share/athena.py +++ b/Control/AthenaCommon/share/athena.py @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration # # athena.py is born as shell script to preload some optional libraries # @@ -9,6 +9,7 @@ # defaults export USETCMALLOC=0 export USEIMF=0 +export USEEXCTRACE=0 USECA=0 otherargs="" # but use tcmalloc by default if TCMALLOCDIR is defined @@ -26,6 +27,7 @@ do --tcmalloc) USETCMALLOC=1;; --stdcmath) USEIMF=0;; --imf) USEIMF=1;; + --exctrace) USEEXCTRACE=1;; --preloadlib*) export ATHENA_ADD_PRELOAD=${a#*=};; --drop-and-reload) ATHENA_DROP_RELOAD=1;; --CA) USECA=1;; @@ -33,6 +35,7 @@ do esac done + # Do the actual preloading via LD_PRELOAD source `which athena_preload.sh ` diff --git a/Control/AthenaCommon/share/athena_preload.sh b/Control/AthenaCommon/share/athena_preload.sh index 32bb6f5a0986c752ec349672a1b08d59bfb065c2..9e655fd2cead7b7156e0b735b56b2ea837bb68ee 100755 --- a/Control/AthenaCommon/share/athena_preload.sh +++ b/Control/AthenaCommon/share/athena_preload.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration # # Script to set $LD_PRELOAD, steered by the following environment variables: # @@ -9,6 +9,7 @@ # $USETCMALLOCMINIMAL : use minimal version of tcmalloc # $ATLASMKLLIBDIR_PRELOAD : location of Intel math library # $USEIMF : use Intel math library +# $USEEXCTRACE : preload exception trace collector # $ATHENA_ADD_PRELOAD : preload user specific library # $ATHENA_DROP_RELOAD : are we in drop/reload mode? # @@ -81,6 +82,20 @@ if [ "$USEIMF" = "1" ] || [ "$USEIMF" = "true" ]; then fi fi +# +# Exception trace collector +# +if [ "$USEEXCTRACE" = "1" ] || [ "$USEEXCTRACE" = "true" ]; then + # Abuse which to search for the library. + EXCTRACE_LIB=`PATH=$LD_LIBRARY_PATH /usr/bin/which libexctrace_collector.so` + if [ "$EXCTRACE_LIB" = "" ]; then + error "ERROR: Cannot find libexctrace_collector.so" + exit 1 + fi + echo "Preloading `basename $EXCTRACE_LIB`" + ld_preload "$EXCTRACE_LIB" +fi + # # User specific preload #