User forums > Help

Debugger not working

(1/2) > >>

jeqcho:
Hi,

I have been using CodeBlocks for more than a year but I still can't use the debugger. Since it's the new decade I might as well finally solve this for good.
I looked at the -g -s flags, checked the path for spaces and even made a new project to test out debugging, but the debugger is still not working. I tried all I could find on the web.

Here is my debugger logs:

--- Code: ---Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\CodeBlocks_Projects\test-debug-2\
Adding source dir: C:\CodeBlocks_Projects\test-debug-2\
Adding file: C:\CodeBlocks_Projects\test-debug-2\bin\Debug\test-debug-2.exe
Changing directory to: C:/CodeBlocks_Projects/test-debug-2/.
Set variable: PATH=.;C:\cygwin64\bin;C:\cygwin64;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Program Files\Dell\DW WLAN Card;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;c:\Program Files\WIDCOMM\Bluetooth Software;c:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Windows\System32\OpenSSH;C:\go\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Users\Chooi\AppData\Local\Microsoft\WindowsApps;C:\Users\Chooi\go\bin;C:\Users\Chooi\AppData\Roaming\npm;C:\Program Files\Sublime Text 3;C:\Users\Chooi\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Chooi\AppData\Local\Programs\Python\Python37-32;C:\Users\Chooi\AppData\Local\Programs\Python\Python37-32\Scripts;C:\nuke

[debug]Command-line: C:\CodeBlocks\MinGW\bin\gdb32.exe -nx -fullname -quiet  -args C:/CodeBlocks_Projects/test-debug-2/bin/Debug/test-debug-2.exe
[debug]Working dir : C:\CodeBlocks_Projects\test-debug-2

Starting debugger: C:\CodeBlocks\MinGW\bin\gdb32.exe -nx -fullname -quiet  -args C:/CodeBlocks_Projects/test-debug-2/bin/Debug/test-debug-2.exe
done

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

Setting breakpoints

[debug]"C:/CodeBlocks_Projects/test-debug-2/bin/Debug/test-debug-2.exe": not in executable format: File format not recognized
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.9.1
[debug]Copyright (C) 2015 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]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 7.9.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 200
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> directory C:/CodeBlocks_Projects/test-debug-2/
[debug]Source directories searched: C:/CodeBlocks_Projects/test-debug-2;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/CodeBlocks_Projects/test-debug-2/Untitled2.cpp:44"
[debug]No symbol table is loaded.  Use the "file" command.
[debug]Breakpoint 2 ("C:/CodeBlocks_Projects/test-debug-2/Untitled2.cpp:44") 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
--- End code ---

Help is very much appreciated. Thanks!

stahta01:

--- Quote ----g -s flags
--- End quote ---

You made sure the -g flag was set, correct?
You made sure the -s flag was *not* set, correct?

Edit: What compiler was used to build your project? 64 bit or 32 bit?
What debugger are you trying to use to debug your project? 64 bit or 32 bit?

Edit2: What code::blocks version? Is it 32 bit or 64 bit?
Code::Blocks nightly are 64 bit; otherwise the windows builds are 32 bit.

Tim S.

stahta01:
To debug an exe created by CygWin 64 bit it is suggested to use MinGW gdb 64 bit.

The IDE needs to be 64 bit when you use an 64 bit debugger to have full functionally.

NOTE: The above is from reading the posts on this website; it is not been confirmed as true by me.

Tim S.


jeqcho:
Thanks for replying. I rechecked that the -g flag is set and the -s flag is not set.
Compiler: Cygwin 64bit
Debugger: The default in CodeBlocks MinGW (which I see it as gdb32.exe)

CodeBlocks version is 32 bit.

Is the solution to download gdb 64?

stahta01:

--- Quote from: jeqcho on January 18, 2020, 06:27:15 am ---Thanks for replying. I rechecked that the -g flag is set and the -s flag is not set.
Compiler: Cygwin 64bit
Debugger: The default in CodeBlocks MinGW (which I see it as gdb32.exe)

CodeBlocks version is 32 bit.

Is the solution to download gdb 64?

--- End quote ---

If you wish to debug an 64 bit app you must use an 64 bit debugger!

Edit: You can try the 64 bit gdb from Cygwin; but, I heard it does not work with Code::Blocks.
You might try the Cygwin mingw64 gdb and see if that works.

Edit2: You could build an 32 bit Cygwin app, instead.
You could build an mingw gcc app instead.

Tim S.

Navigation

[0] Message Index

[#] Next page

Go to full version