Bug 330755 - infinite looping in processDependencies()
Summary: infinite looping in processDependencies()
Status: RESOLVED DUPLICATE of bug 330697
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: CMake (show other bugs)
Version: git master
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-04 15:13 UTC by Vasiliy Yeremeyev
Modified: 2014-02-04 15:46 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vasiliy Yeremeyev 2014-02-04 15:13:59 UTC
kdevelop enters infinite loop while parsing my cmake project. Problem may be triggered by some circular dependency in link libraries.

Reproducible: Always

Steps to Reproduce:
Import new project from following CMakeLists.txt:

add_library(a a.cpp)
target_link_libraries(a b)
add_library(b b.cpp)
target_link_libraries(b a)
add_executable(abc main.cpp)
target_link_libraries(abc a b)
Actual Results:  
kdevelop crashes (stack overrun)

Expected Results:  
kdevelop opens project. some targets may be marked as invalid/suspicious/etc.

Program received signal SIGSEGV, Segmentation fault.
#0  QMap<PropertyType, QHash<QString, QMap<QString, QStringList> > >::concrete (node=0x7ffee939d990) at qt4/QtCore/qmap.h:178
    (invalid node pointer -- stack corruption)
    return reinterpret_cast<Node *>(reinterpret_cast<char *>(node) - payload());
#1  0x00007fff60a33b24 in QMap<PropertyType, QHash<QString, QMap<QString, QStringList> > >::findNode (this=0x3c57420, akey=@0x7ffef38000fc: TargetProperty) at qt4/QtCore/qmap.h:487
    while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey))
#2  0x00007fff60a32e8b in QMap<PropertyType, QHash<QString, QMap<QString, QStringList> > >::value (this=0x3c57420, akey=@0x7ffef38000fc: TargetProperty) at qt4/QtCore/qmap.h:502
    const QMap<QString, QStringList>& depData = data.properties.value(TargetProperty).value(dep);
#3  0x00007fff60a2f377 in processDependencies (target=..., dep=..., data=...) at projectmanagers/cmake/cmakecommitchangesjob.cpp:129
#4  0x00007fff60a2f6c8 in processDependencies (target=..., dep=..., data=...) at projectmanagers/cmake/cmakecommitchangesjob.cpp:138
#5  0x00007fff60a2f6c8 in processDependencies (target=..., dep=..., data=...) at projectmanagers/cmake/cmakecommitchangesjob.cpp:138
...
#23811 0x00007fff60a2f6c8 in processDependencies (target=..., dep=..., data=...) at projectmanagers/cmake/cmakecommitchangesjob.cpp:138
#23812 0x00007fff60a30460 in CMakeCommitChangesJob::addProjectData (this=0x7ffee938a970, data=...) at projectmanagers/cmake/cmakecommitchangesjob.cpp:188
#23813 0x00007fff60a37271 in CMakeImportJob::importDirectory (this=0x3c573c0, project=0x43d5240, path=..., parentTop=...) at projectmanagers/cmake/cmakeimportjob.cpp:222
#23814 0x00007fff60a372f1 in CMakeImportJob::importDirectory (this=0x3c573c0, project=0x43d5240, path=..., parentTop=...) at projectmanagers/cmake/cmakeimportjob.cpp:227
#23815 0x00007fff60a372f1 in CMakeImportJob::importDirectory (this=0x3c573c0, project=0x43d5240, path=..., parentTop=...) at projectmanagers/cmake/cmakeimportjob.cpp:227
#23816 0x00007fff60a372f1 in CMakeImportJob::importDirectory (this=0x3c573c0, project=0x43d5240, path=..., parentTop=...) at projectmanagers/cmake/cmakeimportjob.cpp:227
#23817 0x00007fff60a372f1 in CMakeImportJob::importDirectory (this=0x3c573c0, project=0x43d5240, path=..., parentTop=...) at projectmanagers/cmake/cmakeimportjob.cpp:227
#23818 0x00007fff60a372f1 in CMakeImportJob::importDirectory (this=0x3c573c0, project=0x43d5240, path=..., parentTop=...) at projectmanagers/cmake/cmakeimportjob.cpp:227
#23819 0x00007fff60a360ad in CMakeImportJob::initialize (this=0x3c573c0) at projectmanagers/cmake/cmakeimportjob.cpp:121
#23820 0x00007fff60a39e74 in QtConcurrent::VoidStoredMemberFunctionPointerCall0<void, CMakeImportJob>::runFunctor (this=0x3c3f460) at qt4/QtCore/qtconcurrentstoredfunctioncall.h:209
#23821 0x00007fff60a37b03 in QtConcurrent::RunFunctionTask<void>::run (this=0x3c3f460) at qt4/QtCore/qtconcurrentrunbase.h:134
#23822 0x00007ffff4cd4f8c in QThreadPoolThread::run (this=0x44035e0) at concurrent/qthreadpool.cpp:107
#23823 0x00007ffff4ce177f in QThreadPrivate::start (arg=0x44035e0) at thread/qthread_unix.cpp:338
#23824 0x00007ffff4397d63 in start_thread () from /lib64/libpthread.so.0
#23825 0x00007ffff46972ed in clone () from /lib64/libc.so.6

127 void processDependencies(ProcessedTarget &target, const QString& dep, const CMakeProjectData& data)
128 {
129     const QMap<QString, QStringList>& depData = data.properties.value(TargetProperty).value(dep);
130     if(depData.isEmpty()) {
131         kDebug() << "error: couldn't find dependency " << dep << data.properties.value(TargetProperty).keys();
132         return;
133     }
134
135     target.includes += depData["INTERFACE_INCLUDE_DIRECTORIES"];
136     target.defines += depData["INTERFACE_COMPILE_DEFINITIONS"];
137     foreach(const QString& d, depData["INTERFACE_LINK_LIBRARIES"])
138         processDependencies(target, d, data);
139 }
Comment 1 Milian Wolff 2014-02-04 15:46:20 UTC

*** This bug has been marked as a duplicate of bug 330697 ***