Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse debugging a Qt form with strange behaviour(C++ Qt 5.3 Mingw32)
Eclipse debugging a Qt form with strange behaviour [message #1431210] Thu, 25 September 2014 10:56 Go to next message
Sequoia Tree is currently offline Sequoia TreeFriend
Messages: 28
Registered: August 2014
Junior Member
I've finally got eclipse to compile a Qt form in a release build and a debug build
using makefiles. Versions SF003.exe and SF003d.exe put the Form up just fine.

Now when I debug it, it comes to a halt at the start of a main.c file deep in the Qt folder. When I press resume, then
it reaches the breakpoints I have set in my cpp code. Very strange. A cpp program demands the presence of a C-coded main.c file
where 'hello world' is outputted. Shocked

index.php/fa/19266/0/

Can I tweak the g++ compile and link process to stop doing this?

this is how the debug exe (SF003d.exe) is built,
in five of the lines, #1, #3, #4 #5 & #6, the included directory E:/Qt/Tools/QtCreator/share/qtcreator/templates/wizards/plaincapp/common
is the location of this silly little main.c

mingw32-make.exe -f makefile.Debug all 

#1
g++.exe -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -IE:/Qt/5.3/mingw482_32/include -IE:/Qt/Tools/QtCreator/share/qtcreator/templates/wizards/plaincapp/common -IE:/Qt/5.3/mingw482_32/include/QtWidgets -IE:/Qt/5.3/mingw482_32/include/QtGui -IE:/Qt/5.3/mingw482_32/include/QtCore -IE:/Qt/5.3/mingw482_32/mkspecs/win32-g++ -I"debug" -I"."  -o ./debug/src/main.o -c "./src/SF003.cpp"	

#2
uic.exe ./src/mainwindow.ui -o "./src/ui_mainwindow.h"	

#3
g++.exe -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -IE:/Qt/5.3/mingw482_32/include [b]-IE:/Qt/Tools/QtCreator/share/qtcreator/templates/wizards/plaincapp/common[/b] -IE:/Qt/5.3/mingw482_32/include/QtWidgets -IE:/Qt/5.3/mingw482_32/include/QtGui -IE:/Qt/5.3/mingw482_32/include/QtCore -IE:/Qt/5.3/mingw482_32/mkspecs/win32-g++ -I"debug" -I"."  -o "./debug/src/mainwindowd.o" -c "./src/mainwindow.cpp"	

#4
moc.exe -DUNICODE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -D__GNUC__ -DWIN32  -IE:/Qt/5.3/mingw482_32/include [b]-IE:/Qt/Tools/QtCreator/share/qtcreator/templates/wizards/plaincapp/common[/b] -IE:/Qt/5.3/mingw482_32/include/QtWidgets -IE:/Qt/5.3/mingw482_32/include/QtGui -IE:/Qt/5.3/mingw482_32/include/QtCore -IE:/Qt/5.3/mingw482_32/mkspecs/win32-g++ -I"debug" -I"."  ./src/mainwindow.h -o ./src/moc_mainwindow.cpp

#5
moc.exe -DUNICODE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -D__GNUC__ -DWIN32  -IE:/Qt/5.3/mingw482_32/include [b]-IE:/Qt/Tools/QtCreator/share/qtcreator/templates/wizards/plaincapp/common[/b] -IE:/Qt/5.3/mingw482_32/include/QtWidgets -IE:/Qt/5.3/mingw482_32/include/QtGui -IE:/Qt/5.3/mingw482_32/include/QtCore -IE:/Qt/5.3/mingw482_32/mkspecs/win32-g++ -I"debug" -I"."  ./src/mainwindow.h -o ./src/moc_mainwindow.cpp

#6
g++.exe -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -IE:/Qt/5.3/mingw482_32/include [b]-IE:/Qt/Tools/QtCreator/share/qtcreator/templates/wizards/plaincapp/common[/b] -IE:/Qt/5.3/mingw482_32/include/QtWidgets -IE:/Qt/5.3/mingw482_32/include/QtGui -IE:/Qt/5.3/mingw482_32/include/QtCore -IE:/Qt/5.3/mingw482_32/mkspecs/win32-g++ -I"debug" -I"."  -o "./debug/src/moc_mainwindowd.o" -c ./src/moc_mainwindow.cpp

#7
g++ -Wl,-subsystem,windows -mthreads -o debug/SF003d.exe  ./debug/src/main.o debug/src/mainwindowd.o debug/src/moc_mainwindowd.o  -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32  -LE:/Qt/5.3/mingw482_32/lib -lqtmaind  -LC:/mingw482/mingw32/lib -LC:/Utils/icu32_52_1_mingw482/lib -LC:/utils/postgresql/pgsql/lib -LC:/utils/mysql/mysql/lib -LC:/opensll/lib -LE:/Qt/5.3/mingw482_32/lib -lQt5Widgetsd -lQt5Guid -lQt5Cored 

[Updated on: Thu, 25 September 2014 11:02]

Report message to a moderator

Re: Eclipse debugging a Qt form with strange behaviour [message #1433906 is a reply to message #1431210] Mon, 29 September 2014 11:46 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
https://wiki.eclipse.org/CDT/User/FAQ#How_do_I_prevent_the_debugger_from_stopping_on_the_first_line.3F

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Eclipse debugging a Qt form with strange behaviour [message #1434099 is a reply to message #1433906] Mon, 29 September 2014 17:11 Go to previous messageGo to next message
Sequoia Tree is currently offline Sequoia TreeFriend
Messages: 28
Registered: August 2014
Junior Member
Been there, done that.

Seems odd to have a debugger stop before the program performs a single line of code, but I discovered this trick about "stop on startup" a week ago. I've been tweaking everywhere for 7 days but this gdb will not stop at a breakpoint.

Trouble is gdb does not stop at any breakpoints I set in this Qt program. Even in a Hello World program it does not stop at any breakpoints I set.

CDT Builder and scanner Configuration Builder both have all of their run options off because if I can't see what it's doing then I don't know what it's doing so I turn all option off and know for sure it does nothing.

I have all the options, except for "stop at start", set in the manner shown in the webpage you sent.

Mad

now debug fails completely with :

Failed to execute MI command:
-exec-run
Error message from debugger back end:
The target does not support running in non-stop mode
The target does not support running in non-stop mode

What must I put into this ".gdbinit" file? What are MI commands?

I have googled and poured through gdb manuals online - a line command debugger has no info on how to use it with a graphical UI.

What can I do now?

[Updated on: Mon, 29 September 2014 17:12]

Report message to a moderator

Re: Eclipse debugging a Qt form with strange behaviour [message #1434675 is a reply to message #1434099] Tue, 30 September 2014 12:37 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Quote:
Failed to execute MI command:
-exec-run
Error message from debugger back end:
The target does not support running in non-stop mode
The target does not support running in non-stop mode

Your gdb version does not support non-stop mode. More info about this feature here http://help.eclipse.org/luna/topic/org.eclipse.cdt.doc.user/reference/cdt_u_dsfgdb.htm?cp=9_4_6_3_3
You can savely ignore this message at the moment. It has nothing to do with your problem (gdb not stopping at breakpoint).
(just as info: MI commands are the way Eclipse does communicate with the gdb backend).
To examine your problem we need the gdb output ("gdb traces").
https://wiki.eclipse.org/CDT/User/FAQ#I.27ve_been_asked_for_.27gdb_traces.27.2C_where_can_I_find_them.3F


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Eclipse debugging a Qt form with strange behaviour [message #1435245 is a reply to message #1434675] Wed, 01 October 2014 07:55 Go to previous messageGo to next message
Sequoia Tree is currently offline Sequoia TreeFriend
Messages: 28
Registered: August 2014
Junior Member
Thanks for the reply. As you indicated I have prepared here something to trace :

Here is a really easy hello world program

Eclipse projects are all in E:\cpp directory
##########################
a2.cpp :

#include <iostream>

using namespace std;

int main(void) {
int j = 10;
j = j + 32; // a desired breakpoint
cout << "Hello Eclipsers, the answer is : " << j << endl;
return 0;
}
#####################################
built in a makefile which does this :

mingw32-make -f makefile.debug all
//target = objs debug
g++ -O2 -g -Wall -fmessage-length=0 -c -o a2d.o a2.cpp
//target = exe debug
g++ -o a2d.exe a2d.o

#########################################

index.php/fa/19329/0/

#########################################
debug configuration details :

no arguments, no environment varis, default source and the
gdbinit.txt file is empty.

index.php/fa/19330/0/

index.php/fa/19331/0/

index.php/fa/19332/0/

running this debug config results in an error :

---------------------------------------------------------------------

Failed to execute MI command:
-exec-run
Error message from debugger back end:
The target does not support running in non-stop mode
The target does not support running in non-stop mode .

---------------------------------------------------------------------

In the console frame I have :

--------------------------------------------------------------------

$1 = 0xff
The target endianness is set automatically (currently little endian)

-------------------------------------------------------------------

this is the gdb trace shown in one of the 5 consoles :
-------------------------------------------------------------------
330,315 2-environment-cd E:/cpp/a2
330,323 2^done
330,324 (gdb)
330,324 3-gdb-set breakpoint pending on
330,325 3^done
330,325 (gdb)
330,325 4-gdb-set detach-on-fork on
330,325 4^done
330,325 (gdb)
330,326 5-gdb-set python print-stack none
330,327 5^done
330,327 (gdb)
330,328 6-gdb-set print object on
330,337 6^done
330,337 (gdb)
330,338 7-gdb-set print sevenbit-strings on
330,343 7^done
330,343 (gdb)
330,344 8-gdb-set host-charset UTF-8
330,346 8^done
330,346 (gdb)
330,346 9-gdb-set target-charset WINDOWS-1252
330,349 9^done
330,349 (gdb)
330,350 10-gdb-set target-wide-charset UTF-16
330,350 10^done
330,350 (gdb)
330,350 11source E:\cpp\SF004\src\gdbinit.txt
330,351 &"source E:\\cpp\\SF004\\src\\gdbinit.txt\n"
330,351 11^done
330,351 (gdb)
330,352 12-gdb-set target-async on
330,352 12^done
330,352 (gdb)
330,353 13-gdb-set pagination off
330,353 13^done
330,353 (gdb)
330,354 14-gdb-set non-stop on
330,354 14^done
330,354 (gdb)
330,355 15-gdb-set auto-solib-add on
330,355 15^done
330,355 (gdb)
330,356 16-file-exec-and-symbols --thread-group i1 E:/cpp/a2/a2d.exe
330,360 16^done
330,360 (gdb)
330,360 17-gdb-show --thread-group i1 language
330,361 17^done,value="auto"
330,361 (gdb)
330,361 18-gdb-set --thread-group i1 language c
330,365 18^done
330,365 (gdb)
330,366 19-interpreter-exec --thread-group i1 console "p/x (char)-1"
330,372 ~"$1 = 0xff\n"
330,372 19^done
330,372 (gdb)
330,373 20-data-evaluate-expression --thread-group i1 "sizeof (void*)"
330,373 20^done,value="4"
330,373 (gdb)
330,374 21-gdb-set --thread-group i1 language auto
330,374 21^done
330,374 (gdb)
330,374 22-interpreter-exec --thread-group i1 console "show endian"
330,374 ~"The target endianness is set automatically (currently little endian)\n"
330,374 22^done
330,374 (gdb)
330,378 23-list-thread-groups
330,386 23^done,groups=[{id="i1",type="process",executable="E:/cpp/a2/a2d.exe"}]
330,386 (gdb)
330,386 24-break-insert -f E:\\cpp\\a2\\a2.cpp:15
330,389 24^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x004037b6",func="m\
ain()",file="a2.cpp",fullname="E:\\cpp\\a2\\a2.cpp",line="15",thread-groups=["i1"],times="0",origina\
l-location="E:\\\\cpp\\\\a2\\\\a2.cpp:15"}
330,389 (gdb)
330,396 25-exec-run --thread-group i1
330,399 25^error,msg="The target does not support running in non-stop mode."
330,399 (gdb)
330,401 26-gdb-exit
330,411 26^exit
-------------------------------------------------------

[Updated on: Wed, 01 October 2014 07:58]

Report message to a moderator

Re: Eclipse debugging a Qt form with strange behaviour [message #1435475 is a reply to message #1435245] Wed, 01 October 2014 14:54 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Thanks for your detailed report. As I said before your gdb version does not support non-stop mode and thus it will not run. You have to disable this option in the Launch Configuration (or get a newer gdb version).

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Eclipse debugging a Qt form with strange behaviour [message #1435985 is a reply to message #1435475] Thu, 02 October 2014 08:10 Go to previous message
Sequoia Tree is currently offline Sequoia TreeFriend
Messages: 28
Registered: August 2014
Junior Member
Congrats Axel !
This hello world example has actually stopped on the breakpoint when I disable the option.
Now I will see if it stops on a breakpoint with all the Qt Forms in place.
Previous Topic:Code analysis issues (unresolved symbols)
Next Topic:No Run button
Goto Forum:
  


Current Time: Fri Oct 04 01:53:28 GMT 2024

Powered by FUDForum. Page generated in 0.04268 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top