Author Topic: Toolchain executables: correct, but unable to debug  (Read 16467 times)

Offline ParanoidAndroid

  • Single posting newcomer
  • *
  • Posts: 5
Toolchain executables: correct, but unable to debug
« on: August 04, 2009, 10:31:04 pm »
Hi all, posting on here is my last resort, right before I give up :( I have searched all day and tried all sorts but still haven’t got anywhere. My problem is that I cannot get the CodeBlocks to debug anything.

I have MinGW installed, and gdb.exe is as it should be, in the bin folder of MinGW. The ‘Toolchain executables’ tab of the ‘Global compiler settings’ includes the correct path to MinGW (C:\CodeBlocks\MinGW) and gdb.exe is in C:\CodeBlocks\MinGW\bin.
Every time I try to run the debugger I get the message:

---------------------------
Error
---------------------------
The debugger executable is not set.
To set it, go to "Settings/Compiler and debugger", switch to the "Programs" tab,
and select the debugger program.
---------------------------
OK  
---------------------------

Obviously, the problem is that I know it is set, and I know the path is correct and that the file does indeed exist.

I’m creating a small game in Allegro and I am fairly new to all this, though I have dabbled in C some years ago. Allegro is set up and working fine, the game compiles and runs perfectly; it’s just that without a working method of debugging I feel there is no point continuing as I know that at some point I’m going to need it :(

I’m using:

Windows XP Pro
CodeBlocks 8.02 (Built Feb 27 2008)

Any help would be most welcome! And sorry if this is covered somewhere else, I’ve searched the forums etc and searched the web but haven’t found a solution all day.
Thanks

Addition
----------
.. just in case it's useful, the output in the debugger window when I try and debug is:

Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Aborted

... error message (as above) also displayed
« Last Edit: August 04, 2009, 11:07:05 pm by ParanoidAndroid »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5493
Re: Toolchain executables: correct, but unable to debug
« Reply #1 on: August 04, 2009, 10:43:32 pm »
just to be sure :  ............; C:\CodeBlocks\MinGW - where dbg.exe is located).

you mean gdb.exe right ???

Offline ParanoidAndroid

  • Single posting newcomer
  • *
  • Posts: 5
Re: Toolchain executables: correct, but unable to debug
« Reply #2 on: August 04, 2009, 11:00:20 pm »
Yeah, gdb.exe. Just a typo in my post above. I most definately have got gdb.exe in the Debugger field.... just checked again to make sure! Thanks


Offline ParanoidAndroid

  • Single posting newcomer
  • *
  • Posts: 5
Re: Toolchain executables: correct, but unable to debug
« Reply #3 on: August 05, 2009, 01:42:07 am »
Just in-case... I'm off to sunny (I'm hoping) Cornwall in southern England tomorrow, for a week. So if I suddenly seem to dissapear I'm not being rude. If I can't get this problem sorted out in the morning sometime, I'll have another go when I get back :) Cheers.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Toolchain executables: correct, but unable to debug
« Reply #4 on: August 05, 2009, 07:07:25 am »
Yeah, gdb.exe. Just a typo in my post above. I most definately have got gdb.exe in the Debugger field.... just checked again to make sure!
Notice that the debugger does not ship with the usual GCC distro but has to be installed separately. So if you installed the GCC/G++ package from MinGW.org you did *not* install the debugger yet. Are you 100% sure that in the folder C:\CodeBlocks\MinGW\bin there is really the executable "gdb.exe"? And are you 100% sure that for your project *and* target(s) you are using exactly the compiler you've setup?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5493
Re: Toolchain executables: correct, but unable to debug
« Reply #5 on: August 05, 2009, 08:55:29 am »
could you post the contents of your project file (the .cbp file that is) ?
And could you post a snippet from your default.conf [that's the Code::Blocks configuration file], inside this big file you will find a section compilers, within that section a section gcc, post here the entire stuff in that gcc section ?

Offline ParanoidAndroid

  • Single posting newcomer
  • *
  • Posts: 5
Re: Toolchain executables: correct, but unable to debug
« Reply #6 on: August 05, 2009, 12:45:04 pm »
Here's all the info that you wanted, except that you may be on to something as there is no default.conf file within the Codeblocks directory structure (or in MINGW directories)... I also noticed that I had Microsoft Visual C++ 2005/2008 selected as the compilier and not CNU GCC Compilier. Now the game doesnt compile, but I feel I may be on the right track?

New build output...
-------------- Build: Debug in skeleton ---------------

Compiling: main.cpp
mingw32-g++.exe: /W3: No such file or directory
mingw32-g++.exe: /Zi: No such file or directory
mingw32-g++.exe: /D_DEBUG: No such file or directory
mingw32-g++.exe: /Zi: No such file or directory
mingw32-g++.exe: /D_DEBUG: No such file or directory
mingw32-g++.exe: CreateProcess: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

/////////////////////////////////////////////////////////////////////
// PROJECT FILE
////////////////////////////////////////////////////////////////////
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
   <FileVersion major="1" minor="6" />
   <Project>
      <Option title="skeleton" />
      <Option pch_mode="2" />
      <Option compiler="gcc" />
      <Build>
         <Target title="Debug">
            <Option output="bin\Debug\skeleton" prefix_auto="1" extension_auto="1" />
            <Option object_output="obj\Debug\" />
            <Option type="1" />
            <Option compiler="gcc" />
            <Compiler>
               <Add option="/Zi /D_DEBUG" />
               <Add option="/Zi" />
               <Add option="/D_DEBUG" />
            </Compiler>
            <Linker>
               <Add option="/DEBUG" />
               <Add library="alleg" />
            </Linker>
         </Target>
         <Target title="Release">
            <Option output="bin\Release\skeleton" prefix_auto="1" extension_auto="1" />
            <Option object_output="obj\Release\" />
            <Option type="1" />
            <Option compiler="gcc" />
            <Compiler>
               <Add option="/Ox" />
               <Add option="/DNDEBUG" />
            </Compiler>
            <Linker>
               <Add library="alleg" />
            </Linker>
         </Target>
      </Build>
      <Compiler>
         <Add option="/W3" />
      </Compiler>
      <Linker>
         <Add library="alleg" />
      </Linker>
      <Unit filename="gameData.h" />
      <Unit filename="geoClass.cpp" />
      <Unit filename="geoClass.h" />
      <Unit filename="hardcoded.h" />
      <Unit filename="loadData.h" />
      <Unit filename="main.cpp" />
      <Unit filename="main.h" />
      <Unit filename="messageClass.cpp" />
      <Unit filename="messageClass.h" />
      <Unit filename="renderClass.cpp" />
      <Unit filename="renderClass.h" />
      <Unit filename="setup.h" />
      <Unit filename="skeleton.layout" />
      <Unit filename="soundClass.cpp" />
      <Unit filename="soundClass.h" />
      <Unit filename="spriteClass.cpp" />
      <Unit filename="spriteClass.h" />
      <Unit filename="spriteHandler.h" />
      <Unit filename="spritehandler.cpp" />
      <Extensions>
         <code_completion />
         <debugger />
      </Extensions>
   </Project>
</CodeBlocks_project_file>





Sorry this is kind of a rushed reply, but I'm having to juggle this with packing the car for the holiday and the wife shouting at me ;)
Thanks for the help guys!

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5493
Re: Toolchain executables: correct, but unable to debug
« Reply #7 on: August 05, 2009, 12:51:14 pm »
As for the fact it does not compile now, that's normal you are specifying MS compiler options to GCC :

Code
               <Add option="/Zi /D_DEBUG" />
               <Add option="/Zi" />
               <Add option="/D_DEBUG" />

               <Add option="/DEBUG" />

               <Add option="/Ox" />
               <Add option="/DNDEBUG" />

         <Add option="/W3" />

Tip : just create in CB a new console project, and then have a look at the cbp on which compiler options to activate: Purely -g -o2 etc ..


So your mix of Ms compiler (which wants another debugger) and gdb.exe could explain why you could not debug.

Offline ParanoidAndroid

  • Single posting newcomer
  • *
  • Posts: 5
Re: Toolchain executables: correct, but unable to debug
« Reply #8 on: August 05, 2009, 01:24:56 pm »
So very close now I think!....
I'm just not sure about this one :(

-------------- Build: Debug in skel ---------------

Compiling: main.cpp
mingw32-g++.exe: CreateProcess: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings


///////////////////////////////////////////////////////////////
Project File Contents

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
   <FileVersion major="1" minor="6" />
   <Project>
      <Option title="skel" />
      <Option pch_mode="2" />
      <Option compiler="gcc" />
      <Build>
         <Target title="Debug">
            <Option output="bin\Debug\skel" prefix_auto="1" extension_auto="1" />
            <Option object_output="obj\Debug\" />
            <Option type="1" />
            <Option compiler="gcc" />
            <Compiler>
               <Add option="-g" />
            </Compiler>
            <Linker>
               <Add library="alleg" />
            </Linker>
         </Target>
         <Target title="Release">
            <Option output="bin\Release\skel" prefix_auto="1" extension_auto="1" />
            <Option object_output="obj\Release\" />
            <Option type="1" />
            <Option compiler="gcc" />
            <Compiler>
               <Add option="-O2" />
            </Compiler>
            <Linker>
               <Add option="-s" />
               <Add library="alleg" />
            </Linker>
         </Target>
      </Build>
      <Compiler>
         <Add option="-Wall" />
         <Add option="-fexceptions" />
      </Compiler>
      <Linker>
         <Add library="alleg" />
      </Linker>
      <Unit filename="gameData.h" />
      <Unit filename="geoClass.cpp" />
      <Unit filename="geoClass.h" />
      <Unit filename="hardcoded.h" />
      <Unit filename="loadData.h" />
      <Unit filename="main.cpp" />
      <Unit filename="main.h" />
      <Unit filename="messageClass.cpp" />
      <Unit filename="messageClass.h" />
      <Unit filename="renderClass.cpp" />
      <Unit filename="renderClass.h" />
      <Unit filename="setup.h" />
      <Unit filename="skeleton.cbp" />
      <Unit filename="soundClass.cpp" />
      <Unit filename="soundClass.h" />
      <Unit filename="spriteClass.cpp" />
      <Unit filename="spriteClass.h" />
      <Unit filename="spriteHandler.h" />
      <Unit filename="spritehandler.cpp" />
      <Unit filename="textClass.cpp" />
      <Unit filename="textClass.h" />
      <Extensions>
         <code_completion />
         <debugger />
      </Extensions>
   </Project>
</CodeBlocks_project_file>

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Toolchain executables: correct, but unable to debug
« Reply #9 on: August 05, 2009, 04:46:01 pm »
mingw32-g++.exe: CreateProcess: No such file or directory
Search the forums.
You are on Vista and need to update the tool chain. When 08/02 came out the gcc 3.4.5 - 3 (vista special) was not available. This is a known bug on Vista for the compiler version that ships with 08/02.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Toolchain executables: correct, but unable to debug
« Reply #10 on: August 05, 2009, 05:44:47 pm »
@ParanoidAndroid
From your screen shot, I can see you MinGW was too old (date : 2004-XX-XXX)
I suggest use a recent TDM-GCC and nightly build CB, and forget the old versions.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.