[PATCH] shared dpointer for duchain

Andreas Pakulat apaku at gmx.de
Sun Dec 16 23:28:16 UTC 2007


On 15.12.07 21:55:11, Andreas Pakulat wrote:
> apparently our list doesn't like mails larger than 20K (the first
> version of this had an 18K attachment), so this time with a link instead
> of attached patch.

And another problem: Declaration::setContext(). When doing setContext
before setRange I get a crash from setContext. If doing setContext after
setRange in the leaf classes only then I get an assertion from
ENSURE_CAN_WRITE in setContext.

Now I'm wondering wether it might make sense to simply copy the context
pointer inside the dpointer copy constructor or wether setContext does
additional things which need to be done for the new copy.

Same question about the definition pointer of a declaration. Can that
pointer be just copied from the rhs-dpointer as well?

Andreas

PS: The backtrace from the assert:
[Thread debugging using libthread_db enabled]
[New Thread 0xb60326c0 (LWP 1320)]
[New Thread 0xb158bb90 (LWP 1424)]
[New Thread 0xb1f22b90 (LWP 1418)]
[New Thread 0xb3e4eb90 (LWP 1321)]
[KCrash handler]
#5  0xb64dbea6 in raise () from /lib/libc.so.6
#6  0xb64dd7b1 in abort () from /lib/libc.so.6
#7  0xb7de9f2f in qt_message_output ()
   from /home/andreas/qt-copy/lib/libQtCore.so.4
#8  0xb7de9f93 in qFatal () from /home/andreas/qt-copy/lib/libQtCore.so.4
#9  0xb7dea0ed in qt_assert () from /home/andreas/qt-copy/lib/libQtCore.so.4
#10 0xb6378d2d in KDevelop::Declaration::setContext (this=0x8d5fc30, 
    context=0x8d6e0a0, anonymous=true)
    at /home/andreas/KDE-work/4.0/kdevplatform/language/duchain/declaration.cpp:247
#11 0xb1ffba10 in Cpp::instantiateDeclarationContext (parentContext=0x8d6e0a0, 
    inclusionTrace=@0xb1582c60, context=0x8dae968, 
    _templateArguments=@0x8d5faec, instantiatedDeclaration=0x8d5fc30, 
    instantiatedFrom=0x8daef68)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/templatedeclaration.cpp:324
#12 0xb1ffdc73 in Cpp::TemplateDeclaration::instantiate (this=0x8daef84, 
    templateArguments=@0x8d5faec, inclusionTrace=@0xb1582c60)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/templatedeclaration.cpp:489
#13 0xb1fc0527 in Cpp::FindDeclaration::instantiateDeclaration (
    this=0xb1582c58, decl=0x8daef68, templateArguments=@0x8d5faec)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/cppducontext.h:293
#14 0xb1fc0e9a in Cpp::FindDeclaration::closeIdentifier (this=0xb1582c58)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/cppducontext.h:228
#15 0xb1fc18e2 in Cpp::CppDUContext<KDevelop::DUContext>::findDeclarationsInternal (this=0x8d5f650, identifier=@0x8d8b430, position=@0xb1582e64, 
    dataType=@0xb1582e80, ret=@0xb1582e60, trace=@0xb1582df0, 
    basicFlags=@0xb1582d8c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/cppducontext.h:421
#16 0xb1fc1b55 in Cpp::CppDUContext<KDevelop::DUContext>::findDeclarationsInternal (this=0x8d5f650, identifiers=@0xb1582de4, position=@0xb1582e64, 
    dataType=@0xb1582e80, ret=@0xb1582e60, trace=@0xb1582df0, 
    basicFlags=@0xb1582dec)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/cppducontext.h:352
#17 0xb636b1b0 in KDevelop::DUContext::findDeclarations (this=0x8d5f650, 
    identifier=@0xb1582e74, position=@0xb1582e64, dataType=@0xb1582e80, 
    topContext=0x0, flags=@0xb1582e7c)
    at /home/andreas/KDE-work/4.0/kdevplatform/language/duchain/ducontext.cpp:556
#18 0xb1fd0333 in TypeBuilder::visitBaseSpecifier (this=0xb1583594, 
    node=0x8d4f318)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/typebuilder.cpp:188
#19 0xb1f30fc6 in Visitor::visit (this=0xb1583594, node=0x8d4f318)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/visitor.cpp:109
#20 0xb1f2fc81 in visitNodes<BaseSpecifierAST*> (v=0xb1583594, nodes=0x8d4f4b4)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/visitor.h:125
#21 0xb1f2f6a7 in DefaultVisitor::visitBaseClause (this=0xb1583594, 
    node=0x8d4f4a0)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/default_visitor.cpp:33
#22 0xb1f30fc6 in Visitor::visit (this=0xb1583594, node=0x8d4f4a0)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/visitor.cpp:109
#23 0xb1f2f740 in DefaultVisitor::visitClassSpecifier (this=0xb1583594, 
    node=0x8d4f4c0)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/default_visitor.cpp:62
#24 0xb1fb5c43 in ContextBuilder::visitClassSpecifier (this=0xb1583594, 
    node=0x8d4f4c0)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:407
#25 0xb1fcf44a in TypeBuilder::visitClassSpecifier (this=0xb1583594, 
    node=0x8d4f4c0)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/typebuilder.cpp:154
#26 0xb1fc8548 in DeclarationBuilder::visitClassSpecifier (this=0xb1583594, 
    node=0x8d4f4c0)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/declarationbuilder.cpp:692
#27 0xb1f30fc6 in Visitor::visit (this=0xb1583594, node=0x8d4f4c0)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/visitor.cpp:109
#28 0xb1fce211 in TypeBuilder::visitSimpleDeclaration (this=0xb1583594, 
    node=0x8d4f534)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/typebuilder.cpp:548
#29 0xb1fc781b in DeclarationBuilder::visitSimpleDeclaration (this=0xb1583594, 
    node=0x8d4f534)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/declarationbuilder.cpp:195
#30 0xb1f30fc6 in Visitor::visit (this=0xb1583594, node=0x8d4f534)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/visitor.cpp:109
#31 0xb1fb5e72 in ContextBuilder::visitTemplateDeclaration (this=0xb1583594, 
    ast=0x8d4f55c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:134
#32 0xb1f30fc6 in Visitor::visit (this=0xb1583594, node=0x8d4f55c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/visitor.cpp:109
#33 0xb1f2fd45 in visitNodes<DeclarationAST*> (v=0xb1583594, nodes=0x8dee390)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/visitor.h:125
#34 0xb1f2f6c5 in DefaultVisitor::visitTranslationUnit (this=0xb1583594, 
    node=0x8d4dab8)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/default_visitor.cpp:388
#35 0xb1f30fc6 in Visitor::visit (this=0xb1583594, node=0x8d4dab8)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/visitor.cpp:109
#36 0xb1fb6eec in ContextBuilder::supportBuild (this=0xb1583594, 
    node=0x8d4dab8, context=0x8d6e0a0)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:362
#37 0xb1fb7c82 in ContextBuilder::buildContexts (this=0xb1583594, 
    file=@0xb1583738, node=0x8d4dab8, includes=0xb1583734, 
    updateContext=@0xb158373c, removeOldImports=true)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:278
#38 0xb1fc7f7f in DeclarationBuilder::buildDeclarations (this=0xb1583594, 
    file=@0xb1583738, node=0x8d4dab8, includes=0xb1583734, 
    updateContext=@0xb158373c, removeOldImports=true)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppduchain/declarationbuilder.cpp:95
#39 0xb204f4cc in CPPInternalParseJob::run (this=0x89a9008)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppparsejob.cpp:366
#40 0xb20507e3 in CPPParseJob::parseForeground (this=0xb1583918)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppparsejob.cpp:102
#41 0xb2055a38 in PreprocessJob::sourceNeeded (this=0x8513958, 
    fileName=@0xb1583bfc, type=rpp::Preprocessor::IncludeGlobal, 
    sourceLine=39, skipCurrentPath=false)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/preprocessjob.cpp:354
#42 0xb1f5c0e0 in rpp::pp::handle_include (this=0xb1583f14, 
    skip_current_path=false, input=@0xb1583cd0, output=@0xb1583e0c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:306
#43 0xb1f5c20e in rpp::pp::handle_directive (this=0xb1583f14, 
    directive=@0xb1583d64, input=@0xb1583cd0, output=@0xb1583e0c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:240
#44 0xb1f5c56a in rpp::pp::operator() (this=0xb1583f14, input=@0xb1583e40, 
    output=@0xb1583e0c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:370
#45 0xb1f5cf43 in rpp::pp::processFile (this=0xb1583f14, fileName=@0xb1585068, 
    type=rpp::pp::Data, data=@0xb1584fa0)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:104
#46 0xb2057395 in PreprocessJob::run (this=0x8513958)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/preprocessjob.cpp:206
#47 0xb20507cb in CPPParseJob::parseForeground (this=0xb1585168)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppparsejob.cpp:101
#48 0xb2055a38 in PreprocessJob::sourceNeeded (this=0x8ba3f88, 
    fileName=@0xb158544c, type=rpp::Preprocessor::IncludeGlobal, 
    sourceLine=39, skipCurrentPath=false)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/preprocessjob.cpp:354
#49 0xb1f5c0e0 in rpp::pp::handle_include (this=0xb1585764, 
    skip_current_path=false, input=@0xb1585520, output=@0xb158565c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:306
#50 0xb1f5c20e in rpp::pp::handle_directive (this=0xb1585764, 
    directive=@0xb15855b4, input=@0xb1585520, output=@0xb158565c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:240
#51 0xb1f5c56a in rpp::pp::operator() (this=0xb1585764, input=@0xb1585690, 
    output=@0xb158565c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:370
#52 0xb1f5cf43 in rpp::pp::processFile (this=0xb1585764, fileName=@0xb15868b8, 
    type=rpp::pp::Data, data=@0xb15867f0)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:104
#53 0xb2057395 in PreprocessJob::run (this=0x8ba3f88)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/preprocessjob.cpp:206
#54 0xb20507cb in CPPParseJob::parseForeground (this=0xb15869b8)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppparsejob.cpp:101
#55 0xb2055a38 in PreprocessJob::sourceNeeded (this=0x8c91818, 
    fileName=@0xb1586c9c, type=rpp::Preprocessor::IncludeLocal, sourceLine=0, 
    skipCurrentPath=false)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/preprocessjob.cpp:354
#56 0xb1f5c0e0 in rpp::pp::handle_include (this=0xb1586fb4, 
    skip_current_path=false, input=@0xb1586d70, output=@0xb1586eac)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:306
#57 0xb1f5c20e in rpp::pp::handle_directive (this=0xb1586fb4, 
    directive=@0xb1586e04, input=@0xb1586d70, output=@0xb1586eac)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:240
#58 0xb1f5c56a in rpp::pp::operator() (this=0xb1586fb4, input=@0xb1586ee0, 
    output=@0xb1586eac)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:370
#59 0xb1f5cf43 in rpp::pp::processFile (this=0xb1586fb4, fileName=@0xb1588108, 
    type=rpp::pp::Data, data=@0xb1588040)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:104
#60 0xb2057395 in PreprocessJob::run (this=0x8c91818)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/preprocessjob.cpp:206
#61 0xb20507cb in CPPParseJob::parseForeground (this=0xb1588208)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppparsejob.cpp:101
#62 0xb2055a38 in PreprocessJob::sourceNeeded (this=0x8ca54a8, 
    fileName=@0xb15884ec, type=rpp::Preprocessor::IncludeGlobal, 
    sourceLine=21, skipCurrentPath=false)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/preprocessjob.cpp:354
#63 0xb1f5c0e0 in rpp::pp::handle_include (this=0xb1588804, 
    skip_current_path=false, input=@0xb15885c0, output=@0xb15886fc)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:306
#64 0xb1f5c20e in rpp::pp::handle_directive (this=0xb1588804, 
    directive=@0xb1588654, input=@0xb15885c0, output=@0xb15886fc)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:240
#65 0xb1f5c56a in rpp::pp::operator() (this=0xb1588804, input=@0xb1588730, 
    output=@0xb15886fc)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:370
#66 0xb1f5cf43 in rpp::pp::processFile (this=0xb1588804, fileName=@0xb1589958, 
    type=rpp::pp::Data, data=@0xb1589890)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:104
#67 0xb2057395 in PreprocessJob::run (this=0x8ca54a8)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/preprocessjob.cpp:206
#68 0xb20507cb in CPPParseJob::parseForeground (this=0xb1589a58)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/cppparsejob.cpp:101
#69 0xb2055a38 in PreprocessJob::sourceNeeded (this=0x8aeb378, 
    fileName=@0xb1589d3c, type=rpp::Preprocessor::IncludeLocal, sourceLine=18, 
    skipCurrentPath=false)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/preprocessjob.cpp:354
#70 0xb1f5c0e0 in rpp::pp::handle_include (this=0xb158a054, 
    skip_current_path=false, input=@0xb1589e10, output=@0xb1589f4c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:306
#71 0xb1f5c20e in rpp::pp::handle_directive (this=0xb158a054, 
    directive=@0xb1589ea4, input=@0xb1589e10, output=@0xb1589f4c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:240
#72 0xb1f5c56a in rpp::pp::operator() (this=0xb158a054, input=@0xb1589f80, 
    output=@0xb1589f4c)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:370
#73 0xb1f5cf43 in rpp::pp::processFile (this=0xb158a054, fileName=@0xb158b1a8, 
    type=rpp::pp::Data, data=@0xb158b0e0)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/parser/rpp/pp-engine.cpp:104
#74 0xb2057395 in PreprocessJob::run (this=0x8aeb378)
    at /home/andreas/KDE-work/4.0/kdevelop/languages/cpp/preprocessjob.cpp:206
#75 0xb6a6f908 in ThreadWeaver::JobRunHelper::runTheJob (this=0xb158b2a0, 
    th=0x8602790, job=0x8aeb378)
    at /home/andreas/KDE-work/4.0/kdelibs/threadweaver/Weaver/Job.cpp:106
#76 0xb6a6fb7f in ThreadWeaver::Job::execute (this=0x8aeb378, th=0x8602790)
    at /home/andreas/KDE-work/4.0/kdelibs/threadweaver/Weaver/Job.cpp:135
#77 0xb6a722eb in ThreadWeaver::JobCollectionJobRunner::execute (
    this=0x8b05d40, t=0x8602790)
    at /home/andreas/KDE-work/4.0/kdelibs/threadweaver/Weaver/JobCollection.cpp:82
#78 0xb6a72296 in ThreadWeaver::JobCollection::execute (this=0x8bed678, 
    t=0x8602790)
    at /home/andreas/KDE-work/4.0/kdelibs/threadweaver/Weaver/JobCollection.cpp:225
#79 0xb6a6ed62 in ThreadWeaver::ThreadRunHelper::run (this=0xb158b358, 
    parent=0x81609d8, th=0x8602790)
    at /home/andreas/KDE-work/4.0/kdelibs/threadweaver/Weaver/Thread.cpp:95
#80 0xb6a6eeb8 in ThreadWeaver::Thread::run (this=0x8602790)
    at /home/andreas/KDE-work/4.0/kdelibs/threadweaver/Weaver/Thread.cpp:142
#81 0xb7df2fef in QThreadPrivate::start ()
   from /home/andreas/qt-copy/lib/libQtCore.so.4
#82 0xb7d80383 in start_thread () from /lib/libpthread.so.0
#83 0xb658763e in clone () from /lib/libc.so.6

Thread 1 (Thread 0xb60326c0 (LWP 1320)):
#0  0xb67a5f4e in ?? () from /usr/lib/libX11.so.6
#1  0x08070750 in ?? ()
#2  0x00000001 in ?? ()
#3  0xffffffff in ?? ()
#4  0xb67a16be in ?? () from /usr/lib/libX11.so.6
#5  0x0000000b in ?? ()
#6  0xb684fb24 in ?? () from /usr/lib/libX11.so.6
#7  0x08076db8 in ?? ()
#8  0x00000f16 in ?? ()
#9  0x00000020 in ?? ()
#10 0x00000000 in ?? ()
#0  0xb67a5f4e in ?? () from /usr/lib/libX11.so.6


-- 
If you sow your wild oats, hope for a crop failure.




More information about the KDevelop-devel mailing list