Author Topic: [solved] problem with debugging in CB 10.05 for Windows  (Read 7159 times)

Offline cbuser2

  • Multiple posting newcomer
  • *
  • Posts: 33
[solved] problem with debugging in CB 10.05 for Windows
« on: October 22, 2012, 07:21:02 am »
Hi all. I don't have this problem for CB for linux, only for with CB for Windows. I am using MinGW and gdb.

If I click "start", or "step into", the output window opens and closes immediately, and the debugging session ends. If I set a breakpoint, the watch windows shows that the variables have expected values, so the program is running.

Why does the debugging finish without allow me to participate? Basically the debugging process is just running the program. Once I click "start" or "step into", the debugging ends without any further interaction on my part.

Thanks in advance.
« Last Edit: November 13, 2012, 02:34:54 am by cbuser2 »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: problem with debugging in CB for Windows
« Reply #1 on: October 22, 2012, 07:30:00 am »
Why does the debugging finish without allow me to participate? Basically the debugging process is just running the program. Once I click "start" or "step into", the debugging ends without any further interaction on my part.
This usually happens if you forgot to compile with the -g debug switch, if you additionally enabled optimisations (with some compilers at last), and/or if you stripped the symbols using the -s switch.

Inspect your full compiler log (see my sig) accordingly and post here, if in doubt.
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 cbuser2

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: problem with debugging in CB for Windows
« Reply #2 on: October 23, 2012, 01:23:54 am »
Why does the debugging finish without allow me to participate? Basically the debugging process is just running the program. Once I click "start" or "step into", the debugging ends without any further interaction on my part.
This usually happens if you forgot to compile with the -g debug switch, if you additionally enabled optimisations (with some compilers at last), and/or if you stripped the symbols using the -s switch.

The -g had been set, there were no optimisations, and -s had not been set.

I've read the code blocks wiki, and it says turning on the compiler logging will make Code::Blocks output the exact commands it uses to compile your code. But where is the log stored? I can't find it.

Thank you.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: problem with debugging in CB for Windows
« Reply #3 on: October 23, 2012, 02:00:53 am »
But where is the log stored? I can't find it.

Thank you.

Do a re-build; DO NOT do a build and run.
Then look in the log window.

The tab called "build log" has the build log in it.

F2 toggles the log window on and off.

Tim S.

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 cbuser2

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: problem with debugging in CB for Windows
« Reply #4 on: October 23, 2012, 05:13:57 am »
This is the output from a rebuild. The program doesn't make use of libcurl at all, although the libcurl libraries are linked in the global settings.

Code
-------------- Clean: Debug in test3 ---------------

Cleaned "test3 - Debug"

-------------- Build: Debug in test3 ---------------

mingw32-gcc.exe -Wall  -g  -Wall -g   -IC:\curl-7.28.0\include\curl  -c "C:\Users\thismoment\Documents\c programming\test3\main.c" -o obj\Debug\main.o
mingw32-g++.exe -LC:\curl-7.28.0\lib  -o bin\Debug\test3.exe obj\Debug\main.o    C:\curl-7.28.0\lib\libcurl.a C:\curl-7.28.0\lib\libcurldll.a
Output size is 25.28 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
« Last Edit: October 23, 2012, 05:16:12 am by cbuser2 »

Offline cbuser2

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: problem with debugging in CB for Windows
« Reply #5 on: October 23, 2012, 06:29:40 am »
From the wiki: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks#Use_32bit_CDB_for_32bit_programs_and_64bit_CDB_for_64bit_programs

"It seems that debugging a 32bit program with 64bit CDB doesn't work on Windows 7, but 32bit CDB works perfectly."

If I write a program in CB(in 64 bit Windows 7), is the program 32 bit or 64 bit?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: problem with debugging in CB for Windows
« Reply #6 on: October 23, 2012, 06:41:38 am »
If I write a program in CB(in 64 bit Windows 7), is the program 32 bit or 64 bit?

Depends on the Compiler and the options given to the Compiler.

Tim S.

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 Martin K.

  • Multiple posting newcomer
  • *
  • Posts: 86
Re: problem with debugging in CB for Windows
« Reply #7 on: October 23, 2012, 07:20:34 am »
From the wiki: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks#Use_32bit_CDB_for_32bit_programs_and_64bit_CDB_for_64bit_programs

"It seems that debugging a 32bit program with 64bit CDB doesn't work on Windows 7, but 32bit CDB works perfectly."

If I write a program in CB(in 64 bit Windows 7), is the program 32 bit or 64 bit?

It seems that you are using gcc to compile your programm, so you have to use gdb to debug it.
Your log shows no -g flag for the linker.

Martin

zabzonk

  • Guest
Re: problem with debugging in CB for Windows
« Reply #8 on: October 23, 2012, 10:59:41 am »
Quote
Your log shows no -g flag for the linker.

Possibly because none is required.

Offline cbuser2

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: problem with debugging in CB for Windows
« Reply #9 on: November 13, 2012, 02:33:42 am »
Well, I just installed the 12.11 nightly: http://forums.codeblocks.org/index.php/topic,17070.0.html

And the debugging works fine now. Also installed the TDM-GCC compiler suite for Windows(32-bit(64-bit is experimental)), which includes the gcc and gdb(debugger): http://tdm-gcc.tdragon.net/

Thanks for all the replies. :)
« Last Edit: November 13, 2012, 02:36:56 am by cbuser2 »