Code::Blocks Forums

User forums => Help => Topic started by: kamos on January 06, 2008, 06:51:16 pm

Title: Starting debugger: failed
Post by: kamos on January 06, 2008, 06:51:16 pm
Hello.

I'm having some trouble setting up the debugger. I know this kind of problem comes up a lot here, but I'm really lost and I couldn't find a previous topic / wiki page that helped me. This is what I have done:

I've downloaded Code::Blocks rev 4771 and installed MinGW with the Automated MinGW Installer (5.1.3). I have also downloaded GDB 6.6 and copied the package's contents to "c:\MinGW\". The path is set properly and compiling/building works from inside Code::Blocks. The "Toolchain Executables" at "Settings -> Compiler and Debugger Options" are pointing to the correct apps. The build target has the -g (Produce Debugging Symbols) flag set.

This is the output from building:
Code
-------------- Build: Debug in maisum ---------------

g++.exe -Wall -fexceptions  -g  -g    -c D:\teste\maisum\maisum\main.cpp -o obj\Debug\main.o
g++.exe  -o bin\Debug\maisum.exe obj\Debug\main.o   
Output size is 573.67 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

And this is what I get in the Debugger textarea when I run the app through F8:
Code
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: D:\teste\maisum\maisum\
Adding source dir: D:\teste\maisum\maisum\
Adding file: bin\Debug\maisum.exe
Starting debugger:
failed

There is also another tab called "Debugger (Debug)" by the first Debugger tab. It has the following output:
Code
PATH=.;C:\Arquivos de programas\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Arquivos de programas\QuickTime\QTSystem\;c:\Mingw\bin\
Command-line: c:\Mingw\bin -nx -fullname  -quiet -args bin/Debug/maisum.exe
Working dir : D:\teste\maisum\maisum\

The only "strange" thing I have seen is the command-line above: "c:\Mingw\bin -nx -fullname  -quiet -args bin/Debug/maisum.exe"
Shouldn't GDB be there somewhere? (i.e. "c:\Mingw\bin\gdb -nx -fullname  -quiet -args bin/Debug/maisum.exe")
If so, how do I fix it?
If not, what am I missing? Any help is deeply apreciated.   :)
Title: Re: Starting debugger: failed
Post by: Jenna on January 06, 2008, 07:15:00 pm
Can you call gdb.exe from the console (try "gdb --version" and post the output) to verify it works correctly.
If that works, can you post a screenshot of the "Toolchain executables" tab ?

Which OS do you use ?
I had troubles with gdb 6.6 and so I use 6.7 on Windows. But that should not be the problem you have.
Title: Re: Starting debugger: failed
Post by: kamos on January 06, 2008, 07:33:50 pm
Thanks for the swift reply jens.

Here's the output of gdb --version:

Code
C:\>gdb --version
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".

C:\>


And here's the screenshot showing the tab and the browse window showing the executables:

(http://www.digitalpenumbra.com/imagens/imagem.jpg)

I'm running Windows XP SP2.
Title: Re: Starting debugger: failed
Post by: mandrav on January 06, 2008, 08:37:45 pm
Change "Compiler's installation path" from C:\Mingw\bin to C:\Mingw
Title: Re: Starting debugger: failed
Post by: Jenna on January 06, 2008, 09:18:36 pm
Change "Compiler's installation path" from C:\Mingw\bin to C:\Mingw
I tried it on my system (W2K under kvm) and it doesn't matter if the "\bin" is there under "Toolchain executables".
But there is one difference to kamos' installation: he has a "\" in his Path environment-variable after the "c:\MinGW\bin". I have none.
With the trailing backslash in path and the "\bin" in the C::B settings the debugger does not start.
If the trailing backslash in path is missing it works.
Title: Re: Starting debugger: failed
Post by: kamos on January 06, 2008, 09:46:58 pm
Removing the "\bin" from the "Compiler's Installation Directory" works... I have also tested removing the trailing "\" from the path environment variable while keeping the "\bin" and that also makes the debugger run. Right now, I don't understand why is that so, but it WORKS. Thanks a lot.   :D

One odd thing: if I run my app with F8 (debug), it runs twice (that is, after I close it, it restarts).
Title: Re: Starting debugger: failed
Post by: kamos on January 06, 2008, 09:50:20 pm
Well, it was missing after all:

Command-line: c:\Mingw\bin\gdb.exe -nx -fullname  -quiet -args cg.exe

 :)