Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to debug crash in qt5core.dll thread



  • I'm a bit lost.

    Debug gives me no info.

    Do I have to download source, build qt from source and then use built version to debug that crash?

    Regards
    Dariusz


  • Lifetime Qt Champion

    Install the debug information and source with the Qt online installer and build / run your program in debug.



  • Hey

    So I have to download these 2 things >
    567a0305-9caa-4010-be60-cffe11a62a51-image.png
    And then build my own source in debug/release modes & link against these dlls and not the prebuild MSVC 2019 I downloaded above?



  • Hello

    @Christian-Ehrlicher I've been trying build qt from source today... following readme as much as I could... so far I had some "limited" success but I got stuck mid compile... Here are my steps :

    CMD WITH AMIN
    cd C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build
    vcvarsall.bat x86_amd64
    cd C:\Qt\5.15.1\Src\qtbase
    
    configure -debug-and-release -opengl desktop -nomake -opensource -platform win32-msvc
    

    It starts doints its "Magic" but some work in I get this >

            cl -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch -c -Fo./ -Fdqmake.pdb  -W2 -nologo -O2  /MP /wd4577   -IC:\Qt\5.15.1\Src\qtbase\qmake -IC:\Qt\5.15.1\Src\qtbase\qmake\library -IC:\Qt\5.15.1\Src\qtbase\qmake\generators -IC:\Qt\5.15.1\Src\qtbase\qmake\generators\unix -IC:\Qt\5.15.1\Src\qtbase\qmake\generators\win32 -IC:\Qt\5.15.1\Src\qtbase\qmake\generators\mac  -IC:\Qt\5.15.1\Src\qtbase/src/3rdparty/tinycbor/src  -IC:\Qt\5.15.1\Src\qtbase/include -IC:\Qt\5.15.1\Src\qtbase/include\QtCore -IC:\Qt\5.15.1\Src\qtbase/include\QtCore\5.15.1 -IC:\Qt\5.15.1\Src\qtbase/include\QtCore\5.15.1\QtCore  -I..\src\corelib\global  -IC:\Qt\5.15.1\Src\qtbase\mkspecs\win32-msvc   -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS  -DQT_VERSION_STR=\"5.15.1\" -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=15 -DQT_VERSION_PATCH=1  -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL  -DQT_NO_FOREACH -DUNICODE -D_ENABLE_EXTENDED_ALIGNED_STORAGE  C:\Qt\5.15.1\Src\qtbase\src\corelib\serialization\qjsonobject.cpp
    qjsonobject.cpp
            cl -c -Fo./ -Fdqmake.pdb  -W2 -nologo -O2  /MP /wd4577   -IC:\Qt\5.15.1\Src\qtbase\qmake -IC:\Qt\5.15.1\Src\qtbase\qmake\library -IC:\Qt\5.15.1\Src\qtbase\qmake\generators -IC:\Qt\5.15.1\Src\qtbase\qmake\generators\unix -IC:\Qt\5.15.1\Src\qtbase\qmake\generators\win32 -IC:\Qt\5.15.1\Src\qtbase\qmake\generators\mac  -IC:\Qt\5.15.1\Src\qtbase/src/3rdparty/tinycbor/src  -IC:\Qt\5.15.1\Src\qtbase/include -IC:\Qt\5.15.1\Src\qtbase/include\QtCore -IC:\Qt\5.15.1\Src\qtbase/include\QtCore\5.15.1 -IC:\Qt\5.15.1\Src\qtbase/include\QtCore\5.15.1\QtCore  -I..\src\corelib\global  -IC:\Qt\5.15.1\Src\qtbase\mkspecs\win32-msvc   -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS  -DQT_VERSION_STR=\"5.15.1\" -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=15 -DQT_VERSION_PATCH=1  -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL  -DQT_NO_FOREACH -DUNICODE -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DQT_BUILD_QMAKE_BOOTSTRAP C:\Qt\5.15.1\Src\qtbase\src\corelib\global\qlibraryinfo.cpp
            cl -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch -c -Fo./ -Fdqmake.pdb  -W2 -nologo -O2  /MP /wd4577   -IC:\Qt\5.15.1\Src\qtbase\qmake -IC:\Qt\5.15.1\Src\qtbase\qmake\library -IC:\Qt\5.15.1\Src\qtbase\qmake\generators -IC:\Qt\5.15.1\Src\qtbase\qmake\generators\unix -IC:\Qt\5.15.1\Src\qtbase\qmake\generators\win32 -IC:\Qt\5.15.1\Src\qtbase\qmake\generators\mac  -IC:\Qt\5.15.1\Src\qtbase/src/3rdparty/tinycbor/src  -IC:\Qt\5.15.1\Src\qtbase/include -IC:\Qt\5.15.1\Src\qtbase/include\QtCore -IC:\Qt\5.15.1\Src\qtbase/include\QtCore\5.15.1 -IC:\Qt\5.15.1\Src\qtbase/include\QtCore\5.15.1\QtCore  -I..\src\corelib\global  -IC:\Qt\5.15.1\Src\qtbase\mkspecs\win32-msvc   -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS  -DQT_VERSION_STR=\"5.15.1\" -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=15 -DQT_VERSION_PATCH=1  -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL  -DQT_NO_FOREACH -DUNICODE -D_ENABLE_EXTENDED_ALIGNED_STORAGE  C:\Qt\5.15.1\Src\qtbase\src\corelib\serialization\qjsonvalue.cpp
    qjsonvalue.cpp
    qlibraryinfo.cpp
            link  /OUT:..\bin\qmake.exe project.obj main.obj ioutils.obj proitems.obj qmakevfs.obj  qmakeglobals.obj qmakeparser.obj qmakeevaluator.obj qmakebuiltins.obj  makefile.obj unixmake.obj unixmake2.obj mingw_make.obj  option.obj winmakefile.obj projectgenerator.obj property.obj meta.obj  makefiledeps.obj metamakefile.obj xmloutput.obj  msvc_nmake.obj msvc_vcproj.obj msvc_vcxproj.obj  msvc_objectmodel.obj msbuild_objectmodel.obj registry.obj qbitarray.obj  qbuffer.obj  qcryptographichash.obj  qfilesystementry.obj  qfilesystemengine.obj  qfilesystemengine_win.obj  qfilesystemiterator_win.obj  qfsfileengine.obj  qfsfileengine_iterator.obj  qarraydata.obj  qbytearray.obj  qbytearraylist.obj  qvsnprintf.obj  qbytearraymatcher.obj  qcalendar.obj  qdatetime.obj  qdir.obj  qdiriterator.obj  qfiledevice.obj  qfile.obj  qtemporaryfile.obj  qabstractfileengine.obj  qfsfileengine_win.obj  qsystemlibrary.obj  qfileinfo.obj  qendian.obj  qglobal.obj  qgregoriancalendar.obj  qhash.obj  qiodevice.obj  qringbuffer.obj  qdebug.obj  qlist.obj  qlocale.obj  qlocale_tools.obj  qlocale_win.obj  qversionnumber.obj  qmalloc.obj  qmap.obj  qoperatingsystemversion.obj  qoperatingsystemversion_win.obj  qregexp.obj  qromancalendar.obj  qutfcodec.obj  qstring.obj  qstringlist.obj  qstringbuilder.obj  qsystemerror.obj  qtextstream.obj  qdatastream.obj  quuid.obj  qrandom.obj  qsettings.obj  qvariant.obj  qsettings_win.obj  qmetatype.obj  qxmlstream.obj  qxmlutils.obj  qnumeric.obj  qlogging.obj  qcborstreamwriter.obj  qcborvalue.obj  qjsoncbor.obj  qjsondocument.obj  qjsonparser.obj  qjsonarray.obj  qjsonobject.obj  qjsonvalue.obj qlibraryinfo.obj qmake_pch.obj ole32.lib advapi32.lib shell32.lib netapi32.lib
    Microsoft (R) Incremental Linker Version 14.27.29112.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    Info: creating cache file C:\Qt\5.15.1\Src\qtbase\.qmake.cache
    ERROR: No value supplied to command line option 'nomake'.
    

    Any ideas how to bite it? I'm lost o.o

    I tried running it again now and all I get is the error above without any progress... just Boostrapping qmake... jom1.1.3 & error


  • Lifetime Qt Champion

    @Dariusz said in How to debug crash in qt5core.dll thread:

    I've been trying build qt from source today.

    Why?



  • @Dariusz
    All @Christian-Ehrlicher asked you to do was:

    Install the debug information and source with the Qt online installer and build / run your program in debug.

    By downloading just that stuff your PC will have more information to show you in the debugger when inside Qt libraries. It just needs these files to be found, it does not mean you need to build Qt yourself. Assuming you download files from the same version of Qt as you previously installed.

    But btw you may not even have needed to do this. If you claim you have a "crash in qt5core.dll", start by running your app from witihin the debugger. When it "crashes" the debugger should break. Find the stack trace window pane. If you have compiled your own code for debug, it will hopefully show you a trace back into some particular line of your own source. That may be all you need to diagnose the cause, without requiring Qt library symbols/source.



  • @Christian-Ehrlicher said in How to debug crash in qt5core.dll thread:

    @Dariusz said in How to debug crash in qt5core.dll thread:

    I've been trying build qt from source today.

    Why?

    I though thats what u meant... to build debug dlls from source to use in my debug app to debug issue.

    @JonB said in How to debug crash in qt5core.dll thread:

    @Dariusz
    All @Christian-Ehrlicher asked you to do was:

    Install the debug information and source with the Qt online installer and build / run your program in debug.

    By downloading just that stuff your PC will have more information to show you in the debugger when inside Qt libraries. It just needs these files to be found, it does not mean you need to build Qt yourself. Assuming you download files from the same version of Qt as you previously installed.

    But btw you may not even have needed to do this. If you claim you have a "crash in qt5core.dll", start by running your app from witihin the debugger. When it "crashes" the debugger should break. Find the stack trace window pane. If you have compiled your own code for debug, it will hopefully show you a trace back into some particular line of your own source. That may be all you need to diagnose the cause, without requiring Qt library symbols/source.

    Yes when I run in debug I have stack trace... and it starts on my app, few function down the line it dives in to Qt dlls and dies there. So I don't really know what/why/where it "really" dies.

    Its threading error. I just cant fully debug it as half of the error happens on Qt side.


  • Lifetime Qt Champion

    @Dariusz said in How to debug crash in qt5core.dll thread:

    few function down the line it dives in to Qt dlls and dies there.

    So you should take a look in your code where you call the Qt function which crashes to see if there is something wrong.



  • @Christian-Ehrlicher said in How to debug crash in qt5core.dll thread:

    @Dariusz said in How to debug crash in qt5core.dll thread:

    few function down the line it dives in to Qt dlls and dies there.

    So you should take a look in your code where you call the Qt function which crashes to see if there is something wrong.

    Well it does not crash in my code. It gets a request from my code to set a widget and then it crashes in internal Qt logic. So I cant debug it can I? The only way is to to get stack from qt dlls and see which thread/ptr/item cause issue and figure out why. I take there is a threading problem but I need more info to narrow it down.


  • Lifetime Qt Champion

    So did you finally have a valid backtrace as we suggested already many times?
    Simplify your code until it no longer crashes.



  • @Christian-Ehrlicher Yes I've installed extra modules from QT... I still don't have valid trace. This is all I get >
    79be4458-e889-4520-8495-bf04fa1b4b9f-image.png
    296b1568-be18-4afa-8be7-13965c74ada4-image.png
    600e0fa7-4cf2-455b-ac15-3c774f4e90c6-image.png

    When I break stop start of the app and step by step all the way to return a.exec(); There is no crash. The second I hit a.exec() I get a crash. Hell I even see qt widget for a split second with all data populated properly and then it kicks the bucket.

    So yea, nope I need to see function, location, data etc etc >
    012d44c6-c0f8-4aae-9ebd-c0c24f67fed3-image.png
    d9640e2d-5734-43e9-a7a5-d76797218e7b-image.png

    I'm still stuck trying to compile the source. :- (



  • After you install the sources and debug info files, you need to set source paths mapping and add CDB symbol paths in the options dialog to make them work in debugging by Qt Creator.
    If you are using visual studio, I'm not sure if you can map the sources but you should also add the symbol path.
    There's really no need to compile Qt from source.



  • @Bonnie Hey, thanks for info! But I'm lost, what paths, to what files ? above all where ? o.o
    I went to https://doc.qt.io/qtcreator/creator-debugger-engines.html but I did not find anything about symbols
    I've no idea where qt has downloaded the Qt Debug information files :- (



  • @Dariusz
    It's quite simple if your are using Qt creator to debug.
    In "Source Paths Mapping" of the General tab, click "Add Qt sources..." and choose the Src folder.
    Then in "Symbol Paths" of the CDB Paths tab, click "Insert..." and choose the Qt bin folder (that's usually the .pdb files are downloaded to).


Log in to reply