aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/System
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-04 21:21:36 +0000
committerChris Lattner <sabre@nondot.org>2009-03-04 21:21:36 +0000
commit35033a5876aa27ea5729bc29b41bb4460a303cad (patch)
treed93d7e300969a03a543dd4ae75bdabbc0a7608cf /include/llvm/System
parentfd0339933b907a5118efdac6d7dc78ac92c0a8c8 (diff)
downloadexternal_llvm-35033a5876aa27ea5729bc29b41bb4460a303cad.zip
external_llvm-35033a5876aa27ea5729bc29b41bb4460a303cad.tar.gz
external_llvm-35033a5876aa27ea5729bc29b41bb4460a303cad.tar.bz2
Add a new 'AddSignalHandler' function to Signals.h that allows
arbitrary functions to be run when a crash happens. Delete RemoveDirectoryOnSignal as it is dead and has never had clients. Change PrintStackTraceOnErrorSignal to be implemented in terms of AddSignalHandler. I updated the Win32 versions of these APIs, but can't test them. If there are any problems, I'd be happy to fix them as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66072 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/System')
-rw-r--r--include/llvm/System/Signals.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/include/llvm/System/Signals.h b/include/llvm/System/Signals.h
index 197e4e1..2b9d8ca 100644
--- a/include/llvm/System/Signals.h
+++ b/include/llvm/System/Signals.h
@@ -25,17 +25,16 @@ namespace sys {
/// @brief Remove a file if a fatal signal occurs.
bool RemoveFileOnSignal(const Path &Filename, std::string* ErrMsg = 0);
- /// This function registers a signal handler to ensure that if a fatal signal
- /// gets delivered to the process that the named directory and all its
- /// contents are removed.
- /// @brief Remove a directory if a fatal signal occurs.
- bool RemoveDirectoryOnSignal(const Path& path, std::string* ErrMsg = 0);
-
/// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
/// process, print a stack trace and then exit.
/// @brief Print a stack trace if a fatal signal occurs.
void PrintStackTraceOnErrorSignal();
+ /// 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.
+ void AddSignalHandler(void (*FnPtr)(void *), void *Cookie);
+
/// This function registers a function to be called when the user "interrupts"
/// the program (typically by pressing ctrl-c). When the user interrupts the
/// program, the specified interrupt function is called instead of the program