Asserts in Clang crashes my Kdevelop

Hi,

Newbie here.
I’m trying to understand a few issues in kdevelop clang plugin, and for that I would like to use clang in debug mode.
But when I compile 3.5.1 for Debug, asserts come too, and this give a crash in kdevelop:

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffd73ea700 (LWP 7083)]
0x00007fffef77ba97 in raise () from /usr/lib/libc.so.6
#0 0x00007fffef77ba97 in raise () from /usr/lib/libc.so.6
#1 0x00007fffef77ce6a in abort () from /usr/lib/libc.so.6
#2 0x00007fffef7748bd in __assert_fail_base () from /usr/lib/libc.so.6
#3 0x00007fffef774972 in __assert_fail () from /usr/lib/libc.so.6
#4 0x00007fffaab15bd7 in clang::comments::Lexer::lexVerbatimBlockFirstLine (this=0x7fffd73e85f0, T=…) at /home/tanure/workspace/llvm/tools/clang/lib/AST/CommentLexer.cpp:468
#5 0x00007fffaab15e56 in clang::comments::Lexer::lexVerbatimBlockBody (this=0x7fffd73e85f0, T=…) at /home/tanure/workspace/llvm/tools/clang/lib/AST/CommentLexer.cpp:517
#6 0x00007fffaab1521c in clang::comments::Lexer::lexCommentText (this=0x7fffd73e85f0, T=…) at /home/tanure/workspace/llvm/tools/clang/lib/AST/CommentLexer.cpp:295
#7 0x00007fffaab16cc8 in clang::comments::Lexer::lex (this=0x7fffd73e85f0, T=…) at /home/tanure/workspace/llvm/tools/clang/lib/AST/CommentLexer.cpp:802

I just want to compile clang in debug mode without asserts.

How I compile:

svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_351/Final/ llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_351/final/ clang
cd llvm/tools/clang/tools
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_351/final/ extra
cd llvm/projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_351/final/ compiler-rt

and in other folder , like clang_build
cd clang_build
cmake -DCMAKE_INSTALL_PREFIX=/opt/llvm -DCMAKE_BUILD_TYPE=Debug -DPYTHON_EXECUTABLE=/usr/bin/python2.7 llvm (path to llvm)

make
make install

So, there is any way to compile in debug without asserts ?

Thanks

Hi,

Newbie here.
I'm trying to understand a few issues in kdevelop clang plugin, and for
that I would like to use clang in debug mode.
But when I compile 3.5.1 for Debug, asserts come too, and this give a
crash in kdevelop:

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffd73ea700 (LWP 7083)]
0x00007fffef77ba97 in raise () from /usr/lib/libc.so.6
#0 0x00007fffef77ba97 in raise () from /usr/lib/libc.so.6
#1 0x00007fffef77ce6a in abort () from /usr/lib/libc.so.6
#2 0x00007fffef7748bd in *__assert_fail_base* () from /usr/lib/libc.so.6
#3 0x00007fffef774972 in *__assert_fail* () from /usr/lib/libc.so.6
#4 0x00007fffaab15bd7 in
clang::comments::Lexer::lexVerbatimBlockFirstLine (this=0x7fffd73e85f0,
T=...) at
/home/tanure/workspace/llvm/tools/clang/lib/AST/CommentLexer.cpp:468
#5 0x00007fffaab15e56 in clang::comments::Lexer::lexVerbatimBlockBody
(this=0x7fffd73e85f0, T=...) at
/home/tanure/workspace/llvm/tools/clang/lib/AST/CommentLexer.cpp:517
#6 0x00007fffaab1521c in clang::comments::Lexer::lexCommentText
(this=0x7fffd73e85f0, T=...) at
/home/tanure/workspace/llvm/tools/clang/lib/AST/CommentLexer.cpp:295
#7 0x00007fffaab16cc8 in clang::comments::Lexer::lex
(this=0x7fffd73e85f0, T=...) at
/home/tanure/workspace/llvm/tools/clang/lib/AST/CommentLexer.cpp:802

I just want to compile clang in debug mode without asserts.

How I compile:

svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_351/Final/
*llvm*
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_351/final/
*clang*
cd llvm/tools/clang/tools
svn co
http://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_351/final/
*extra*
cd llvm/projects
svn co
http://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_351/final/
*compiler-rt*

and in other folder , like clang_build
cd clang_build
cmake -DCMAKE_INSTALL_PREFIX=/opt/llvm -DCMAKE_BUILD_TYPE=Debug
-DPYTHON_EXECUTABLE=/usr/bin/python2.7 llvm (path to llvm)
make
make install

So, there is any way to compile in debug without asserts ?

Yes. Add -DLLVM_ENABLE_ASSERTIONS=OFF to your cmake invocation.

Although turning off assertions probably won't make it easier to debug. Generally hitting an assertion means that you've hit a code path with input that LLVM / Clang is not able to handle. If you proceed then you're likely to see a crash or weird behaviour somewhere else (often much later) that is caused by something near the assertion site.

David