ATLAS Offline Software
Loading...
Searching...
No Matches
FPEAndCoreDumpConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
3from AthenaConfiguration.ComponentFactory import CompFactory
4
5
7 """Configure FPE handling and CoreDumpSvc"""
8
9 cfg = ComponentAccumulator()
10 cds = CompFactory.CoreDumpSvc(FastStackTrace=True)
11
12 if flags.Exec.FPE != -2: # -2: disabled
13 if flags.Exec.FPE == -1: # -1: abort with core dump
14 cfg.addService(CompFactory.FPEControlSvc(), create=True)
15 else:
16 try:
17 fpe_aud = CompFactory.FPEAuditor(NStacktracesOnFPE=flags.Exec.FPE)
18 except AttributeError:
19 pass # FPEAuditor not available in all projects
20 else:
21 cfg.addAuditor(fpe_aud)
22 # If FPEAuditor is used, the CoreDumpSvc should not catch SIGFPE.
23 # Need to copy the list first as we cannot modify a default value.
24 from signal import SIGFPE
25 signalsToCatch = list(cds.Signals)
26 try:
27 signalsToCatch.remove(SIGFPE)
28 cds.Signals = signalsToCatch
29 except ValueError:
30 pass # SIGFPE was not in the list
31
32 cfg.addService(cds, create=True)
33 return cfg