CoatiSoftware / Sourcetrail

Sourcetrail - free and open-source interactive source explorer
https://www.sourcetrail.com/
GNU General Public License v3.0
14.73k stars 1.37k forks source link

Crash when indexing Code::Blocks project #1109

Closed wmww closed 3 years ago

wmww commented 3 years ago

When I try to index a Code::Blocks project I get the following crash. Observed on Linux with both the Sourcetrail 2020.2.43 AppImage and current master. I can upload a tarball of the whole project on request.

GDB output ``` (gdb) r Starting program: /home/wmww/code/utils/Sourcetrail/build/app/Sourcetrail [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". QCoreApplication::applicationDirPath: Please instantiate the QApplication object first ERROR: Please run Sourcetrail via the Sourcetrail.sh script! [New Thread 0x7fffebb6b700 (LWP 678556)] qt5ct: using qt5ct plugin 09:19:44 | LogManager.cpp:35 setLoggingEnabled() | INFO: Enabled logging for Sourcetrail 64 bit, version 2020.2.65 09:19:44 | SharedMemoryGarbageCollector.cpp:59 run() | INFO: start shared memory garbage collection [New Thread 0x7fffeaea1700 (LWP 678557)] [New Thread 0x7fffe94dc700 (LWP 678558)] qt5ct: D-Bus global menu: no [New Thread 0x7fffe8b69700 (LWP 678559)] [New Thread 0x7fffda981700 (LWP 678560)] [New Thread 0x7fffda180700 (LWP 678561)] [New Thread 0x7fffd997f700 (LWP 678562)] [New Thread 0x7fffd917e700 (LWP 678563)] [New Thread 0x7fffd897d700 (LWP 678564)] [New Thread 0x7fffcbfff700 (LWP 678565)] 09:19:44 | INFO: send MessageStatus Starting Sourcetrail 64 bit, version 2020.2.65 09:19:44 | ApplicationSettingsPrefiller.cpp:31 prefillJavaRuntimePath() | INFO: Prefilling Java path 09:19:44 | StatusBarController.cpp:87 setStatus() | INFO: STATUS Starting Sourcetrail 64 bit, version 2020.2.65 09:19:44 | INFO: send MessageStatus Load settings: /home/wmww/.config/sourcetrail/ApplicationSettings.xml 09:19:44 | utilityQt.cpp:66 loadFontsFromDirectory() | INFO: Loaded FontFamily: Source Code Pro 09:19:44 | utilityQt.cpp:66 loadFontsFromDirectory() | INFO: Loaded FontFamily: Source Code Pro 09:19:44 | utilityQt.cpp:66 loadFontsFromDirectory() | INFO: Loaded FontFamily: Fira Sans 09:19:44 | utilityQt.cpp:66 loadFontsFromDirectory() | INFO: Loaded FontFamily: Source Code Pro 09:19:44 | utilityQt.cpp:66 loadFontsFromDirectory() | INFO: Loaded FontFamily: Fira Sans 09:19:44 | utilityQt.cpp:66 loadFontsFromDirectory() | INFO: Loaded FontFamily: Roboto 09:19:44 | utilityQt.cpp:66 loadFontsFromDirectory() | INFO: Loaded FontFamily: Roboto qt5ct: custom style sheet is disabled 09:19:44 | StatusBarController.cpp:87 setStatus() | INFO: STATUS Load settings: /home/wmww/.config/sourcetrail/ApplicationSettings.xml 09:19:44 | INFO: send MessageStatus Enabled console and file logging. 09:19:44 | StatusBarController.cpp:87 setStatus() | INFO: STATUS Enabled console and file logging. 09:19:44 | INFO: send MessagePingReceived 09:19:44 | INFO: send MessageStatus Ran Java runtime path detection, no path found. 09:19:44 | StatusBarController.cpp:87 setStatus() | INFO: STATUS Ran Java runtime path detection, no path found. 09:19:44 | INFO: send MessageLoadProject , settingsChanged: false, refreshMode: 0 libpng warning: iCCP: known incorrect sRGB profile 09:19:45 | INFO: send MessageWindowFocus 09:19:45 | INFO: send MessagePingReceived 09:19:46 | INFO: send MessageLoadProject /home/wmww/code/esoteric/Brainfuck/cpp_brainfuck.srctrlprj, settingsChanged: false, refreshMode: 0 09:19:46 | INFO: send MessageStatus Loading Project: /home/wmww/code/esoteric/Brainfuck/cpp_brainfuck.srctrlprj - loading 09:19:46 | StatusBarController.cpp:87 setStatus() | INFO: STATUS Loading Project: /home/wmww/code/esoteric/Brainfuck/cpp_brainfuck.srctrlprj 09:19:47 | Project.cpp:155 load() | INFO: Discarding temporary indexing data on user's decision 09:19:47 | INFO: send MessageStatus Project could not load any symbols because the index database is empty. Please re-index the project. 09:19:47 | StatusBarController.cpp:87 setStatus() | INFO: STATUS Project could not load any symbols because the index database is empty. Please re-index the project. 09:19:47 | INFO: send MessageRefresh 09:19:48 | INFO: send MessageStatus Preparing Indexing - loading 09:19:48 | StatusBarController.cpp:87 setStatus() | INFO: STATUS Preparing Indexing 09:19:48 | INFO: send MessageErrorCountClear 09:19:48 | INFO: send MessageStatus Preparing Indexing: Setting up Indexers - loading 09:19:48 | StatusBarController.cpp:87 setStatus() | INFO: STATUS Preparing Indexing: Setting up Indexers 09:19:48 | INFO: send MessageIndexingStatus Thread 9 "Sourcetrail" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffd917e700 (LWP 678563)] 0x0000555555645324 in std::vector, std::allocator >, std::allocator, std::allocator > > >::size (this=0x18) at /usr/include/c++/9/bits/stl_vector.h:916 916 { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); } (gdb) bt #0 0x0000555555645324 in std::vector, std::allocator >, std::allocator, std::allocator > > >::size (this=0x18) at /usr/include/c++/9/bits/stl_vector.h:916 #1 0x00005555559197ca in utility::convert, std::allocator >, FilePath> ( sourceContainer=) at /home/wmww/code/utils/Sourcetrail/src/lib/utility/utility.h:303 #2 0x00005555559166d8 in Codeblocks::Project::::operator()(const std::wstring &) const (__closure=0x7fffb824f450, targetName=L"transpile") at /home/wmww/code/utils/Sourcetrail/src/lib_cxx/utility/codeblocks/CodeblocksProject.cpp:237 #3 0x00005555559183d9 in std::_Function_handler, std::allocator >, std::allocator, std::allocator > > >(const std::__cxx11::basic_string, std::allocator >&), Codeblocks::Project::getIndexerCommands(std::shared_ptr, std::shared_ptr) const:: >::_M_invoke(const std::_Any_data &, const std::__cxx11::basic_string, std::allocator > &) (__functor=..., __args#0=L"transpile") at /usr/include/c++/9/bits/std_function.h:286 #4 0x000055555591b122 in std::function, std::allocator >, std::allocator, std::allocator > > > (std::__cxx11::basic_string, std::allocator > const&)>::operator()(std::__cxx11::basic_string, std::allocator > const&) const (this=0x7fffd917d370, __args#0=L"transpile") at /usr/include/c++/9/bits/std_function.h:688 #5 0x0000555555919b2d in OrderedCache, std::allocator >, std::vector, std::allocator >, std::allocator, std::allocator > > > >::getValue (this=0x7fffd917d370, key=L"transpile") at /home/wmww/code/utils/Sourcetrail/src/lib/utility/OrderedCache.h:38 #6 0x0000555555917386 in Codeblocks::Project::getIndexerCommands (this=0x7fffb8248080, sourceGroupSettings=std::shared_ptr (use count 2, weak count 0) = {...}, appSettings=std::shared_ptr (use count 2, weak count 0) = {...}) at /home/wmww/code/utils/Sourcetrail/src/lib_cxx/utility/codeblocks/CodeblocksProject.cpp:309 #7 0x00005555559027e5 in SourceGroupCxxCodeblocks::getIndexerCommandProvider (this=0x7fffb8001160, info=...) at /home/wmww/code/utils/Sourcetrail/src/lib_cxx/project/SourceGroupCxxCodeblocks.cpp:75 #8 0x0000555555b427e0 in Project::buildIndex (this=0x7fffb80028e0, info=..., dialogView=std::shared_ptr (use count 4, weak count 0) = {...}) at /home/wmww/code/utils/Sourcetrail/src/lib/project/Project.cpp:595 #9 0x0000555555b400dc in Project::::operator()(const RefreshInfo &) const (__closure=0x55555699d2e0, info=...) at /home/wmww/code/utils/Sourcetrail/src/lib/project/Project.cpp:420 #10 0x0000555555b469d7 in std::_Function_handler, RefreshMode, bool):: >::_M_invoke(const std::_Any_data &, const RefreshInfo &) (__functor=..., __args#0=...) at /usr/include/c++/9/bits/std_function.h:300 #11 0x00005555557f3c0b in std::function::operator()(RefreshInfo const&) const (this=0x5555570e2f70, __args#0=...) at /usr/include/c++/9/bits/std_function.h:688 #12 0x00005555557e9bd8 in QtDialogView::::::::operator()(void) const (__closure=0x5555570e2f70) at /home/wmww/code/utils/Sourcetrail/src/lib_gui/qt/view/QtDialogView.cpp:184 #13 0x00005555557f229d in std::_Function_handler&, RefreshMode, bool, bool, std::function, std::function):::::: >::_M_invoke(const std::_Any_data &) (__functor=...) at /usr/include/c++/9/bits/std_function.h:300 #14 0x000055555565b878 in std::function::operator()() const (this=0x55555713fdd0) at /usr/include/c++/9/bits/std_function.h:688 #15 0x0000555555c8a3dc in TaskLambda::doUpdate (this=0x55555713fdc0, blackboard=std::shared_ptr (use count 4, weak count 0) = {...}) at /home/wmww/code/utils/Sourcetrail/src/lib/utility/scheduling/TaskLambda.cpp:9 #16 0x0000555555c81ce3 in Task::update (this=0x55555713fdc0, blackboard=std::shared_ptr (use count 4, weak count 0) = {...}) at /home/wmww/code/utils/Sourcetrail/src/lib/utility/scheduling/Task.cpp:29 #17 0x0000555555c8c814 in TaskRunner::update (this=0x55555699db10, blackboard=std::shared_ptr (use count 4, weak count 0) = {...}) at /home/wmww/code/utils/Sourcetrail/src/lib/utility/scheduling/TaskRunner.cpp:41 #18 0x0000555555c8c63b in TaskRunner::update (this=0x55555699db10, schedulerId=1) at /home/wmww/code/utils/Sourcetrail/src/lib/utility/scheduling/TaskRunner.cpp:18 #19 0x0000555555c8fc05 in TaskScheduler::processTasks (this=0x555556692280) at /home/wmww/code/utils/Sourcetrail/src/lib/utility/scheduling/TaskScheduler.cpp:158 #20 0x0000555555c8f504 in TaskScheduler::startSchedulerLoop (this=0x555556692280) at /home/wmww/code/utils/Sourcetrail/src/lib/utility/scheduling/TaskScheduler.cpp:66 #21 0x0000555555c93294 in std::__invoke_impl ( __f=@0x555556f00210: (void (TaskScheduler::*)(TaskScheduler * const)) 0x555555c8f354 , __t=@0x555556f00208: 0x555556692280) at /usr/include/c++/9/bits/invoke.h:73 #22 0x0000555555c931c2 in std::__invoke (__fn=@0x555556f00210: (void (TaskScheduler::*)(TaskScheduler * const)) 0x555555c8f354 ) at /usr/include/c++/9/bits/invoke.h:95 #23 0x0000555555c93121 in std::thread::_Invoker >::_M_invoke<0ul, 1ul> (this=0x555556f00208) at /usr/include/c++/9/thread:244 #24 0x0000555555c930d8 in std::thread::_Invoker >::operator() (this=0x555556f00208) at /usr/include/c++/9/thread:251 #25 0x0000555555c930b8 in std::thread::_State_impl > >::_M_run (this=0x555556f00200) at /usr/include/c++/9/thread:195 #26 0x00007fffef929d84 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #27 0x00007fffefa3d609 in start_thread (arg=) at pthread_create.c:477 #28 0x00007fffef617293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 (gdb) ```
wmww commented 3 years ago

Looks like target->getCompiler() is returning null but not being checked.