ATLAS Offline Software
Loading...
Searching...
No Matches
SealDebug.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
20
21#ifndef CXXUTILS_SEAL_DEBUG_H // wlav SEAL_BASE_DEBUG_H
22#define CXXUTILS_SEAL_DEBUG_H // wlav SEAL_BASE_DEBUG_H
23
25#include "CxxUtils/SealCommon.h" // sss -- needed for IOFD
26# include <cstddef>
27# include <atomic>
28
29// wlav copied from SealBase/sysapi/DebugAids.h
30// Windows doesn't have this, so fake a suitable substitute
31# ifdef _WIN32
32# define STDERR_HANDLE GetStdHandle (STD_ERROR_HANDLE)
33# else
34# define STDERR_HANDLE STDERR_FILENO
35# endif
36
37// Define a suitable wrapper to write to system file descriptors.
38// This is needed because on Windows we are using HANDLEs, not the
39// compiler's crippled posixy interface.
40# ifdef _WIN32
41# define MYWRITE(fd,data,n) do { DWORD written; WriteFile(fd,data,n,\
42 &written,0); } while (0)
43# else
44# define MYWRITE(fd,data,n) write(fd,data,n)
45# endif
46
47
48namespace Athena { // wlav
49
50
51// wlav copied from SealBase/BitTraits.h
53template <class T>
55{
57 enum { Bits = sizeof (T) * CHAR_BIT };
58
60 enum { Bytes = Bits / 8 + ((Bits % 8) > 0) };
61
63 enum { Digits = (Bits * 30103) / 100000 + 1 };
64 // 30103 =~ M_LN2 / M_LN10 * 100000
65
67 enum { HexDigits = Bits / 4 + ((Bits % 4) > 0) };
68};
69
70
73{
74public:
75 // Miscellaneous functions
76 static IOFD stacktraceFd (IOFD fd = IOFD_INVALID);
77 static void stacktrace ATLAS_NOT_THREAD_SAFE (IOFD fd = IOFD_INVALID);
78 static void coredump (int sig, ...);
79 // sss
80 static void stacktraceLine ATLAS_NOT_THREAD_SAFE (IOFD fd,
81 unsigned long addr);
82 static void setStackTraceAddr2Line ATLAS_NOT_THREAD_SAFE (const char* path);
83
84 // fwinkl
85 static unsigned long enableCoreFiles();
86 static void disableCoreFiles();
87private:
88 static std::atomic<IOFD> s_stackTraceFd;
89};
90
91
92} // namespace Athena wlav
93#endif // CXXUTILS_SEAL_DEBUG_H wlav SEAL_BASE_DEBUG_H
Collecting a few shared bits and pieces from SEAL headers.
#define IOFD_INVALID
Invalid channel descriptor constant.
Definition SealCommon.h:20
int IOFD
Type the system uses for channel descriptors.
Definition SealCommon.h:27
Define macros for attributes used to control the static checker.
Utilities for debugging support.
Definition SealDebug.h:73
static IOFD stacktraceFd(IOFD fd=IOFD_INVALID)
Set and return the file descriptor for stack trace output.
static void coredump(int sig,...)
Drop a core dump and continue.
static std::atomic< IOFD > s_stackTraceFd
The default output file descriptor for stacktrace().
Definition SealDebug.h:88
static void stacktraceLine ATLAS_NOT_THREAD_SAFE(IOFD fd, unsigned long addr)
static unsigned long enableCoreFiles()
Try to enable core dump files by raising the soft size limit to the hard limit.
static void disableCoreFiles()
Disable core dump files by setting the soft limit to 0.
static void stacktrace ATLAS_NOT_THREAD_SAFE(IOFD fd=IOFD_INVALID)
static void setStackTraceAddr2Line ATLAS_NOT_THREAD_SAFE(const char *path)
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....
Describe the bit features of an integral type T.
Definition SealDebug.h:55