Bug 368449

Summary: KDevelop crashed when opening a file that changed on disk [clang::comments::Lexer::lex, clang_Cursor_getParsedComment]
Product: [Applications] kdevelop Reporter: Afief Halumi <afief.h>
Component: Language Support: CPP (Clang-based)Assignee: kdevelop-bugs-null
Status: RESOLVED UPSTREAM    
Severity: crash CC: aaronw, yagorbunov
Priority: NOR    
Version: 5.0.0   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Afief Halumi 2016-09-08 11:22:32 UTC
Program terminated with signal 11, Segmentation fault.
#0  0x00007fafd98cc5a0 in clang::comments::Lexer::lex(clang::comments::Token&) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
(gdb) bt
#0  0x00007fafd98cc5a0 in clang::comments::Lexer::lex(clang::comments::Token&) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#1  0x00007fafd98d2e53 in clang::comments::Parser::parseParagraphOrBlockCommand() () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#2  0x00007fafd98d3c00 in clang::comments::Parser::parseFullComment() () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#3  0x00007fafd983f87d in clang::RawComment::parse(clang::ASTContext const&, clang::Preprocessor const*, clang::Decl const*) const () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#4  0x00007fafd9786923 in clang::ASTContext::getCommentForDecl(clang::Decl const*, clang::Preprocessor const*) const () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#5  0x00007fafd97287ba in clang_Cursor_getParsedComment () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#6  0x00007fafe1588d6d in void (anonymous namespace)::Visitor::setDeclData<(CXCursorKind)21>(CXCursor, KDevelop::Declaration*, bool) const () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKDevClangPrivate.so.25
#7  0x00007fafe15a53cd in void (anonymous namespace)::Visitor::setDeclData<(CXCursorKind)21>(CXCursor, KDevelop::ClassFunctionDeclaration*) const () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKDevClangPrivate.so.25
#8  0x00007fafe15a5e47 in CXChildVisitResult (anonymous namespace)::Visitor::buildDeclaration<(CXCursorKind)21, KDevelop::ClassFunctionDeclaration, true>(CXCursor) ()
   from /home/afiefh/Kdevelop5/appImage/usr/lib/libKDevClangPrivate.so.25
#9  0x00007fafe15b3034 in (anonymous namespace)::visitCursor(CXCursor, CXCursor, void*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKDevClangPrivate.so.25
#10 0x00007fafd971228d in clang::cxcursor::CursorVisitor::Visit(CXCursor, bool) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#11 0x00007fafd971315a in clang::cxcursor::CursorVisitor::VisitDeclContext(clang::DeclContext*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#12 0x00007fafd9711d5b in clang::cxcursor::CursorVisitor::VisitChildren(CXCursor) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#13 0x00007fafd971a0d1 in clang_visitChildren () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#14 0x00007fafe15a1606 in CXChildVisitResult (anonymous namespace)::Visitor::buildDeclaration<(CXCursorKind)4, KDevelop::ClassDeclaration, true>(CXCursor) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKDevClangPrivate.so.25
#15 0x00007fafe15a19e5 in CXChildVisitResult (anonymous namespace)::Visitor::dispatchCursor<(CXCursorKind)4, (Decision)1, (Decision)2, (detail::enabler)0>(CXCursor, CXCursor) ()
   from /home/afiefh/Kdevelop5/appImage/usr/lib/libKDevClangPrivate.so.25
#16 0x00007fafe15b1015 in (anonymous namespace)::visitCursor(CXCursor, CXCursor, void*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKDevClangPrivate.so.25
#17 0x00007fafd971228d in clang::cxcursor::CursorVisitor::Visit(CXCursor, bool) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#18 0x00007fafd971315a in clang::cxcursor::CursorVisitor::VisitDeclContext(clang::DeclContext*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#19 0x00007fafd9711f45 in clang::cxcursor::CursorVisitor::VisitChildren(CXCursor) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#20 0x00007fafd971a0d1 in clang_visitChildren () from /home/afiefh/Kdevelop5/appImage/usr/lib/libclang.so.3.8
#21 0x00007fafe15907b2 in Builder::visit(CXTranslationUnitImpl*, void*, QHash<void*, KDevelop::ReferencedTopDUContext> const&, bool) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKDevClangPrivate.so.25
#22 0x00007fafe15c11dc in ClangHelpers::buildDUChain(void*, QMultiHash<void*, Import> const&, ParseSession const&, KDevelop::TopDUContext::Features, QHash<void*, KDevelop::ReferencedTopDUContext>&, ClangIndex*, std::function<bool ()> const&) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKDevClangPrivate.so.25
#23 0x00007fafe15c0c9d in ClangHelpers::buildDUChain(void*, QMultiHash<void*, Import> const&, ParseSession const&, KDevelop::TopDUContext::Features, QHash<void*, KDevelop::ReferencedTopDUContext>&, ClangIndex*, std::function<bool ()> const&) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKDevClangPrivate.so.25
#24 0x00007fafe15c0c9d in ClangHelpers::buildDUChain(void*, QMultiHash<void*, Import> const&, ParseSession const&, KDevelop::TopDUContext::Features, QHash<void*, KDevelop::ReferencedTopDUContext>&, ClangIndex*, std::function<bool ()> const&) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKDevClangPrivate.so.25
#25 0x00007fafe181ecf2 in ClangParseJob::run(QSharedPointer<ThreadWeaver::JobInterface>, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/qt5/plugins/kdevplatform/25/kdevclangsupport.so
#26 0x00007fb0072a0282 in ThreadWeaver::IdDecorator::run(QSharedPointer<ThreadWeaver::JobInterface>, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#27 0x00007fb0072a0bfe in ThreadWeaver::Executor::run(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#28 0x00007fb00729fe7b in ThreadWeaver::Private::DefaultExecutor::execute(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#29 0x00007fb0072a0dbb in ThreadWeaver::ExecuteWrapper::executeWrapped(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#30 0x00007fb00729fe1f in ThreadWeaver::Private::DebugExecuteWrapper::execute(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#31 0x00007fb0072a0dbb in ThreadWeaver::ExecuteWrapper::executeWrapped(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#32 0x00007fb0072a0d71 in ThreadWeaver::ExecuteWrapper::execute(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#33 0x00007fb0072a0dbb in ThreadWeaver::ExecuteWrapper::executeWrapped(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#34 0x00007fb0072a0d71 in ThreadWeaver::ExecuteWrapper::execute(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#35 0x00007fb00729eab7 in ThreadWeaver::Job::execute(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#36 0x00007fb0072a26ed in ThreadWeaver::Collection::execute(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#37 0x00007fb0072a064b in ThreadWeaver::IdDecorator::execute(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#38 0x00007fb00729e3b1 in ThreadWeaver::Thread::run() () from /home/afiefh/Kdevelop5/appImage/usr/lib/libKF5ThreadWeaver.so.5
#39 0x00007fb0090ac7f6 in ?? () from /home/afiefh/Kdevelop5/appImage/usr/lib/libQt5Core.so.5
#40 0x00007fb00157ee9a in start_thread (arg=0x7fafd33a9700) at pthread_create.c:308
#41 0x00007fb00852436d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#42 0x0000000000000000 in ?? ()

Reproducible: Sometimes

Steps to Reproduce:
1. move through a few different git branches
2.move through different files in editor (all of which changed on disk)


Actual Results:  
crash

Expected Results:  
no crash
Comment 1 Kevin Funk 2016-11-28 15:21:32 UTC
Crash deep inside libclang; no way we can fix this.
Comment 2 Kevin Funk 2017-03-29 10:08:23 UTC
*** Bug 374823 has been marked as a duplicate of this bug. ***
Comment 3 Kevin Funk 2017-08-01 07:16:35 UTC
*** Bug 382981 has been marked as a duplicate of this bug. ***
Comment 4 Kevin Funk 2017-08-01 07:18:14 UTC
Note: This crash is happening inside Clang's comment parser. 

If you can easily reproduce the crashes, you could try removing -Wdocumentation from the compiler flags in:
  Project Settings -> Language Support -> C/C++ Parser -> C++ Profile: Custom

Please tell us if that helps.