Author Topic: Unable to debug with Visual C++ 2008 Express  (Read 27758 times)

Offline skywriter

  • Single posting newcomer
  • *
  • Posts: 6
Unable to debug with Visual C++ 2008 Express
« on: May 19, 2008, 01:19:33 pm »
I use Code::Blocks 8.02 under WinXP.
I've got MS Visual Studio 2008 Express (VC++ 9.0) installed.
I adjusted Code::Block to use Microsoft Visual C++ 2005/2008 compiler.
But when i try to debug project it says "The debugger executable is not set".
I obtained that Code::Blocks is adjusted for using "cdb.exe" as debugger.
But there is no such file in my system!
At the same time MS Visual Studio starts debug OK.
What application should i set up as debug tool?

Offline pir

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Unable to debug with Visual C++ 2008 Express
« Reply #1 on: May 19, 2008, 04:22:48 pm »
I have the same problem and was searching the CodeBlocks Wiki for an answer...

It appears that you have to download the debugging tools for Visual C++ separately - see

http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx#a

Seems a bit like car with optional steering wheel... but with MinGW, you have to download gdb separately as well!

Haven't got round to trying it yet as my PC has decided to download XP SP3....

Pls. post if you get it working.

pir

Offline pir

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Unable to debug with Visual C++ 2008 Express
« Reply #2 on: May 19, 2008, 04:27:59 pm »
PS - Anybody who knows what they are doing with a Wiki able to modify the links to the MS compilers? The current ones are not correct. Maybe also put a note on where to find the debugging tools...

pir

Offline pir

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Unable to debug with Visual C++ 2008 Express
« Reply #3 on: May 19, 2008, 05:12:40 pm »
Right then!

I have installed the debugging tools. (You need to specify the install path - C:/Program Files/Debugging Tools for Windows - on the "Additional Paths" tab where the toolchain executables are specified in CodeBlocks. The debugger starts but then immediately caves in with a "Symbol file could not be found" error! Basically it is looking for a *.pdb file which presumably cdb can't find because it is looking in it's local directory.

Any ideas?

(See http://msdn.microsoft.com/en-us/library/aa139733.aspx for further information on the Windows debuggers.)

pir

Offline pir

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Unable to debug with Visual C++ 2008 Express
« Reply #4 on: May 21, 2008, 09:47:57 am »
I give up! Setting the debugger output to verbose, I can see that the project path, etc. are all being passed to cdb. Also, it seems to be looking in the right place for the 'missing' symbol file (vc90.pdb) but cannot find it. I have even tried explicitly telling the debugger where to find the .pdb file via an initial command. I conclude there is some 'feature' of the way cdb is being spawned from within CodeBlocks that is causing the problem. If anyone has any insight into how this happens, please share!

Meantime, guess I need to debug this one-off project (that uses a precomplied DLL) with print statements and go back to MinGW...

pir

lingol

  • Guest
Re: Unable to debug with Visual C++ 2008 Express
« Reply #5 on: June 28, 2008, 05:55:01 am »
Hei, guids, I have the same problem and try to solve it the whole morning. Now I guess I find out an way to avoid the annoying ERROR
"*** ERROR: Symbol file could not be found. Defaulted to export symbols for ntdll.dll -".

If you use CDB.EXE in the commandline without any parameters, it will print many useful informations, one of which is

Environment Variables:

    _NT_SYMBOL_PATH=[Drive:][Path]
        Specify symbol image path.


Now you can add the environment variable _NT_SYMBOL_PATH with value :

SRV*C:\MyLocalSymbols*http://msdl.microsoft.com/download/symbols

Here the folder C:\MyLocalSymbols is used by CDB.EXE to download symbols from Internet, you can change it to any other locations as you wish.
If you think it terrible to wait for downloading necessary symbols when you are debugging. You can download all symle packages once and install and set the install folder to the environment variable _NT_SYMBOL_PATH. The download link is http://www.microsoft.com/whdc/devtools/debugging/symbolpkg.mspx.
Have fun with CodeBlocks!
« Last Edit: June 28, 2008, 05:57:37 am by lingol »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Unable to debug with Visual C++ 2008 Express
« Reply #6 on: July 08, 2008, 05:25:44 am »
« Last Edit: July 08, 2008, 05:37:10 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline andwan0

  • Single posting newcomer
  • *
  • Posts: 7
Re: Unable to debug with Visual C++ 2008 Express
« Reply #7 on: March 26, 2009, 05:54:07 pm »
So did this solve? Can you now debug?

Offline photon3108

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: Unable to debug with Visual C++ 2008 Express
« Reply #8 on: August 10, 2009, 05:31:12 am »
I tried to debug with cdb.exe in codeblocks but it doesn't work.

First step:
I have installed Codeblock v5716, visual c++ express 2008, Debugging Tools for Windows 32-bit Version. And set environment variable _NT_SYMBOL_PATH with
SRV*C:\MyLocalSymbols*http://msdl.microsoft.com/download/symbols.

Second step:
I add the path, C:\Program Files\Debugging Tools for Windows (x86), and Codeblocks can find cdb.exe.

Third step:
I create a default Helloworld project and add getchar() after the cout. Select Debug target and build test.exe.
( Because breakpoint does'nt work now for cdb.exe in Codeblocks, I use getchar(). )

Forth step:
[Debug]-->[Start(F8)] and Debugger said "*** WARNING: Unable to verify checksum for test.exe".


There was not any console. It looked like work because cdb.exe and test.exe run in the memory.

If I run it handily in the windows console,
C:\Program Files\Debugging Tools for Windows (x86)>cdb C:\test\bin\Debug\test.exe and use "g" command to
continue, it has the
same problem, no console. After finding the relational argument "-2", I tried to run C:\~>cdb -2 C:\~\test.exe.
The result is different. The console for test.exe is open.

cdb.exe and WinDbg are really not convenient. I like Codeblocks more. How to solve codeblocks has no console and breakpoint is down?

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Unable to debug with Visual C++ 2008 Express
« Reply #9 on: August 12, 2009, 04:24:00 pm »
Hi, I use MS compiler on windows as well, exactly because the debugging features are very good.

Unfortunately, the only way I have found to be able to debug code written in Code::Blocks is to use the integrated debugger in the Visual Studio IDE..., but fortunaetly it is quite easy to write an entry in the Code::Blocks Tools menu that will launch the VS IDE for debugging, complete with source files etc.

See this old thread for details.
http://forums.codeblocks.org/index.php/topic,6419.0.html

On Linux I use GCC with the same project, but I feel my hands are completely tied wrt. debugging. Is there somewhere a "hold my hand" tutorial on how to do debugging in Code::Blocks under Linux?