Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-28 07:46:14

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "ActsPlugins/FpeMonitoring/FpeMonitor.hpp"
0012 
0013 #include <csignal>
0014 #include <cstddef>
0015 #include <optional>
0016 
0017 namespace ActsPlugins::detail {
0018 
0019 inline std::optional<FpeType> fpeTypeFromSiCode(int siCode) {
0020   using enum FpeType;
0021   switch (siCode) {
0022     case FPE_INTDIV:
0023       return INTDIV;
0024     case FPE_INTOVF:
0025       return INTOVF;
0026     case FPE_FLTDIV:
0027       return FLTDIV;
0028     case FPE_FLTOVF:
0029       return FLTOVF;
0030     case FPE_FLTUND:
0031       return FLTUND;
0032     case FPE_FLTRES:
0033       return FLTRES;
0034     case FPE_FLTINV:
0035       return FLTINV;
0036     case FPE_FLTSUB:
0037       return FLTSUB;
0038     default:
0039       return std::nullopt;
0040   }
0041 }
0042 
0043 bool isRuntimeSupported();
0044 
0045 std::optional<FpeType> decodeFpeType(int signal, const siginfo_t* si,
0046                                      void* ctx);
0047 
0048 void clearPendingExceptions(int excepts);
0049 void enableExceptions(int excepts);
0050 void disableExceptions(int excepts);
0051 void maskTrapsInSignalContext(void* ctx, FpeType type);
0052 
0053 std::size_t captureStackFromSignalContext(void* ctx, void* buffer,
0054                                           std::size_t bufferBytes);
0055 
0056 std::size_t safeDumpSkipFrames();
0057 
0058 bool shouldFailFastOnUnknownSignal();
0059 
0060 void installSignalHandlers(void (*handler)(int, siginfo_t*, void*));
0061 
0062 }  // namespace ActsPlugins::detail