Crashes with cyclic class dependency graph

Nicolai Haehnle nhaehnle at gmail.com
Sun Feb 14 14:19:13 UTC 2010


On Sun, Feb 14, 2010 at 2:47 PM, David Nolden <zwabel at googlemail.com> wrote:
> Am Sonntag 14 Februar 2010 13:10:45 schrieb Nicolai Haehnle:
>> Hello,
>>
>> I've run into a weird problem with the cppduchain code. Consider the
>> following (obviously incorrect) code:
>>
>> struct B;
>>
>> struct A : B {};
>>
>> struct B : A {};
>>
>> void test() {
>>    B b;
>> }
>>
>> You're pretty much guaranteed to hit a crash after a little bit of
>> editing. The reason for all these different crashes is that many
>> places in the code traverse the dependency graph recursively, and
>> they're bound to run out of stack pretty quickly. Of course the above
>> code is incorrect, but KDevelop should obviously not crash. What is
>> the preferred solution for this, though? Forbid the introduction of
>> cycles into the dependency graph while parsing the code? And how would
>> one achieve that?
>>
>> Incidentally, I ran into this problem on completely valid code, where
>> the parser apparently didn't understand namespaces correctly; but
>> that's I separate issue which I'm going to investigate separately now.
>
> Some of the relevant traversal-functions already have protections against
> endless recursion, and those that don't have it should get it. So post the
> backtrace please so we can see what function is the culprit.

Here's one of them (which I believe is triggered by auto-completion):

<snip>
#13 0x03204abf in TypeUtils::getMemberFunctions (klass=...,
topContext=0x99f1a70, functions=..., functionName=...,
mustBeConstant=false)
    at /home/prefect/dev/kde/sdk/kdevelop/languages/cpp/cppduchain/typeutils.cpp:152
#14 0x03204ffa in TypeUtils::getMemberFunctions (klass=...,
topContext=0x99f1a70, functions=..., functionName=...,
mustBeConstant=false)
    at /home/prefect/dev/kde/sdk/kdevelop/languages/cpp/cppduchain/typeutils.cpp:182
</snip>

Here's another (not sure what exactly triggers it):

<snip>
#4  0x02362457 in KDevelop::DUContext::findContextsInternal
(this=0xb086baf8, contextType=KDevelop::DUContext::Namespace,
baseIdentifiers=...,
    position=..., ret=..., source=0xb0802d48, flags=...) at
/home/prefect/dev/kde/sdk/kdevplatform/language/duchain/ducontext.cpp:1497
#5  0x02362457 in KDevelop::DUContext::findContextsInternal
(this=0xb086fbc0, contextType=KDevelop::DUContext::Namespace,
baseIdentifiers=...,
    position=..., ret=..., source=0xb0802d48, flags=...) at
/home/prefect/dev/kde/sdk/kdevplatform/language/duchain/ducontext.cpp:1497
</snip>

cu,
Nicolai



> Greetings, David
>
> --
> KDevelop-devel mailing list
> KDevelop-devel at kdevelop.org
> https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
>




More information about the KDevelop-devel mailing list