Debugging with GDB and Qt no longer works

I have been doing this code on my Windows laptop for years now, just for fun.

I use an Eclipse IDE framework (the right word?) and a MinGW directory
where I have the MinGW32-make, gdb and g++ tools.
Lastly, I have a directory full of Qt files for graphics stuff (QtWidgets).

For years now Eclipse, MinGW and Qt have worked together just fine and
have been able to use breakpoints and watch lists to follow the code.
Now there is no more debugging possible.

The compiler string for debugging looks like this :
C:\msys64\mingw64/bin/g++ -c -g -std=gnu++11 -pipe -fno-keep-inline-dllexport -frtti -Wall -fexceptions -mthreads
-DUNICODE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -DQT_QML_DEBUG
-ID:/Projects21/AnalogClock
-ID:/Qt/5.12.0/mingw73_64/include
-ID:/Qt/5.12.0/mingw73_64/include/QtWidgets
-ID:/Qt/5.12.0/mingw73_64/include/QtGui
-ID:/Qt/5.12.0/mingw73_64/include/QtCore
-ID:/Qt/5.12.0/mingw73_64/mkspecs/win32-g++
-ID:/Projects21/AnalogClock/obj/Debug
-o obj/Debug/MainWind.o
src/panels/MainWin.cpp // here the object file for MainWnd is compiled

The linking string looks like this :
C:\msys64\mingw64/bin/g++
-Wl,-subsystem,windows -mthreads
-o D:/Projects21/AnalogClock/bin/Debug/AnalogClockd.exe
obj/Debug/moc_MainWind.o
obj/Debug/MainWind.o
obj/Debug/AnalogClockd.o
obj/Debug/moc_ClockWind.o
obj/Debug/ClockWind.o
-lmingw32 -lshell32 -lglu32 -lopengl32 -lgdi32 -luser32
-LD:/Qt/5.12.0/mingw73_64/lib
D:/Qt/5.12.0/mingw73_64/lib/libqtmaind.a
D:/Qt/5.12.0/mingw73_64/lib/libQt5Cored.a
D:/Qt/5.12.0/mingw73_64/lib/libQt5Guid.a
D:/Qt/5.12.0/mingw73_64/lib/libQt5Widgetsd.a // it links AnalogClock.cpp, MainWnd.cpp and ClockWnd to create AnalogClockd.exe

This generates an exe but running the exe in Eclipse in Debug mode
always perishes and brings in the Debugger Console :

Thread 1 received signal SIGSEGV, Segmentation fault.
0x000000000d6116d0 in pthread_spin_lock () from D:\Projects21\AnalogClock\bin\Debug\Qt5Cored.dll

Compiled as a release it works !!! Compiled as above it does the segmentation fault thing.

When I run it as a Release-executable I must change just three things to those two strings up there.

1. drop the -g in the compile statement (so good-bye to any debugging)
2. drop the -DQT_QML_DEBUG in the compile statement
3. in the linker, use four different files (without 'd' in their names)
D:/Qt/5.12.0/mingw73_64/lib/libqtmain.a
D:/Qt/5.12.0/mingw73_64/lib/libQt5Core.a
D:/Qt/5.12.0/mingw73_64/lib/libQt5Gui.a
D:/Qt/5.12.0/mingw73_64/lib/libQt5Widgets.a

I have installed brand new Eclipse 2021-06, brand new MinGW and Qt is at version 5.12.

Did one of those updates from Microsoft sabotage the working-together of GDB and Qt?

Any help would be greatly appreciated.
Last edited on
I'm confused by what question you're asking.

> always perishes and brings in the Debugger Console :
Are you saying that a failed program no longer drops you into the debugger.


> Compiled as a release it works !!! Compiled as above it does the segmentation fault thing.
Or are you complaining that there's now a difference between the "debug" and "release" versions.
Yes it is confusing. I compile and link using the parameters for Release and it runs.
When I compile and link using the parameters for debugging, then it doesn't run. It hangs at pthread_spin_lock().

I would like it to run in Debug mode as well as in Release mode.

In Debug mode there are three different parameters in compiling and linking from Release mode. Described above.

I hope that's clear.
> It hangs at pthread_spin_lock().
Do you have a gdb prompt at this point?

I mean you saw this
Thread 1 received signal SIGSEGV, Segmentation fault.
0x000000000d6116d0 in pthread_spin_lock () from D:\Projects21\AnalogClock\bin\Debug\Qt5Cored.dll

Are you also looking at (gdb) waiting for you to type something.

Are you making your own spin lock, or is that something happening within DLL code that you can't see?
To salem c :
I am using gdb within Eclipse. The program freezes or hangs or is in a loop. There is no box that opens and says "Please Enter..." I don't feel it is waiting for me to do anything. I must stop the program each time with a red button before continuing.

To Ganado : I have no idea what a spin lock is.
It is something which happens apparently within the DLL. Would you like to see the asm code where it freezes?
Would you like to see the asm code where it freezes?
No, I certainly would have no idea what to do with that information. Maybe you should try to determine which Qt function call the error happens on.
Found it.
The Qt5Widgetsd.dll which I had downloaded from the net was goofy.
I found the Qt5Widgetsd.dll, Qt5Guid.dll and Qt5Cored.dll all in the
D:\Qt\5.12.0\mingw73_64\bin folder. These ones worked.

Thanks to all for your help.

Situation resolved.
Last edited on
Topic archived. No new replies allowed.