[llvm] r242936 - Rename RunCallBacksToRun to llvm::sys::RunSignalHandlers

Yaron Keren yaron.keren at gmail.com
Wed Jul 22 14:11:18 PDT 2015


Author: yrnkrn
Date: Wed Jul 22 16:11:17 2015
New Revision: 242936

URL: http://llvm.org/viewvc/llvm-project?rev=242936&view=rev
Log:
Rename RunCallBacksToRun to llvm::sys::RunSignalHandlers

And expose it in Signals.h, allowing clients to call it directly,
possibly LLVMErrorHandler which currently calls RunInterruptHandlers
but not RunSignalHandlers, thus for example not printing the stack
backtrace on Unixish OSes. On Windows it does happen because
RunInterruptHandlers ends up calling the callbacks as well via 
Cleanup(). This difference in behaviour and code structures in
*/Signals.inc should be patched in the future.


Modified:
    llvm/trunk/include/llvm/Support/Signals.h
    llvm/trunk/lib/Support/Signals.cpp
    llvm/trunk/lib/Support/Unix/Signals.inc
    llvm/trunk/lib/Support/Windows/Signals.inc

Modified: llvm/trunk/include/llvm/Support/Signals.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Signals.h?rev=242936&r1=242935&r2=242936&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Signals.h (original)
+++ llvm/trunk/include/llvm/Support/Signals.h Wed Jul 22 16:11:17 2015
@@ -47,6 +47,9 @@ namespace sys {
   /// \brief Print the stack trace using the given \c raw_ostream object.
   void PrintStackTrace(raw_ostream &OS);
 
+  // Run all registered signal handlers.
+  void RunSignalHandlers();
+
   /// AddSignalHandler - Add a function to be called when an abort/kill signal
   /// is delivered to the process.  The handler can have a cookie passed to it
   /// to identify what instance of the handler it is.

Modified: llvm/trunk/lib/Support/Signals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Signals.cpp?rev=242936&r1=242935&r2=242936&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Signals.cpp (original)
+++ llvm/trunk/lib/Support/Signals.cpp Wed Jul 22 16:11:17 2015
@@ -28,7 +28,7 @@ using namespace sys;
 
 static ManagedStatic<std::vector<std::pair<void (*)(void *), void *>>>
     CallBacksToRun;
-void RunCallBacksToRun() {
+void sys::RunSignalHandlers() {
   if (!CallBacksToRun.isConstructed())
     return;
   for (auto &I : *CallBacksToRun)

Modified: llvm/trunk/lib/Support/Unix/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Signals.inc?rev=242936&r1=242935&r2=242936&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Signals.inc (original)
+++ llvm/trunk/lib/Support/Unix/Signals.inc Wed Jul 22 16:11:17 2015
@@ -201,7 +201,7 @@ static RETSIGTYPE SignalHandler(int Sig)
   }
 
   // Otherwise if it is a fault (like SEGV) run any handler.
-  RunCallBacksToRun();
+  llvm::sys::RunSignalHandlers();
 
 #ifdef __s390__
   // On S/390, certain signals are delivered with PSW Address pointing to

Modified: llvm/trunk/lib/Support/Windows/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Signals.inc?rev=242936&r1=242935&r2=242936&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Signals.inc (original)
+++ llvm/trunk/lib/Support/Windows/Signals.inc Wed Jul 22 16:11:17 2015
@@ -457,7 +457,7 @@ static void Cleanup() {
       llvm::sys::fs::remove(FilesToRemove->back());
       FilesToRemove->pop_back();
     }
-  RunCallBacksToRun();
+  llvm::sys::RunSignalHandlers();
   LeaveCriticalSection(&CriticalSection);
 }
 





More information about the llvm-commits mailing list