Author Topic: Can't debug with CodeBlocks  (Read 14566 times)

realruntime

  • Guest
Can't debug with CodeBlocks
« on: August 27, 2005, 10:24:36 pm »
Hello,
       I tried to debug using CodeBlocks but I didn't know how and I didn't find any resource to debug with gdb.
Thanks,
Mustafa ELBanna

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Can't debug with CodeBlocks
« Reply #1 on: August 27, 2005, 10:51:24 pm »
Um... currently it's a bit complicated. See, the debug button just runs the program unless you have set breakpoints before.

This is fixed in CVS, where you can just advance one line and start debugging from there.

Anyway, to debug your program in codeblocks, make sure you compile with the "produce debugging symbols" option, and you can use the "run to this line" button to start debugging.

Good luck! :)

realruntime

  • Guest
Re: Can't debug with CodeBlocks
« Reply #2 on: August 29, 2005, 10:11:56 am »
Hello,
       Thanks, But I did this before I post and it didn't work. after choosing produce debugging symbols option. then try to make a break poing and debug using gdb, this message appears The project/Target has no debugging info. Please change this in the project's build options and retry...
        Waiting for help.
Thanks,
Mustafa ELBanna

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Can't debug with CodeBlocks
« Reply #3 on: August 29, 2005, 02:00:53 pm »
Hello,
       Thanks, But I did this before I post and it didn't work. after choosing produce debugging symbols option. then try to make a break poing and debug using gdb, this message appears The project/Target has no debugging info. Please change this in the project's build options and retry...
        Waiting for help.
Did you recompile (ie Compile -> Rebuild or just Ctrl-F11) after setting that option? Just setting it doesn't magically add debugging symbols to already compiled binaries, I'm afraid ;).

Maybe that message should be clearer about what "retry" in this case is, as it isn't just trying to debug again.

realruntime

  • Guest
Re: Can't debug with CodeBlocks
« Reply #4 on: August 29, 2005, 02:10:49 pm »
Hello,
      I sure rebuild the app. after changing the option but it doesn't really works and the message appears again. and the GDB debugger generate this message:
"No symbol table is loaded.  Use the "file" command.
error"

Thanks,
Mustafa ELBanna

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Can't debug with CodeBlocks
« Reply #5 on: August 29, 2005, 02:52:42 pm »
Wait, what compiler are you using? Compilers other than MinGW/GCC (depending on whether you're using Windows or Linux/Unix) may not be supported by the GDB debugger...
For other compilers you may have to use an external debugger or wait until Code::Blocks supports more debuggers :(.
Well, that or switch compilers, ofcourse :mrgreen:.

realruntime

  • Guest
Re: Can't debug with CodeBlocks
« Reply #6 on: August 29, 2005, 03:09:13 pm »
Hello,
      Thanks, I really Microsoft C++ 2003 compiler so it appears that it's not compatible with gdb. can you tell me what debugger can I use now with MS compiler?!
Thanks,
Mustafa ELBanna

grv575

  • Guest
Re: Can't debug with CodeBlocks
« Reply #7 on: August 29, 2005, 03:23:58 pm »
download the platform sdk.
make sure produce debugging symbols is checked
add /debug to extra link options :\
rebuild
psdk->install debugging tools for windows
debug with windbg
this gives you source level debugging.
windbg tutorial here: http://www.codeproject.com/debug/windbg_part1.asp

realruntime

  • Guest
Re: Can't debug with CodeBlocks
« Reply #8 on: August 29, 2005, 03:38:52 pm »
Hello,
      Command window of WinDbg opens and this message generates for me
"Could not create process 'w -annotate=2 -silent', Win32 error 2
The system cannot find the file specified"

!!??
Thanks,
Mustafa ELBanna

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Can't debug with CodeBlocks
« Reply #9 on: August 29, 2005, 07:06:18 pm »
Hello,
      Thanks, I really Microsoft C++ 2003 compiler so it appears that it's not compatible with gdb.

 :roll: Why, oh why, didn't we add a "Debugging is only supported for GCC and compatibles" message?

realruntime

  • Guest
Re: Can't debug with CodeBlocks
« Reply #10 on: August 29, 2005, 07:15:54 pm »
Hello,
       I'm sorry but when I use GCC with DirectX it generate linking error and when I use the same options with MS C++ it builds successfully. So I use MS.
Thanks,
Mustafa ELBanna

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Can't debug with CodeBlocks
« Reply #11 on: August 29, 2005, 07:55:06 pm »
That's because it uses the precompiled libs shipping with your version of the compiler. You should expect that using an MS API would rely on the MS tools...
Life would be so much easier if we could just look at the source code.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Can't debug with CodeBlocks
« Reply #12 on: August 29, 2005, 08:41:42 pm »
A little off-topic, but this might help...

http://mywebpage.netscape.com/PtrPck/progtopics.htm
http://www.spacejack.org/games/mingw/mingw-dx.html

Tells how to link DirectX with GCC programs...
(All hail Google! :P )

grv575

  • Guest
Re: Can't debug with CodeBlocks
« Reply #13 on: August 29, 2005, 09:50:39 pm »
So it looks like mingw can just use standard .lib files as well (in addition to the included .a files).  Didn't look like it was too difficult to get mingw gcc & directx working.

realruntime

  • Guest
Re: Can't debug with CodeBlocks
« Reply #14 on: August 29, 2005, 10:12:15 pm »
Hello,
       really don't understand you, besides that is the a files related to linux??
Thanks,
Mustafa ELBanna