[llvm-dev] LLVM libraries and custom assertions.

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 15 16:27:25 PDT 2016


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


More information about the llvm-dev mailing list