[LLVMdev] LLVM asserts

David Greene dag at cray.com
Thu Aug 20 11:13:39 PDT 2009


On Thursday 20 August 2009 11:46, Jim Grosbach wrote:

> These asserts are designed to be disabled entirely in a release build
> of llvm. Why is it so important to you to get user-friendly
> diagnostics for them when they aren't guaranteed to be there at all,
> and you'll likely be getting things like segfaults instead in a
> release build?

We don't disable them in our release build because an abort message is
at least a little more friendly than a fault with no information at all.

> Is your primary goal to be able to present a more consistent and
> friendly face to the user even when your application goes completely
> bonkers, does nasty stuff and needs to shut down? Or are you trying to
> use them as user-level diagnostics and continue on with broader
> processing?

The former.  We certainly don't expect to continue processing.

> If the former, you should probably be catching things like SIGBUS and
> SIGSEGV already. Those errors are equivalent in severity to the sorts
> of things the debug asserts are catching. I'd suggest just adding
> SIGABRT to that list.

We catch all of these things, but what we can't capture is the messages
that go along with the asserts and aborts.  They get dumped out rather
randomly from the perspective of the user since they're output outside of
the signal handling mechanism.  I shouldn't think it would be too hard to
design a more robust failure mechanism that provides some hooks for 3rd
party messaging systems.  Perhaps I'll work on that someday... :)

                               -Dave



More information about the llvm-dev mailing list