File indexing completed on 2026-03-28 07:46:14
0001
0002
0003
0004
0005
0006
0007
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 }