[LLVMdev] Proposal for better assertions in LLVM

Talin viridia at gmail.com
Tue Jul 26 16:49:30 PDT 2011


By the way, abort() trips the debugger as well - at least, it does in gdb.

On Tue, Jul 26, 2011 at 12:12 PM, FlyLanguage <flylanguage at gmail.com> wrote:

> Den 26.07.2011 20:12, skrev Talin:
>
>> On Tue, Jul 26, 2011 at 10:56 AM, FlyLanguage <flylanguage at gmail.com
>> <mailto:flylanguage at gmail.com>**> wrote:
>>
>>           #define ASSERT_STRM(cond, args) \
>>             if (!(cond)) AssertionFailureStream(__FILE_**___, __LINE__)
>>        << args
>>
>>        Note that there's no trailing semicolon, as this is supplied at the
>>        point where the macro is invoked.
>>
>>        What do you think?
>>
>>
>>    Neat, but inducing a debug trap is even more useful on asserts
>>    (optionally).
>>
>>
>> What's the best way to do that? I'd like to incorporate it into my
>> frontend's diagnostics.
>>
>
> Depends on platform. asm {int 3} on x86, asm {trap} on ppc,  DebugBreak on
> windows, etc.
>
>


-- 
-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110726/4ca2b9c2/attachment.html>


More information about the llvm-dev mailing list