Bug 176380

Summary: Kdevelop crashes when importing cmake project
Product: [Applications] kdevelop Reporter: Andries Radu <admiral0>
Component: generalAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: crash CC: aleixpol, alinm.elena, david.nolden.kde, shafff, sputnick
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Andries Radu 2008-11-28 22:18:26 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

Imported Kmess from svn. It crashed with this bt:

Applicazione: KDevelop (kdevelop), segnale SIGSEGV
[Current thread is 0 (LWP 12130)]

Thread 4 (Thread 0xb31dbb90 (LWP 12133)):
#0  0xb7f95424 in __kernel_vsyscall ()
#1  0xb6640352 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/i686/cmov/libpthread.so.0
#2  0xb66a651c in QWaitCondition::wait () from /usr/lib/libQtCore.so.4
#3  0xb617bdc7 in KDevelop::DUChainPrivate::CleanupThread::run () from /opt/kde/lib/libkdevplatformlanguage.so.1
#4  0xb66a552e in ?? () from /usr/lib/libQtCore.so.4
#5  0xb663c4c0 in start_thread () from /lib/i686/cmov/libpthread.so.0
#6  0xb649961e in clone () from /lib/i686/cmov/libc.so.6

Thread 3 (Thread 0xb01e2b90 (LWP 12134)):
#0  0xb5c5154a in clock_gettime () from /lib/i686/cmov/librt.so.1
#1  0xb67c120b in ?? () from /usr/lib/libQtCore.so.4
#2  0x00000001 in ?? ()
#3  0xb01e2128 in ?? ()
#4  0xb6429ac1 in ?? () from /lib/i686/cmov/libc.so.6
#5  0xb667f81d in ?? () from /usr/lib/libQtCore.so.4
#6  0xb6511198 in ?? () from /lib/i686/cmov/libc.so.6
#7  0x00000010 in ?? ()
#8  0x00003d78 in ?? ()
#9  0x3a6ee6c3 in ?? ()
#10 0xb6878778 in ?? () from /usr/lib/libQtCore.so.4
#11 0x096e8fac in ?? ()
#12 0xb01e2158 in ?? ()
#13 0xb67c13e1 in ?? () from /usr/lib/libQtCore.so.4
#14 0x096e8fac in ?? ()
#15 0x096e8fd0 in ?? ()
#16 0xb01e2188 in ?? ()
#17 0xb6640ed5 in pthread_getspecific () from /lib/i686/cmov/libpthread.so.0
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 2 (Thread 0xaf9e1b90 (LWP 12135)):
#0  0xb7f95424 in __kernel_vsyscall ()
#1  0xb64919f1 in select () from /lib/i686/cmov/libc.so.6
#2  0xb6774660 in ?? () from /usr/lib/libQtCore.so.4
#3  0xb66a552e in ?? () from /usr/lib/libQtCore.so.4
#4  0xb663c4c0 in start_thread () from /lib/i686/cmov/libpthread.so.0
#5  0xb649961e in clone () from /lib/i686/cmov/libc.so.6

Thread 1 (Thread 0xb5a526c0 (LWP 12130)):
[KCrash Handler]
#6  0xb6147ea8 in KDevelop::DocumentRangeObject::syncFromSmart () from /opt/kde/lib/libkdevplatformlanguage.so.1
#7  0xb61480a9 in KDevelop::DocumentRangeObject::range () from /opt/kde/lib/libkdevplatformlanguage.so.1
#8  0xb6186e4f in KDevelop::DUContextDynamicData::addDeclaration () from /opt/kde/lib/libkdevplatformlanguage.so.1
#9  0xb61a8448 in KDevelop::Declaration::setContext () from /opt/kde/lib/libkdevplatformlanguage.so.1
#10 0xb61a8c97 in KDevelop::Declaration::Declaration () from /opt/kde/lib/libkdevplatformlanguage.so.1
#11 0xaf0d506c in CMakeProjectVisitor::visit () from /opt/kde/lib/libkdev4cmakecommon.so
#12 0xaf0c3158 in FunctionAst::accept () from /opt/kde/lib/libkdev4cmakecommon.so
#13 0xaf0d66c4 in CMakeProjectVisitor::walk () from /opt/kde/lib/libkdev4cmakecommon.so
#14 0xaf0d8f52 in CMakeProjectVisitor::visit () from /opt/kde/lib/libkdev4cmakecommon.so
#15 0xaf0c2a48 in IncludeAst::accept () from /opt/kde/lib/libkdev4cmakecommon.so
#16 0xaf0d66c4 in CMakeProjectVisitor::walk () from /opt/kde/lib/libkdev4cmakecommon.so
#17 0xaf0da340 in CMakeProjectVisitor::visit () from /opt/kde/lib/libkdev4cmakecommon.so
#18 0xaf0c2a28 in IfAst::accept () from /opt/kde/lib/libkdev4cmakecommon.so
#19 0xaf0d66c4 in CMakeProjectVisitor::walk () from /opt/kde/lib/libkdev4cmakecommon.so
#20 0xaf0f7cfb in CMakeProjectManager::includeScript () from /opt/kde/lib/kde4/kdevcmakemanager.so
#21 0xaf0f8ede in CMakeProjectManager::initializeProject () from /opt/kde/lib/kde4/kdevcmakemanager.so
#22 0xaf0fad97 in CMakeProjectManager::import () from /opt/kde/lib/kde4/kdevcmakemanager.so
#23 0xb7d31b8d in KDevelop::Project::open () from /opt/kde/lib/libkdevplatformshell.so.1
#24 0xb7d2a526 in KDevelop::ProjectController::openProject () from /opt/kde/lib/libkdevplatformshell.so.1
#25 0xb292f78b in ImportProject::accept () from /opt/kde/lib/kde4/kdevappwizard.so
#26 0xb6e1ef56 in QDialog::qt_metacall () from /usr/lib/libQtGui.so.4
#27 0xb29247fb in ImportProject::qt_metacall () from /opt/kde/lib/kde4/kdevappwizard.so
#28 0xb67a9bd0 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#29 0xb67aa952 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#30 0xb6d26367 in QDialogButtonBox::accepted () from /usr/lib/libQtGui.so.4
#31 0xb6d264d8 in ?? () from /usr/lib/libQtGui.so.4
#32 0xb6d285d6 in QDialogButtonBox::qt_metacall () from /usr/lib/libQtGui.so.4
#33 0xb67a9bd0 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#34 0xb67a9fd0 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#35 0xb6f9fb01 in QAbstractButton::clicked () from /usr/lib/libQtGui.so.4
#36 0xb6cf2e09 in ?? () from /usr/lib/libQtGui.so.4
#37 0xb6cf4a04 in ?? () from /usr/lib/libQtGui.so.4
#38 0xb6cf4c96 in QAbstractButton::mouseReleaseEvent () from /usr/lib/libQtGui.so.4
#39 0xb6a0d7c2 in QWidget::event () from /usr/lib/libQtGui.so.4
#40 0xb6cf2cae in QAbstractButton::event () from /usr/lib/libQtGui.so.4
#41 0xb6d99590 in QPushButton::event () from /usr/lib/libQtGui.so.4
#42 0xb69b579c in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#43 0xb69bdfd1 in QApplication::notify () from /usr/lib/libQtGui.so.4
#44 0xb73f951e in KApplication::notify () from /opt/kde/lib/libkdeui.so.5
#45 0xb67950d1 in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#46 0xb69bd25e in QApplicationPrivate::sendMouseEvent () from /usr/lib/libQtGui.so.4
#47 0xb6a26dfd in ?? () from /usr/lib/libQtGui.so.4
#48 0xb6a25be1 in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4
#49 0xb6a4f60a in ?? () from /usr/lib/libQtGui.so.4
#50 0xb5d421b8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#51 0xb5d45853 in ?? () from /usr/lib/libglib-2.0.so.0
#52 0x08fb8a38 in ?? ()
#53 0x00000000 in ?? ()
Comment 1 Dario Andres 2008-12-06 14:32:28 UTC
This backtrace looks similar to the one posted in bug 167283 comment 11
Comment 2 Aleix Pol 2008-12-06 15:27:21 UTC
Could you tell me what is this project from?
I can't reproduce it...
Comment 3 Andries Radu 2008-12-06 15:34:18 UTC
It can be reproduced only when it's compiled as RELEASE. In DEBUGFULL it works.
I have tried several projects. All of them based on cmake.
Comment 4 Manuel Nickschas 2008-12-08 10:40:46 UTC
Yes, looks to be the same issue as bug 167283 indeed. Also only happens in release mode and for most if not all projects I've tried so far.
Comment 5 David Nolden 2008-12-09 18:45:38 UTC
I've done A RelWithDebugInfo build, and there it doesn't crash. I have a single-core machine btw.

Some informations would be useful:
- Did you have a CMakeLists.txt open in the editor? Probably not
- Please add the following debug-output to the beginning of DocumentRangeObject::syncFromSmart:
kDebug() << "dd_ptr:" << dd_ptr;
kDebug() << dd_ptr->m_smartMutex << dd_ptr->m_smartRange;



And then send what was printed right before the crash.
Comment 6 Nick Shaforostoff 2008-12-10 17:17:53 UTC
qWarning() << "dd_ptr11:" << this; 

prints 0
Comment 7 David Nolden 2008-12-10 17:22:33 UTC
Where exactly did you add that line? So "DocumentRangeObject* this" is zero?
Comment 8 Nick Shaforostoff 2008-12-10 17:47:11 UTC
in the beginning of DocumentRangeObject::range
Comment 9 David Nolden 2008-12-10 17:53:37 UTC
Ok then. can you add "Q_ASSERT(this);" at documentrangeobject.cpp:173, "Q_ASSERT(newDeclaration);" at ducontext.cpp:333, "Q_ASSERT(this); this->range();" at declaration.cpp:359, and see what happens?
Comment 10 Nick Shaforostoff 2008-12-10 18:27:02 UTC
the problem is, Q_ASSERTs don't work in release mode.
so i used qwarnings.

look for 'Q_ASSERT(child);' in ducontext.cpp: child is 0
Comment 11 David Nolden 2008-12-10 18:56:08 UTC
Ok, I've just added committed some kFatals() to svn to find the root if this problem. Can you update, re-try, and tell me whether you hit any of them?
Comment 12 Nick Shaforostoff 2008-12-10 19:06:50 UTC
kdevelop(31639)/kdevplatform (language): Could not re-retrieve declaration
Comment 13 David Nolden 2008-12-10 19:25:37 UTC
Ok, can you update once again, and also send the warnings given out before the error?
Comment 14 Nick Shaforostoff 2008-12-10 19:33:42 UTC
(this include warnings added by me - they include nema of function they reside in)

DocumentRangeObject::range 0x82e9b78
Declaration::setContext 0x856c008
DocumentRangeObject::range 0x856c008
kdevelop(1023)/kdevplatform (language): Could not re-retrieve declaration index: 1
KCrash: Application 'kdevelop' crashing...
Comment 15 David Nolden 2008-12-10 19:36:07 UTC
Argh, sorry actually the check was broken. Please update to rev. 895438 and check again.
Comment 16 Nick Shaforostoff 2008-12-10 19:42:43 UTC
wow! it works now! i'm enjoing ctrl-code-browsing now )))

i hope to meet you in Mykolayiv )
Comment 17 David Nolden 2008-12-10 19:49:14 UTC
Ah ok. Yeah I will be there in Ukraine, you too? 

The problem is only workarounded now, by giving a warning instead of crashing. Actually I would expect it to crash at a later point with this problem. You should check the console whether it's full of "child-declaration number _nr_ of _count_ is invalid" during the cmake project parsing.
Comment 18 Nick Shaforostoff 2008-12-10 20:12:02 UTC
yes, it actually crashed a bit later

kdevelop(7194)/kdevplatform (language) KDevelop::DUContextDynamicData::addDeclaration: child declaration number 18 of 19 is invalid 

...and so on till...

kdevelop(7194)/kdevplatform (language) KDevelop::DUContextDynamicData::addDeclaration: child declaration number 0 of 19 is invalid  

so i guess the reason of non-validity should be investigated now


last lines of backtrace:
#5  0xb6170d98 in QVector<KDevelop::TopDUContextDynamicData::ItemDataInfo>::realloc () from /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1
#6  0xb617119f in QVector<KDevelop::TopDUContextDynamicData::ItemDataInfo>::resize () from /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1
#7  0xb616d242 in KDevelop::TopDUContextDynamicData::loadData () from /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1
#8  0xb616efe0 in KDevelop::TopDUContextDynamicData::getDeclarationForIndex () from /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1
#9  0xb6174251 in KDevelop::IndexedDeclaration::declaration () from /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1
#10 0xb6166773 in KDevelop::TopDUContext::DeclarationChecker::operator() () from /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1
#11 0xb6166afc in KDevelop::TopDUContext::FindDeclarationsAcceptor::operator() () from /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1
#12 0xb6168fe1 in KDevelop::TopDUContext::applyAliases<KDevelop::TopDUContext::FindDeclarationsAcceptor> () from /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1
#13 0xb615ffb1 in KDevelop::TopDUContext::findDeclarationsInternal () from /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1
Comment 19 Andreas Pakulat 2008-12-11 10:12:23 UTC
*** Bug 177443 has been marked as a duplicate of this bug. ***