Bug 319379

Summary: SIGSEGV in getFilteredDeclarations() while scanning files in cmake project
Product: [Applications] kdevelop Reporter: Mark <mpictor>
Component: Build tools: CMakeAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: crash CC: aleixpol, flo.ruijt
Priority: NOR    
Version: git master   
Target Milestone: 4.3.0   
Platform: Compiled Sources   
OS: Linux   
URL: git://github.com/stepcode/stepcode.git
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Mark 2013-05-05 21:10:17 UTC
I build from master an hour ago.
kdevelop rev 45cdc3badce74 (self-identifies as Version 4.5.60)
kdevplatform rev d7865f95d5217 (self-identifies as KDE Development Platform 4.10.2)
Qt version 4.8.4 (gentoo dev-qt/qtcore-4.8.4-r4)
gcc (Gentoo 4.7.2-r1 p1.6, pie-0.5.5) 4.7.2


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff3a785700 (LWP 12697)]
0x00007ffff1db0dc4 in KDevelop::PersistentSymbolTable::getFilteredDeclarations(KDevelop::IndexedQualifiedIdentifier const&, Utils::StorableSet<KDevelop::IndexedTopDUContext, KDevelop::IndexedTopDUContextIndexConversion, KDevelop::RecursiveImportRepository, true, Utils::DummyLocker> const&) const () from /usr/lib64/libkdevplatformlanguage.so.7
(gdb) bt
#0  0x00007ffff1db0dc4 in KDevelop::PersistentSymbolTable::getFilteredDeclarations(KDevelop::IndexedQualifiedIdentifier const&, Utils::StorableSet<KDevelop::IndexedTopDUContext, KDevelop::IndexedTopDUContextIndexConversion, KDevelop::RecursiveImportRepository, true, Utils::DummyLocker> const&) const () from /usr/lib64/libkdevplatformlanguage.so.7
#1  0x00007ffff1d3db2b in KDevelop::TopDUContext::FindDeclarationsAcceptor::operator()(KDevelop::QualifiedIdentifier const&) () from /usr/lib64/libkdevplatformlanguage.so.7
#2  0x00007ffff1d4173d in bool KDevelop::TopDUContext::applyAliases<KDevelop::TopDUContext::FindDeclarationsAcceptor>(KDevelop::QualifiedIdentifier const&, KSharedPtr<KDevelop::DUContext::SearchItem> const&, KDevelop::TopDUContext::FindDeclarationsAcceptor&, KDevelop::CursorInRevision const&, bool, KDevelop::TopDUContext::ApplyAliasesBuddyInfo*, unsigned int) const ()
   from /usr/lib64/libkdevplatformlanguage.so.7
#3  0x00007ffff1d4208e in void KDevelop::TopDUContext::applyAliases<KDevelop::TopDUContext::FindDeclarationsAcceptor>(KDevVarLengthArray<KSharedPtr<KDevelop::DUContext::SearchItem>, 256> const&, KDevelop::TopDUContext::FindDeclarationsAcceptor&, KDevelop::CursorInRevision const&, bool) const () from /usr/lib64/libkdevplatformlanguage.so.7
#4  0x00007ffff1d3a44c in KDevelop::TopDUContext::findDeclarationsInternal(KDevVarLengthArray<KSharedPtr<KDevelop::DUContext::SearchItem>, 256> const&, KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> const&, KDevVarLengthArray<KDevelop::Declaration*, 40>&, KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>, unsigned int) const ()
   from /usr/lib64/libkdevplatformlanguage.so.7
#5  0x00007ffff1d2670c in KDevelop::DUContext::findDeclarations(KDevelop::Identifier const&, KDevelop::CursorInRevision const&, KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) const ()
   from /usr/lib64/libkdevplatformlanguage.so.7
#6  0x00007fff4f170495 in CMakeProjectVisitor::createUses(CMakeFunctionDesc const&) ()
   from /usr/lib64/libkdev4cmakecommon.so
#7  0x00007fff4f1731bd in CMakeProjectVisitor::walk(QList<CMakeFunctionDesc> const&, int, bool) [clone .part.168] ()
   from /usr/lib64/libkdev4cmakecommon.so
#8  0x00007fff4f173d52 in CMakeProjectVisitor::visit(WhileAst const*) () from /usr/lib64/libkdev4cmakecommon.so
#9  0x00007fff4f173072 in CMakeProjectVisitor::walk(QList<CMakeFunctionDesc> const&, int, bool) [clone .part.168] ()
   from /usr/lib64/libkdev4cmakecommon.so
#10 0x00007fff4f173d98 in CMakeProjectVisitor::visit(WhileAst const*) () from /usr/lib64/libkdev4cmakecommon.so
#11 0x00007fff4f173072 in CMakeProjectVisitor::walk(QList<CMakeFunctionDesc> const&, int, bool) [clone .part.168] ()
   from /usr/lib64/libkdev4cmakecommon.so


Reproducible: Always

Steps to Reproduce:
1. check out git://github.com/stepcode/stepcode.git
2. import project, selecting the main CMakeLists.txt
Actual Results:  
kdevelop crashes after the progress indicator has moved back and forth a couple times

Expected Results:  
should not crash
Comment 1 flo.ruijt 2013-05-06 01:31:57 UTC
I can confirm that this repository crashes kdevelop. Interestingly even DrKonqi isn't shown.
My current version of kdevelop is 7a047f7d553e and kdevplatform ba87ffa6943fad2a
Comment 2 Mark 2013-05-06 21:45:30 UTC
I mentioned on #kdevelop that I wasn't sure whether the problem was with CMake or not. However, I have located a commit that seems to be the problem, and it only changes one file, a CMakeLists.txt: https://github.com/stepcode/stepcode/commit/1ce677914e93

Commits before that do not cause a crash. KDevelop crashes on that commit and anything later.
Comment 3 Aleix Pol 2013-05-08 13:18:46 UTC
Git commit 8eb885b8e6874cee800aff98063956160c8b2490 by Aleix Pol.
Committed on 08/05/2013 at 15:18.
Pushed by apol into branch '4.5'.

New implementation for get_filename_component(PATH)

We were not doing the exact same thing as cmake, in case it was a false
relative directory. It lead to problems with weird uses of get_filename_components

M  +5    -3    projectmanagers/cmake/parser/cmakeprojectvisitor.cpp
M  +6    -1    projectmanagers/cmake/tests/cmake_cmakeprojectvisitor_test.cpp

http://commits.kde.org/kdevelop/8eb885b8e6874cee800aff98063956160c8b2490