Bug 308789

Summary: crash on simple CMakeLists.txt
Product: [Applications] kdevelop Reporter: Andreas Roth <aroth>
Component: generalAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: 4.3.0   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Andreas Roth 2012-10-22 05:52:46 UTC
Application: kdevelop (4.3.90)
KDE Platform Version: 4.9.2
Qt Version: 4.8.3
Operating System: Linux 3.5.0-17-generic x86_64
Distribution: Ubuntu 12.10

-- Information about the crash:
- What I was doing when the application crashed:
i tried to import a CMake project with the following CMakeLists.txt file:
IF(NOT PROJECT_PRODUCT)
    SET(PROJECT_PRODUCT ${MY_DEFAULT_PRODUCT})
ENDIF(NOT PROJECT_PRODUCT)
STRING(TOLOWER ${PROJECT_PRODUCT} PROJECT_PRODUCT_DIR)

The last lines from the kdevelop debug output (cmake support & cmake support debug enabled) are:
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::findExecutable: finding executable, using suffixes ("")
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::findFile: Trying: "/home/aroth/bin/" . "objcopy"
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::findFile: Trying: "/sbin/" . "objcopy"
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::findFile: Trying: "/usr/sbin/" . "objcopy"
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::findFile: Trying: "/usr/local/sbin/" . "objcopy"
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::findFile: Trying: "/usr/local/bin/" . "objcopy"
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::findFile: Trying: "/usr/sbin/" . "objcopy"
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::findFile: Trying: "/usr/bin/" . "objcopy"
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::visit: FindProgram: "CMAKE_OBJCOPY" = ("/usr/bin/objcopy") ("/home/aroth/bin", "/sbin", "/usr/sbin", "/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/usr/games", "/usr/local/games")
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::visit: Mark As Advanced ("CMAKE_AR", "CMAKE_RANLIB", "CMAKE_STRIP", "CMAKE_LINKER", "CMAKE_NM", "CMAKE_OBJDUMP", "CMAKE_OBJCOPY")
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::visit: >>  "if" ("APPLE") false
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::walk: Walk stopped @ 23
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::visit: include of "CMakeFindBinUtils" done.
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::visit: >>  "if" ("MSVC_CXX_ARCHITECTURE_ID") false
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::visit: error! function not implemented "configure_file"
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::visit: setting variable: "CMAKE_CXX_COMPILER_ENV_VAR" false
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::walk: Walk stopped @ 84
kdevelop(857)/kdevelop (cmake support debug) CMakeManager::parse: Adding cmake:  KUrl("file:///local/work/fast/tmp/kdev-cmake/CMakeLists.txt")  to the model
kdevelop(857)/kdevelop (cmake support debug) CMakeParserUtils::includeScript: Running cmake script:  "/local/work/fast/tmp/kdev-cmake/CMakeLists.txt"
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::walk: Creating a context for KUrl("file:///local/work/fast/tmp/kdev-cmake/CMakeLists.txt")
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::visit: >>  "if" ("NOT", "PROJECT_PRODUCT") true
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::visit: About to visit  "if" ? true
kdevelop(857)/kdevelop (cmake support debug) CMakeProjectVisitor::visit: setting variable: "PROJECT_PRODUCT" false
KCrash: Application 'kdevelop' crashing...

The crash can be reproduced every time.

-- Backtrace:
Application: KDevelop (kdevelop), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
[Current thread is 1 (Thread 0x7fa27a8fb780 (LWP 857))]

Thread 8 (Thread 0x7fa2721c3700 (LWP 858)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:215
#1  0x00007fa28abb2fa7 in wait (time=1000, this=0x8717f0) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x871620, time=1000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fa286d23f8b in KDevelop::DUChainPrivate::CleanupThread::run (this=0x871600) at ../../language/duchain/duchain.cpp:282
#4  0x00007fa28abb2aec in QThreadPrivate::start (arg=0x871600) at thread/qthread_unix.cpp:338
#5  0x00007fa288c2be9a in start_thread (arg=0x7fa2721c3700) at pthread_create.c:308
#6  0x00007fa2898bccbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#7  0x0000000000000000 in ?? ()

Thread 7 (Thread 0x7fa258da1700 (LWP 870)):
#0  0x00007fa288c2f05d in __pthread_mutex_unlock_usercnt (mutex=<optimized out>, decr=<optimized out>) at pthread_mutex_unlock.c:52
#1  __pthread_mutex_unlock (mutex=0x7fa254000a60) at pthread_mutex_unlock.c:290
#2  0x00007fa283cdec61 in g_mutex_unlock () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007fa283ca1d79 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007fa283ca1ea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007fa28acddc16 in QEventDispatcherGlib::processEvents (this=0x7fa2540008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#6  0x00007fa28acae2bf in QEventLoop::processEvents (this=this@entry=0x7fa258da0dd0, flags=...) at kernel/qeventloop.cpp:149
#7  0x00007fa28acae548 in QEventLoop::exec (this=0x7fa258da0dd0, flags=...) at kernel/qeventloop.cpp:204
#8  0x00007fa28abafb10 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#9  0x00007fa28ac8e9af in QInotifyFileSystemWatcherEngine::run (this=0x2e593b0) at io/qfilesystemwatcher_inotify.cpp:248
#10 0x00007fa28abb2aec in QThreadPrivate::start (arg=0x2e593b0) at thread/qthread_unix.cpp:338
#11 0x00007fa288c2be9a in start_thread (arg=0x7fa258da1700) at pthread_create.c:308
#12 0x00007fa2898bccbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#13 0x0000000000000000 in ?? ()

Thread 6 (Thread 0x7fa253fff700 (LWP 916)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007fa2860a5cd7 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#2  0x00007fa2860a5d09 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#3  0x00007fa288c2be9a in start_thread (arg=0x7fa253fff700) at pthread_create.c:308
#4  0x00007fa2898bccbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()

Thread 5 (Thread 0x7fa252659700 (LWP 927)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007fa280de8b2d in ?? () from /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4
#2  0x00007fa280de8c39 in ?? () from /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4
#3  0x00007fa288c2be9a in start_thread (arg=0x7fa252659700) at pthread_create.c:308
#4  0x00007fa2898bccbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7fa252e5a700 (LWP 928)):
#0  0x00007fa283c9f952 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007fa283ca1597 in g_main_context_prepare () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fa283ca1cab in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007fa283ca1ea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007fa28acddc16 in QEventDispatcherGlib::processEvents (this=0x7fa2441c25b0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#5  0x00007fa28acae2bf in QEventLoop::processEvents (this=this@entry=0x7fa252e59e00, flags=...) at kernel/qeventloop.cpp:149
#6  0x00007fa28acae548 in QEventLoop::exec (this=0x7fa252e59e00, flags=...) at kernel/qeventloop.cpp:204
#7  0x00007fa28abafb10 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#8  0x00007fa28abb2aec in QThreadPrivate::start (arg=0x274eeb0) at thread/qthread_unix.cpp:338
#9  0x00007fa288c2be9a in start_thread (arg=0x7fa252e5a700) at pthread_create.c:308
#10 0x00007fa2898bccbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#11 0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7fa24bdec700 (LWP 982)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007fa28abb304b in wait (time=18446744073709551615, this=0x46aa860) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x46a7990, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fa2817d70e1 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x4694160, th=0x46aab10) at ../../../threadweaver/Weaver/WeaverImpl.cpp:365
#4  0x00007fa2817d992b in ThreadWeaver::WorkingHardState::applyForWork (this=0x46b5fd0, th=0x46aab10) at ../../../threadweaver/Weaver/WorkingHardState.cpp:71
#5  0x00007fa2817d879f in ThreadWeaver::ThreadRunHelper::run (this=this@entry=0x7fa24bdebe00, parent=0x4694160, th=th@entry=0x46aab10) at ../../../threadweaver/Weaver/Thread.cpp:87
#6  0x00007fa2817d882b in ThreadWeaver::Thread::run (this=0x46aab10) at ../../../threadweaver/Weaver/Thread.cpp:142
#7  0x00007fa28abb2aec in QThreadPrivate::start (arg=0x46aab10) at thread/qthread_unix.cpp:338
#8  0x00007fa288c2be9a in start_thread (arg=0x7fa24bdec700) at pthread_create.c:308
#9  0x00007fa2898bccbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#10 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fa24b5eb700 (LWP 983)):
[KCrash Handler]
#6  QString::operator= (this=0x7fa1f82711a8, other=...) at tools/qstring.cpp:1410
#7  0x00007fa26130507a in parseFunctionInfo (func=..., this=0x7fa1f8271180) at ../../../projectmanagers/cmake/parser/cmakeast.cpp:3034
#8  StringAst::parseFunctionInfo (this=0x7fa1f8271180, func=...) at ../../../projectmanagers/cmake/parser/cmakeast.cpp:2924
#9  0x00007fa26131fdaa in CMakeProjectVisitor::walk (this=0x7fa24b5ea650, fc=..., line=3, isClean=<optimized out>) at ../../../projectmanagers/cmake/parser/cmakeprojectvisitor.cpp:2196
#10 0x00007fa261335940 in CMakeParserUtils::includeScript (file=..., parent=..., data=0x7fa1f80038a8, sourcedir=..., env=...) at ../../../projectmanagers/cmake/parser/cmakeparserutils.cpp:176
#11 0x00007fa2502a3a34 in CMakeManager::includeScript (this=this@entry=0x429ecc0, file=..., project=project@entry=0x276db10, dir=..., parent=...) at ../../../projectmanagers/cmake/cmakemanager.cpp:669
#12 0x00007fa2502a5441 in CMakeManager::parse (this=0x429ecc0, item=0x469adf0) at ../../../projectmanagers/cmake/cmakemanager.cpp:751
#13 0x00007fa28730bc8b in KDevelop::ImportProjectJobPrivate::import (this=0x45bf8d0, folder=<optimized out>) at ../../project/importprojectjob.cpp:53
#14 0x00007fa28730ba66 in run (this=0x45b0210) at /usr/include/qt4/QtCore/qtconcurrentrunbase.h:134
#15 QtConcurrent::RunFunctionTask<void>::run (this=0x45b0210) at /usr/include/qt4/QtCore/qtconcurrentrunbase.h:125
#16 0x00007fa28aba645d in QThreadPoolThread::run (this=0x46960a0) at concurrent/qthreadpool.cpp:107
#17 0x00007fa28abb2aec in QThreadPrivate::start (arg=0x46960a0) at thread/qthread_unix.cpp:338
#18 0x00007fa288c2be9a in start_thread (arg=0x7fa24b5eb700) at pthread_create.c:308
#19 0x00007fa2898bccbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#20 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fa27a8fb780 (LWP 857)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007fa28abb304b in wait (time=18446744073709551615, this=0x46a8f10) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x46994f8, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fa28aba5c2f in QThreadPoolPrivate::waitForDone (this=0x4699470, msecs=msecs@entry=-1) at concurrent/qthreadpool.cpp:298
#4  0x00007fa28aba76dd in QThreadPool::~QThreadPool (this=0x4698850, __in_chrg=<optimized out>) at concurrent/qthreadpool.cpp:440
#5  0x00007fa28aba7719 in QThreadPool::~QThreadPool (this=0x4698850, __in_chrg=<optimized out>) at concurrent/qthreadpool.cpp:442
#6  0x00007fa28aba7745 in QGlobalStaticDeleter<QThreadPool>::~QGlobalStaticDeleter (this=0x7fa28b006fe8 <theInstance()::cleanup>, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qglobal.h:1950
#7  0x00007fa289804901 in __run_exit_handlers (status=1, listp=0x7fa289b816a8 <__exit_funcs>, run_list_atexit=true) at exit.c:78
#8  0x00007fa289804985 in __GI_exit (status=<optimized out>) at exit.c:100
#9  0x00007fa28a0c0b78 in qt_xio_errhandler () at kernel/qapplication_x11.cpp:781
#10 0x00007fa28b4a9fb8 in KApplication::xioErrhandler (this=0x7fff3f0680c0, dpy=0x799f00) at ../../kdeui/kernel/kapplication.cpp:419
#11 0x00007fa284f8359e in _XIOError () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#12 0x00007fa284f8103d in _XEventsQueued () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#13 0x00007fa284f7260b in XEventsQueued () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#14 0x00007fa28a0fba7c in x11EventSourceCheck (s=0x78e740) at kernel/qguieventdispatcher_glib.cpp:85
#15 0x00007fa283ca188c in g_main_context_check () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007fa283ca1d22 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007fa283ca1ea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007fa28acddbf6 in QEventDispatcherGlib::processEvents (this=0x750b30, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#19 0x00007fa28a0fbc1e in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#20 0x00007fa28acae2bf in QEventLoop::processEvents (this=this@entry=0x7fff3f067b80, flags=...) at kernel/qeventloop.cpp:149
#21 0x00007fa28acae548 in QEventLoop::exec (this=0x7fff3f067b80, flags=...) at kernel/qeventloop.cpp:204
#22 0x00007fa28acb3708 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#23 0x000000000040e610 in main (argc=<optimized out>, argv=<optimized out>) at ../../app/main.cpp:518

This bug may be a duplicate of or related to bug 302670.

Possible duplicates by query: bug 302670, bug 290905.

Reported using DrKonqi
Comment 1 Aleix Pol 2012-10-24 18:41:02 UTC
Git commit 1fce19a014caa8217917667cf04cc5a294b4d6c2 by Aleix Pol.
Committed on 24/10/2012 at 20:33.
Pushed by apol into branch '4.4'.

Don't crash when calling string(TOLOWER, TOUPPER or LENGTH) with too few arguments

Also add some tools for better debugging and testing

M  +18   -4    projectmanagers/cmake/parser/cmakeast.cpp
M  +9    -0    projectmanagers/cmake/parser/cmakelistsparser.cpp
M  +4    -0    projectmanagers/cmake/parser/cmakelistsparser.h
M  +4    -5    projectmanagers/cmake/tests/cmakeast_test.cpp

http://commits.kde.org/kdevelop/1fce19a014caa8217917667cf04cc5a294b4d6c2