Bug 206870 - kdevelop segfaults (dereferences null pointer)
Summary: kdevelop segfaults (dereferences null pointer)
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: HI crash
Target Milestone: 4.0.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 234491 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-09-09 15:25 UTC by pmidden
Modified: 2010-04-16 04:05 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Hopefully minimal testcase for the crash (5.95 KB, text/x-c++src)
2009-09-09 15:26 UTC, pmidden
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pmidden 2009-09-09 15:25:11 UTC
Version:            (using Devel)
Compiler:          gcc (Gentoo 4.4.1) 4.4.1 
OS:                Linux
Installed from:    Compiled sources

Just load the attached cpp file, after a few seconds of scanning, kdevelop crashes. gdb outputs the following backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f10a896f910 (LWP 15273)]
0x00007f10c5b1b814 in KDevelop::AbstractType::d_func (this=0x0) at /var/tmp/paludis/dev-util-kdevplatform-9999/work/kdevplatform-9999/language/duchain/types/abstracttype.h:277
277	/var/tmp/paludis/dev-util-kdevplatform-9999/work/kdevplatform-9999/language/duchain/types/abstracttype.h: No such file or directory.
	in /var/tmp/paludis/dev-util-kdevplatform-9999/work/kdevplatform-9999/language/duchain/types/abstracttype.h
(gdb) bt
#0  0x00007f10c5b1b814 in KDevelop::AbstractType::d_func (this=0x0) at /var/tmp/paludis/dev-util-kdevplatform-9999/work/kdevplatform-9999/language/duchain/types/abstracttype.h:277
#1  0x00007f10c5b1b16a in KDevelop::AbstractType::modifiers (this=0x0) at /var/tmp/paludis/dev-util-kdevplatform-9999/work/kdevplatform-9999/language/duchain/types/abstracttype.cpp:52
#2  0x00007f10a9335a41 in Cpp::TypeConversion::standardConversion (this=0x7f10a896afc0, from={d = 0x0}, to={d = 0x7f10ac19bed0}, categories=31, maxCategories=3)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/typeconversion.cpp:368
#3  0x00007f10a93368d5 in Cpp::TypeConversion::userDefinedConversion (this=0x7f10a896afc0, from={d = 0x7f10ac19bf00}, to={d = 0x7f10ac19bed0}, fromLValue=true, secondConversionIsIdentity=false)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/typeconversion.cpp:534
#4  0x00007f10a9334c51 in Cpp::TypeConversion::implicitConversion (this=0x7f10a896afc0, _from={<KDevelop::ReferenceCountManager> = {<No data fields>}, m_index = 5682312}, _to=
      {<KDevelop::ReferenceCountManager> = {<No data fields>}, m_index = 5682312}, fromLValue=true, noUserDefinedConversion=false)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/typeconversion.cpp:206
#5  0x00007f10a933d8e6 in Cpp::ViableFunction::matchParameters (this=0x7f10a896b090, params=@0x7f10a896cc80, partial=false)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/viablefunctions.cpp:81
#6  0x00007f10a9338f84 in Cpp::OverloadResolver::resolveList (this=0x7f10a896ca70, params=@0x7f10a896cc80, declarations=@0x7f10a896cc70, noUserDefinedConversion=false)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/overloadresolution.cpp:160
#7  0x00007f10a932d269 in Cpp::ExpressionVisitor::visitFunctionCall (this=0x7f10a896cfa0, node=0x4dd9180)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/expressionvisitor.cpp:1707
#8  0x00007f10a8fea1ca in Visitor::visit (this=0x7f10a896cfa0, node=0x4dd9180) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/visitor.cpp:113
#9  0x00007f10a9327e19 in Cpp::ExpressionVisitor::visitSubExpressions (this=0x7f10a896cfa0, node=0x4dd91c0, nodes=0x4dd91a8)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/expressionvisitor.cpp:745
#10 0x00007f10a93280ee in Cpp::ExpressionVisitor::visitPostfixExpression (this=0x7f10a896cfa0, node=0x4dd91c0)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/expressionvisitor.cpp:783
#11 0x00007f10a8fea1ca in Visitor::visit (this=0x7f10a896cfa0, node=0x4dd91c0) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/visitor.cpp:113
#12 0x00007f10a932b164 in Cpp::ExpressionVisitor::visitExpressionStatement (this=0x7f10a896cfa0, node=0x4dd91f8)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/expressionvisitor.cpp:1404
#13 0x00007f10a8fea1ca in Visitor::visit (this=0x7f10a896cfa0, node=0x4dd91f8) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/visitor.cpp:113
#14 0x00007f10a9323ff6 in Cpp::ExpressionVisitor::parse (this=0x7f10a896cfa0, ast=0x4dd91f8) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/expressionvisitor.cpp:232
#15 0x00007f10a92e1831 in UseBuilder::visitExpression (this=0x7f10a896de60, node=0x4dd91f8) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/usebuilder.cpp:159
#16 0x00007f10a92e14fe in UseBuilder::visitExpressionOrDeclarationStatement (this=0x7f10a896de60, exp=0x4dd9220)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/usebuilder.cpp:71
#17 0x00007f10a8fea1ca in Visitor::visit (this=0x7f10a896dec0, node=0x4dd9220) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/visitor.cpp:113
#18 0x00007f10a8fe7c88 in visitNodes<StatementAST*> (v=0x7f10a896dec0, nodes=0x4dd9258) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/visitor.h:128
#19 0x00007f10a8fe6549 in DefaultVisitor::visitCompoundStatement (this=0x7f10a896dec0, node=0x4dd8040) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/default_visitor.cpp:68
#20 0x00007f10a92954bc in ContextBuilder::visitCompoundStatement (this=0x7f10a896de60, node=0x4dd8040)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/contextbuilder.cpp:754
#21 0x00007f10a8fea1ca in Visitor::visit (this=0x7f10a896dec0, node=0x4dd8040) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/visitor.cpp:113
#22 0x00007f10a92950dc in ContextBuilder::visitFunctionDefinition (this=0x7f10a896de60, node=0x4dd9270)
    at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/contextbuilder.cpp:668
#23 0x00007f10a8fea1ca in Visitor::visit (this=0x7f10a896dec0, node=0x4dd9270) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/visitor.cpp:113
#24 0x00007f10a8fe7c15 in visitNodes<DeclarationAST*> (v=0x7f10a896dec0, nodes=0x4dd92d0) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/visitor.h:128
#25 0x00007f10a8fe776d in DefaultVisitor::visitTranslationUnit (this=0x7f10a896dec0, node=0x4dad200) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/default_visitor.cpp:394
#26 0x00007f10a8fea1ca in Visitor::visit (this=0x7f10a896dec0, node=0x4dad200) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/visitor.cpp:113
#27 0x00007f10a9291cd9 in ContextBuilder::startVisiting (this=0x7f10a896de60, node=0x4dad200) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/contextbuilder.cpp:201
#28 0x00007f10a92998ef in KDevelop::AbstractContextBuilder<AST, NameAST>::supportBuild (this=0x7f10a896de60, node=0x4dad200, context=0x4d5c260)
    at /usr/include/kdevplatform/language/duchain/builders/abstractcontextbuilder.h:201
#29 0x00007f10a92e2be9 in KDevelop::AbstractUseBuilder<AST, NameAST, ContextBuilder>::buildUses (this=0x7f10a896de60, node=0x4dad200)
    at /usr/include/kdevplatform/language/duchain/builders/abstractusebuilder.h:70
#30 0x00007f10a92e149b in UseBuilder::buildUses (this=0x7f10a896de60, node=0x4dad200) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/usebuilder.cpp:66
#31 0x00007f10a980406f in CPPInternalParseJob::run (this=0x4789e10) at /var/tmp/paludis/dev-util-kdevelop-9999/work/kdevelop-9999/languages/cpp/cppparsejob.cpp:707
#32 0x00007f10ca3f2d11 in ?? () from /usr/lib64/libthreadweaver.so.4
#33 0x00007f10ca3f300e in ThreadWeaver::Job::execute () from /usr/lib64/libthreadweaver.so.4
#34 0x00007f10ca3f4333 in ?? () from /usr/lib64/libthreadweaver.so.4
#35 0x00007f10ca3f1fdf in ?? () from /usr/lib64/libthreadweaver.so.4
#36 0x00007f10ca3f2468 in ThreadWeaver::Thread::run () from /usr/lib64/libthreadweaver.so.4
#37 0x00007f10c8c632d3 in ?? () from /usr/lib64/qt4/libQtCore.so.4
#38 0x00007f10c89f0624 in start_thread () from /lib/libpthread.so.0
#39 0x00007f10c72c138d in clone () from /lib/libc.so.6
#40 0x0000000000000000 in ?? ()

The program outputs the following:

Starting program: /usr/bin/kdevelop 
[Thread debugging using libthread_db enabled]
WARNING: deleting stale lockfile /home/philipp/.kdevduchain/0/lock
<unknown program name>(15244)/ KDevelop::allocateRepository: picked duchain directory "/home/philipp/.kdevduchain/0"
[New Thread 0x7f10cbf71750 (LWP 15244)]
[New Thread 0x7f10bd614910 (LWP 15248)]
Calling appendChild() on a null node does nothing.
Calling appendChild() on a null node does nothing.
[New Thread 0x7f10ba842910 (LWP 15249)]
QSqlDatabasePrivate::removeDatabase: connection 'GetNamespaceName-23655936-2' is still in use, all queries will cease to work.
[New Thread 0x7f10b9b96910 (LWP 15251)]
[Thread 0x7f10b9b96910 (LWP 15251) exited]
[New Thread 0x7f10b9b96910 (LWP 15252)]
[New Thread 0x7f10b9395910 (LWP 15253)]
QSqlDatabasePrivate::removeDatabase: connection 'GetNamespaceName-23655936-15' is still in use, all queries will cease to work.
[Thread 0x7f10b9b96910 (LWP 15252) exited]
[New Thread 0x7f10b9b96910 (LWP 15254)]
[New Thread 0x7f10b8b94910 (LWP 15255)]
[Thread 0x7f10b9395910 (LWP 15253) exited]
[Thread 0x7f10b9b96910 (LWP 15254) exited]
[Thread 0x7f10b8b94910 (LWP 15255) exited]
[New Thread 0x7f10b8b94910 (LWP 15256)]
[New Thread 0x7f10b9b96910 (LWP 15257)]
[Thread 0x7f10b8b94910 (LWP 15256) exited]
[Thread 0x7f10b9b96910 (LWP 15257) exited]
[New Thread 0x7f10b8b94910 (LWP 15258)]
[New Thread 0x7f10b9b96910 (LWP 15259)]
[Thread 0x7f10b8b94910 (LWP 15258) exited]
[Thread 0x7f10b9b96910 (LWP 15259) exited]
[New Thread 0x7f10b9b96910 (LWP 15260)]
[New Thread 0x7f10b8b94910 (LWP 15261)]
[Thread 0x7f10b9b96910 (LWP 15260) exited]
[New Thread 0x7f10b9b96910 (LWP 15262)]
[Thread 0x7f10b8b94910 (LWP 15261) exited]
[New Thread 0x7f10b9395910 (LWP 15263)]
[Thread 0x7f10b9b96910 (LWP 15262) exited]
[Thread 0x7f10b9395910 (LWP 15263) exited]
[New Thread 0x7f10b9395910 (LWP 15264)]
[New Thread 0x7f10b9b96910 (LWP 15265)]
[Thread 0x7f10b9395910 (LWP 15264) exited]
Calling appendChild() on a null node does nothing.
Calling appendChild() on a null node does nothing.
Calling appendChild() on a null node does nothing.
Calling appendChild() on a null node does nothing.
Calling appendChild() on a null node does nothing.
Calling appendChild() on a null node does nothing.
[Thread 0x7f10b9b96910 (LWP 15265) exited]
QStringList Solid::Backends::Hal::HalManager::findDeviceByDeviceInterface(const Solid::DeviceInterface::Type&)  error:  "org.freedesktop.DBus.Error.Disconnected" 

QStringList Solid::Backends::Hal::HalManager::findDeviceByDeviceInterface(const Solid::DeviceInterface::Type&)  error:  "org.freedesktop.DBus.Error.Disconnected" 

QStringList Solid::Backends::Hal::HalManager::findDeviceByDeviceInterface(const Solid::DeviceInterface::Type&)  error:  "org.freedesktop.DBus.Error.Disconnected" 

QStringList Solid::Backends::Hal::HalManager::findDeviceByDeviceInterface(const Solid::DeviceInterface::Type&)  error:  "org.freedesktop.DBus.Error.Disconnected" 

QStringList Solid::Backends::Hal::HalManager::findDeviceByDeviceInterface(const Solid::DeviceInterface::Type&)  error:  "org.freedesktop.DBus.Error.Disconnected" 

QStringList Solid::Backends::Hal::HalManager::findDeviceByDeviceInterface(const Solid::DeviceInterface::Type&)  error:  "org.freedesktop.DBus.Error.Disconnected" 

QStringList Solid::Backends::Hal::HalManager::findDeviceByDeviceInterface(const Solid::DeviceInterface::Type&)  error:  "org.freedesktop.DBus.Error.Disconnected" 

QStringList Solid::Backends::Hal::HalManager::findDeviceByDeviceInterface(const Solid::DeviceInterface::Type&)  error:  "org.freedesktop.DBus.Error.Disconnected" 

[New Thread 0x7f10b9b96910 (LWP 15266)]
[New Thread 0x7f10b9395910 (LWP 15267)]
QObject: Cannot create children for a parent that is in a different thread.
(Parent is Cpp::CodeCompletionModel(0x3c47a30), parent's thread is QThread(0x168f600), current thread is QThread(0x3c58a10)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is Cpp::MissingIncludeCompletionModel(0x3c89e70), parent's thread is QThread(0x168f600), current thread is QThread(0x3c6a420)
[New Thread 0x7f10b8b94910 (LWP 15270)]
Calling appendChild() on a null node does nothing.
Calling appendChild() on a null node does nothing.
Calling appendChild() on a null node does nothing.
Calling appendChild() on a null node does nothing.
Calling appendChild() on a null node does nothing.
[New Thread 0x7f10a896f910 (LWP 15273)]
[New Thread 0x7f10a816e910 (LWP 15274)]

Program received signal SIGSEGV, Segmentation fault.
Comment 1 pmidden 2009-09-09 15:26:35 UTC
Created attachment 36817 [details]
Hopefully minimal testcase for the crash

You have to have boost installed because boost/shared_ptr.hpp is included.
Comment 2 Andreas Pakulat 2009-09-15 14:43:47 UTC
*** Bug 207452 has been marked as a duplicate of this bug. ***
Comment 3 David Nolden 2009-09-15 22:29:09 UTC
SVN commit 1024021 by zwabel:

Add some null-pointer checks, to prevent a possible crash
BUG: 206870

 M  +7 -1      typeconversion.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1024021
Comment 4 David Nolden 2009-09-15 22:29:32 UTC
Please test whether the patch fixes the problem
Comment 5 pmidden 2009-09-16 10:12:25 UTC
The testcase now finishes the parsing, seems fixed.
Comment 6 Jonathan Thomas 2010-04-16 04:05:42 UTC
*** Bug 234491 has been marked as a duplicate of this bug. ***