FatalSignalHandler: simplify the SA_SIGINFO handling
The #if around the function declaration was ugly. Pick-to: 6.3 Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb7540f5da080f Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
65ff731b62
commit
3e596da488
@ -1845,9 +1845,9 @@ public:
|
|||||||
memset(&act, 0, sizeof(act));
|
memset(&act, 0, sizeof(act));
|
||||||
# ifdef SA_SIGINFO
|
# ifdef SA_SIGINFO
|
||||||
act.sa_flags |= SA_SIGINFO;
|
act.sa_flags |= SA_SIGINFO;
|
||||||
act.sa_sigaction = FatalSignalHandler::signal;
|
act.sa_sigaction = FatalSignalHandler::actionHandler;
|
||||||
# else
|
# else
|
||||||
act.sa_handler = FatalSignalHandler::signal;
|
act.sa_handler = FatalSignalHandler::regularHandler;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
// Remove the handler after it is invoked.
|
// Remove the handler after it is invoked.
|
||||||
@ -1916,9 +1916,9 @@ public:
|
|||||||
|
|
||||||
auto isOurs = [](const struct sigaction &old) {
|
auto isOurs = [](const struct sigaction &old) {
|
||||||
# ifdef SA_SIGINFO
|
# ifdef SA_SIGINFO
|
||||||
return (old.sa_flags & SA_SIGINFO) && old.sa_sigaction == FatalSignalHandler::signal;
|
return (old.sa_flags & SA_SIGINFO) && old.sa_sigaction == FatalSignalHandler::actionHandler;
|
||||||
# else
|
# else
|
||||||
return old.sa_handler == FatalSignalHandler::signal;
|
return old.sa_handler == FatalSignalHandler::regularHandler;
|
||||||
# endif
|
# endif
|
||||||
};
|
};
|
||||||
struct sigaction action;
|
struct sigaction action;
|
||||||
@ -1937,11 +1937,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(FatalSignalHandler)
|
Q_DISABLE_COPY_MOVE(FatalSignalHandler)
|
||||||
|
|
||||||
# ifdef SA_SIGINFO
|
static void actionHandler(int signum, siginfo_t * /* info */, void * /* ucontext */)
|
||||||
static void signal(int signum, siginfo_t * /* info */, void * /* ucontext */)
|
|
||||||
# else
|
|
||||||
static void signal(int signum)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
const int msecsFunctionTime = qRound(QTestLog::msecsFunctionTime());
|
const int msecsFunctionTime = qRound(QTestLog::msecsFunctionTime());
|
||||||
const int msecsTotalTime = qRound(QTestLog::msecsTotalTime());
|
const int msecsTotalTime = qRound(QTestLog::msecsTotalTime());
|
||||||
@ -1968,6 +1964,11 @@ private:
|
|||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[maybe_unused]] static void regularHandler(int signum)
|
||||||
|
{
|
||||||
|
actionHandler(signum, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
sigset_t handledSignals;
|
sigset_t handledSignals;
|
||||||
static bool pauseOnCrash;
|
static bool pauseOnCrash;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user