Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Changed Author and removed type cast and includes handling kSigFloati…
…ngException
  • Loading branch information
zzxuanyuan authored and pcanal committed Sep 25, 2017
commit ea4472d94533a1aaee3eb84b7c46febe22f7953c
1 change: 1 addition & 0 deletions core/base/inc/TSigHandling.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class TSigHandling : public TNamed {

//---- Handling of system signals
virtual Bool_t HaveTrappedSignal(Bool_t pendingOnly);
virtual void DispatchSignals(ESignals sig);
virtual void AddSignalHandler(TSignalHandler *sh);
virtual TSignalHandler *RemoveSignalHandler(TSignalHandler *sh);
virtual void ResetSignal(ESignals sig, Bool_t reset = kTRUE);
Expand Down
9 changes: 9 additions & 0 deletions core/base/src/TSigHandling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ Bool_t TSigHandling::HaveTrappedSignal(Bool_t)
return kFALSE;
}

////////////////////////////////////////////////////////////////////////////////
/// Dispatch signals.

void TSigHandling::DispatchSignals(ESignals /*sig*/)
{
AbstractMethod("DispatchSignals");
}


////////////////////////////////////////////////////////////////////////////////
/// Add a signal handler to list of system signal handlers. Only adds
/// the handler if it is not already in the list of signal handlers.
Expand Down
3 changes: 1 addition & 2 deletions core/base/src/TSystem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ void TSystem::AddSignalHandler(TSignalHandler *h)

TSignalHandler *TSystem::RemoveSignalHandler(TSignalHandler *h)
{
return (TSignalHandler *)gSigHandling->RemoveSignalHandler(h);
return gSigHandling->RemoveSignalHandler(h);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -741,7 +741,6 @@ void TSystem::StackTrace()
AbstractMethod("StackTrace");
}


//---- Directories -------------------------------------------------------------

////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion core/unix/inc/TUnixSigHandling.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @(#)root/unix:$Id$
// Author: Fons Rademakers 15/09/95
// Author: Zhe Zhang 10/03/16

/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
Expand Down
31 changes: 16 additions & 15 deletions core/unix/src/TUnixSigHandling.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @(#)root/unix:$Id: 887c618d89c4ed436e4034fc133f468fecad651b $
// Author: Fons Rademakers 15/09/95
// Author: Zhe Zhang 10/03/16

/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
Expand Down Expand Up @@ -133,7 +133,7 @@ static void SetRootSys()
static void SigHandler(ESignals sig)
{
if (gSigHandling)
((TUnixSigHandling*)gSigHandling)->DispatchSignals(sig);
gSigHandling->DispatchSignals(sig);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -515,10 +515,10 @@ void TUnixSigHandling::DispatchSignals(ESignals sig)
{
switch (sig) {
case kSigAlarm:
// DispatchTimers(kFALSE);
// gSystem->DispatchTimers(kFALSE);
break;
case kSigChild:
// CheckChilds();
// gSystem->CheckChilds();
break;
case kSigBus:
SignalSafeErrWrite("\n\nA fatal system signal has occurred: bus error");
Expand All @@ -530,19 +530,13 @@ void TUnixSigHandling::DispatchSignals(ESignals sig)
SignalSafeErrWrite("\n\nA fatal system signal has occurred: illegal instruction error");
break;
case kSigFloatingException:
Break("TUnixSigHandling::DispatchSignals", "%s", UnixSigname(sig));
StackTrace();
if (gApplication)
//sig is ESignal, should it be mapped to the correct signal number?
gApplication->HandleException(sig);
else
//map to the real signal code + set the
//high order bit to indicate a signal (?)
gSystem->Exit(gSignalMap[sig].fCode + 0x80);
SignalSafeErrWrite("\n\nA fatal system signal has occurred: floating exception error");
break;
case kSigSystem:
SignalSafeErrWrite("\n\nA fatal system signal has occurred: system error");
break;
case kSigPipe:
Break("TUnixSigHandling::DispatchSignals", "%s", UnixSigname(sig));
SignalSafeErrWrite("\n\nA fatal system signal has occurred: pipe error");
break;
case kSigWindowChanged:
Gl_windowchanged();
Expand All @@ -553,11 +547,18 @@ void TUnixSigHandling::DispatchSignals(ESignals sig)
break;
}

if ((sig == kSigIllegalInstruction) || (sig == kSigSegmentationViolation) || (sig == kSigBus))
if ((sig == kSigIllegalInstruction) || (sig == kSigSegmentationViolation) || (sig == kSigBus) || (sig == kSigFloatingException))
{
StackTraceTriggerThread();
signal(sig, SIG_DFL);
raise(sig);
if (gApplication)
//sig is ESignal, should it be mapped to the correct signal number?
gApplication->HandleException(sig);
else
//map to the real signal code + set the
//high order bit to indicate a signal (?)
gSystem->Exit(gSignalMap[sig].fCode + 0x80, 0);
}

// check a-synchronous signals
Expand Down