[llvm-dev] LLVM libraries and custom assertions.

Matthias Braun via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 15 16:51:41 PDT 2016


Catching the error and using your own handler should be no problem. There is stuff like install_fatal_error_handler() and the CrashRecoveryContext.

However llvm today isn't really designed/tested for recovery after an error, so your milage may vary.

- Matthias

> On Aug 15, 2016, at 4:27 PM, Sanjoy Das via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> You can consider catching SIGABRT, or maybe LD_PRELOAD'ing an
> implementation for abort (not sure if the latter is possible, but
> should be easy to try out).  I don't know how to do better than that
> without recompiling LLVM.
> 
> Another option is to let LLVM's client register an "error handler"
> that gets called instead of abort() on a failed assert, but you'll
> have to change and rebuild LLVM to do this (and have a non-standard
> assert definition).  This can be a little cleaner, depending on what
> you're trying to do.  I don't have a good sense of what others think
> of this, but I'll be for upstreaming a mechanism of this sort to LLVM.
> 
> -- Sanjoy
> 
> On Mon, Aug 15, 2016 at 4:19 PM, Paul Hancock via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>> Is there a simple method for compiling a custom assertion header/call into
>> all the LLVM libraries? I want my application to be able to handle any
>> thrown assertions (ie; as an exception) and recover or crash gracefully. I
>> already have a custom header in place in the application's source, however
>> this doesn't have an effect on [most of] the already compiled lib's.
>> 
>> 
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>> 
> 
> 
> 
> -- 
> Sanjoy Das
> http://playingwithpointers.com
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list