[llvm-commits] [llvm] r109586 - in /llvm/trunk: include/llvm/Support/CrashRecoveryContext.h lib/Support/CrashRecoveryContext.cpp

Chris Lattner clattner at apple.com
Wed Jul 28 09:12:22 PDT 2010


On Jul 28, 2010, at 8:40 AM, Daniel Dunbar wrote:

> Author: ddunbar
> Date: Wed Jul 28 10:40:20 2010
> New Revision: 109586
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=109586&view=rev
> Log:
> 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.

Looks like a nice interface.

> +  /// \return True if the function completed successfully, and false if the
> +  /// function crashed (or HandleCrash was called explicitly). Clients should
> +  /// make as little assumptions as possible about the program state when
> +  /// RunSafely has returned false. Clients can use getBacktrace() to retrieve
> +  /// the backtrace of the crash on failures.
> +  bool RunSafely(void (*Fn)(void*), void *UserData);

It would be nice to add an #ifdef __BLOCKS__ version of this that took a block to execute.

-Chris





More information about the llvm-commits mailing list