diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2013-03-26 01:27:52 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2013-03-26 01:27:52 +0000 |
commit | 4e06def851a32cbe1a7d18562462850cb9ca2a1e (patch) | |
tree | 4e75b9aa7f52a0b25360659790d546171270bf92 /llvm/lib/Support/PrettyStackTrace.cpp | |
parent | 2f59302ce804c0886ccc4dcdd5e51789981d4bc3 (diff) | |
download | llvm-4e06def851a32cbe1a7d18562462850cb9ca2a1e.zip llvm-4e06def851a32cbe1a7d18562462850cb9ca2a1e.tar.gz llvm-4e06def851a32cbe1a7d18562462850cb9ca2a1e.tar.bz2 |
Add a new watchdog timer interface. The interface does not permit handling timeouts, so
it's only really useful if you're going to crash anyways. Use it in the pretty stack trace
printer to kill the compiler if we hang while printing the stack trace.
llvm-svn: 177962
Diffstat (limited to 'llvm/lib/Support/PrettyStackTrace.cpp')
-rw-r--r-- | llvm/lib/Support/PrettyStackTrace.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Support/PrettyStackTrace.cpp b/llvm/lib/Support/PrettyStackTrace.cpp index 21d56ad..23ee5ab 100644 --- a/llvm/lib/Support/PrettyStackTrace.cpp +++ b/llvm/lib/Support/PrettyStackTrace.cpp @@ -17,6 +17,7 @@ #include "llvm/Config/config.h" // Get autoconf configuration settings #include "llvm/Support/Signals.h" #include "llvm/Support/ThreadLocal.h" +#include "llvm/Support/Watchdog.h" #include "llvm/Support/raw_ostream.h" #ifdef HAVE_CRASHREPORTERCLIENT_H @@ -37,7 +38,10 @@ static unsigned PrintStack(const PrettyStackTraceEntry *Entry, raw_ostream &OS){ if (Entry->getNextEntry()) NextID = PrintStack(Entry->getNextEntry(), OS); OS << NextID << ".\t"; - Entry->print(OS); + { + sys::Watchdog W(5); + Entry->print(OS); + } return NextID+1; } |