Author Topic: How do I use the mingw64 gdb debugger?  (Read 12472 times)

Offline lucky7456969

  • Multiple posting newcomer
  • *
  • Posts: 33
How do I use the mingw64 gdb debugger?
« on: April 06, 2014, 06:41:51 am »
Hello,
I wonder how do I use the mingw64 gdb debugger instead of the
mingw32 provided by the codeblocks package.

I start up a debuggee, and it goes away immediately. I point to the C:\mingw64\bin\gdb.exe in the debugger
setting menu. The program runs fine, but I just can't make it stop at the breakpoints.
Thanks
Jack

Code
[debug]Starting program:  
[debug]>>>>>>cb_gdb:

Starting the debuggee failed: No executable specified, use `target exec'.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How do I use the mingw64 gdb debugger?
« Reply #1 on: April 06, 2014, 02:37:48 pm »
Do you have a project?
And post the full log from the debugger please.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline lucky7456969

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: How do I use the mingw64 gdb debugger?
« Reply #2 on: April 06, 2014, 08:04:54 pm »
Where can I find such files? I have enable full logging,
but there isn't any .log file existed in my project folder.
Thanks
Jack

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How do I use the mingw64 gdb debugger?
« Reply #3 on: April 06, 2014, 08:21:29 pm »
Log and Others -> Debugger -> Right click -> Copy to clipboard
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline lucky7456969

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: How do I use the mingw64 gdb debugger?
« Reply #4 on: April 06, 2014, 09:32:24 pm »
Thanks for helping!
Jack

Code
Build started on: 07-04-2014 at 03:30.44
Build ended on: 07-04-2014 at 03:30.47

-------------- Build: Debug in PerfectSim (compiler: mingw64 - nonunicode)---------------
x86_64-w64-mingw32-g++.exe -Wall -g -g -Wall -g -IE:\Software\Q\qt-4.7.4\4.7.4-qt-x64\include -IE:\Software\Q\qt-4.7.4\4.7.4-qt-x64\include\QtGui -c "E:\Jacky\Documents\Code Blocks Projects\PerfectSim\Camera\Camera.cpp" -o obj\Debug\Camera\Camera.o
x86_64-w64-mingw32-g++.exe -Wall -g -g -Wall -g -IE:\Software\Q\qt-4.7.4\4.7.4-qt-x64\include -IE:\Software\Q\qt-4.7.4\4.7.4-qt-x64\include\QtGui -c "E:\Jacky\Documents\Code Blocks Projects\PerfectSim\main.cpp" -o obj\Debug\main.o
x86_64-w64-mingw32-g++.exe -Wall -g -g -Wall -g -IE:\Software\Q\qt-4.7.4\4.7.4-qt-x64\include -IE:\Software\Q\qt-4.7.4\4.7.4-qt-x64\include\QtGui -c "E:\Jacky\Documents\Code Blocks Projects\PerfectSim\OpenGLWidget.cpp" -o obj\Debug\OpenGLWidget.o
x86_64-w64-mingw32-g++.exe -LE:\Software\Q\qt-4.7.4\4.7.4-qt-x64\lib -o bin\Debug\PerfectSim.exe obj\Debug\Camera\Camera.o obj\Debug\main.o obj\Debug\OpenGLWidget.o -lQtCore4 -lQtGui4 "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64\d3dx9d.lib" E:\Software\Q\qt-4.7.4\4.7.4-qt-x64\lib\libQtCored4.a E:\Software\Q\qt-4.7.4\4.7.4-qt-x64\lib\libQtGuid4.a E:\Software\Q\qt-4.7.4\4.7.4-qt-x64\lib\libQtHelpd4.a E:\Software\Q\qt-4.7.4\4.7.4-qt-x64\lib\libqtmaind.a D:\mingw64\x86_64-w64-mingw32\lib\libuser32.a D:\mingw64\x86_64-w64-mingw32\lib\libkernel32.a D:\mingw64\x86_64-w64-mingw32\lib\libgdi32.a D:\mingw64\x86_64-w64-mingw32\lib\libgdiplus.a D:\mingw64\x86_64-w64-mingw32\lib\libd3dx9.a -mwindows
Output file is bin\Debug\PerfectSim.exe with size 549.12 KB
Process terminated with status 0 (0 minute(s), 2 second(s))
0 error(s), 0 warning(s) (0 minute(s), 2 second(s))

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: How do I use the mingw64 gdb debugger?
« Reply #5 on: April 06, 2014, 10:21:04 pm »
this is the build log, not the debugger log

you have to start the debugger and then copy the text from the debugger tab  from the bottom of the window

Offline lucky7456969

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: How do I use the mingw64 gdb debugger?
« Reply #6 on: April 06, 2014, 10:25:10 pm »
Code
[debug]Command-line: C:\Program Files (x86)\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args E:/Jacky/DOCUME~1/CODEBL~1/PERFEC~1/bin/Debug/PERFEC~1.EXE
[debug]Working dir : E:\Jacky\DOCUME~1\CODEBL~1\PERFEC~1

Starting debugger: C:\Program Files (x86)\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args E:/Jacky/DOCUME~1/CODEBL~1/PERFEC~1/bin/Debug/PERFEC~1.EXE
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]"E:/Jacky/DOCUME~1/CODEBL~1/PERFEC~1/bin/Debug/PERFEC~1.EXE": not in executable format: File format not recognized
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.6.1
[debug]Copyright (C) 2013 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "mingw32".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 7.6.1

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]No symbol table is loaded.  Use the "file" command.
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\Program Files (x86)\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory D:/mingw64/bin
[debug]Source directories searched: D:/mingw64/bin;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> directory E:/Jacky/DOCUME~1/CODEBL~1/PERFEC~1/
[debug]Source directories searched: E:/Jacky/DOCUME~1/CODEBL~1/PERFEC~1;D:/mingw64/bin;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "E:/Jacky/Documents/Code Blocks Projects/PerfectSim/main.cpp:7"
[debug]No symbol table is loaded.  Use the "file" command.
[debug]Breakpoint 2 ("E:/Jacky/Documents/Code Blocks Projects/PerfectSim/main.cpp:7") pending.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]No executable specified, use `target exec'.
[debug]Starting program: 
[debug]>>>>>>cb_gdb:

Starting the debuggee failed: No executable specified, use `target exec'.

[debug]> quit

Debugger finished with status 0

Offline lucky7456969

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: How do I use the mingw64 gdb debugger?
« Reply #7 on: April 06, 2014, 11:52:43 pm »
I discovered the cause, due to wrong debugger setting, should be using X:\mingw64\bin\gdb.exe
However, I wonder can I designate different debuggers to different compilers?
Thanks
Jack

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How do I use the mingw64 gdb debugger?
« Reply #8 on: April 07, 2014, 12:16:22 am »
Yes, you can.

Steps:
1. Make two or more configs
2. In the toolchain settings of the compiler choose the proper config for every compiler
3. Select Debug-> Active debugger -> Target's default
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]