Commit Graph

23 Commits

Author SHA1 Message Date
Filip Pizlo f2189bf311 This switches CrashRecoveryContext to using ManagedStatic for its global Mutex and
global ThreadLocals, thereby getting rid of the load-time initialization of those 
objects and also getting rid of their destruction unless the LLVM client calls 
llvm_shutdown.

llvm-svn: 190617
2013-09-12 17:46:57 +00:00
Argyrios Kyrtzidis f1d8f52a36 [Support/CrashRecoveryContext] Make sure CrashRecoveryContext does not clear the thread-local "CurrentContext"
in the "parent" thread, when we are using CrashRecoveryContext::RunSafelyOnThread.

When using CrashRecoveryContext::RunSafelyOnThread, we would set a CrashRecoveryContextImpl* to a thread-local variable
for the "child" thread, but CrashRecoveryContext would erroneously clear it in the "parent" thread.

The result was that if CrashRecoveryContext::RunSafelyOnThread was called again in the "child" thread it would mess up
crash-recovery for its parent.

A test for this will be added in the clang repository.
rdar://14204560

llvm-svn: 184380
2013-06-19 22:53:45 +00:00
Chandler Carruth ed0881b2a6 Use the new script to sort the includes of every file under lib.
Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

llvm-svn: 169131
2012-12-03 16:50:05 +00:00
Nuno Lopes e568efbc4d move Signals to .rodata
llvm-svn: 155283
2012-04-21 14:45:37 +00:00
Ahmed Charles 636a3d618c Remove dead code. Improve llvm_unreachable text. Simplify some control flow.
llvm-svn: 150918
2012-02-19 11:37:01 +00:00
NAKAMURA Takumi 1eae12cc9f lib/Support/CrashRecoveryContext.cpp: Add Win32 support to CrashRecoveryContext. Thanks to Aaron Ballman!
llvm-svn: 138199
2011-08-20 06:35:36 +00:00
Ted Kremenek 857e535520 Properly initialize all fields in CrashReporterCleanupContext. This caused the buildbot failure earlier.
llvm-svn: 128071
2011-03-22 04:33:13 +00:00
Ted Kremenek 9931652775 Temporarily stop recovering resources in CrashRecoveryContext while I investigate further why this works on my machine and not on others.
llvm-svn: 128065
2011-03-22 02:06:32 +00:00
Ted Kremenek ab1a242ead Provide a means for CrashRecovery clients to determine if code is currently running while crash recovery cleanups are being processed.
llvm-svn: 128008
2011-03-21 18:38:03 +00:00
Ted Kremenek 32aea2e401 Tweak CrashRecoveryContextCleanup to provide an easy method for clients to select between 'delete' and 'destructor' cleanups, and allow the destructor of CrashRecoveryContextCleanupRegister to be pseudo re-entrant.
llvm-svn: 127929
2011-03-19 00:59:37 +00:00
Ted Kremenek 794a0714ad Tweak CrashRecoveryContext::GetCurrent() to return quickly if 'gCrsahRecoveryEnabled' is false. This avoids us needing to go to thread local storage for
the performance sensitive case where we are compiling code.

llvm-svn: 127928
2011-03-19 00:59:33 +00:00
Ted Kremenek c44d3cf581 Augment CrashRecoveryContext to have registered "cleanup" objects that can be used to release resources during a crash.
llvm-svn: 127849
2011-03-18 02:05:11 +00:00
Michael J. Spencer 447762da85 Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Daniel Dunbar f4d90ba9f5 CrashRecoveryContext: Add RunSafelyOnThread helper function.
llvm-svn: 118272
2010-11-05 07:19:09 +00:00
Daniel Dunbar 418e7046f7 CrashRecoveryContext: Add missing return, so that the signal fires after we our
routine is off the stack. Otherwise we show up rather confusingly in the stack
trace.

llvm-svn: 116755
2010-10-18 21:55:18 +00:00
Daniel Dunbar 09b0c78918 CrashRecovery: Clear the current context on the first crash, to avoid re-entering it if the cleanup code crashes.
llvm-svn: 111309
2010-08-17 22:32:39 +00:00
Daniel Dunbar b30266ed20 CrashRecovery: Add CrashRecoveryContext::GetCurrent(), so clients can find the active context from anywhere.
llvm-svn: 111308
2010-08-17 22:32:37 +00:00
Daniel Dunbar ff329942cd CrashRecovery: Make CrashRecoveryContext static methods thread safe.
llvm-svn: 111307
2010-08-17 22:32:34 +00:00
Daniel Dunbar c90e82a7f1 Fix -Wmissing-field-initializers warnings.
llvm-svn: 109872
2010-07-30 17:49:04 +00:00
Daniel Dunbar 4a338e3dc4 CrashRecovery: Use ThreadLocal::erase() instead of set(0).
llvm-svn: 109752
2010-07-29 15:24:21 +00:00
Daniel Dunbar 9789f81eb4 Make sure to include config.h, to pickup LLVM_ON_WIN32.
llvm-svn: 109721
2010-07-29 01:52:04 +00:00
Daniel Dunbar af77e22b36 CrashRecoveryContext: Add a simple POSIX implementation.
- This works, but won't handle crashes on stack overflow, or signals delivered
   to a thread other than the one that crashed. The latter is particular annoying
   on Darwin, because SIGABRT tends to go to the main thread.

llvm-svn: 109717
2010-07-29 01:21:47 +00:00
Daniel Dunbar 19a3b37441 Support: Add CrashRecoveryContext helper object.
- Designed as a simple wrapper to allow clients to attempt to catch crashes
   (memory errors, assertion violations, etc.) and do some kind of recovery.

 - Currently doesn't actually attempt to catch crashes.

llvm-svn: 109586
2010-07-28 15:40:20 +00:00