Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Acs on December 31, 2005, 10:42:20 pm

Title: Tutorial on the debugger
Post by: Acs on December 31, 2005, 10:42:20 pm
Hey!

Is there any debugger tutorial out therer? I am not new to programming, but I have rarely used a debugger, and never realized a good use for it. So can anyone please explain to me please what is the debugger and if there are any tutorials for codeblocks tutorial, please!!!
Title: Re: Tutorial on the debugger
Post by: thomas on December 31, 2005, 11:17:06 pm
OK, here is your tutorial:

1. Get a recent version of Code::Blocks. Recent means either build your own from HEAD or use a binary snapshot made available by Ceniza or Therion.
2. Make sure you use gdb 6.3, not 5.2. Although 5.2 is the officially "recommended stable" version, it sucks. Code::Blocks is developed for 6.3, and while 5.2 might work, 6.3 will work certainly.
3. Set breakpoints by clicking on the side bar, you will see red dots. Breakpoints inside constructors are not yet supported, except for that, you can do just what you want -- even breakpoints in plugin dlls and system headers work fine.
4. Click on "debug/continue" and lean back. It takes a while to start up (that's normal).
5. Then step or continue or do whatever you want. Move the mouse over a variable to see popup info, or use the symbols tree to the left. In the debugger menu, you have access to a backtrace and the cpu registers (in some submenu, forgot its name). Clicking at a line in the backtrace moves you to that position.
Title: Re: Tutorial on the debugger
Post by: yop on January 01, 2006, 10:26:13 am
So can anyone please explain to me please what is the debugger
To understand what the gdb debugger is/does you can read any of these (http://www.google.com.gr/search?q=debugger+tutorial+gdb) tutorials ;)
Title: Re: Tutorial on the debugger
Post by: Michael on January 01, 2006, 06:36:02 pm
To understand what the gdb debugger is/does you can read any of these (http://www.google.com.gr/search?q=debugger+tutorial+gdb) tutorials ;)

Even if I have used and continue to use GDB, I must admit that some of your tutorials were useful for me too :D.

Michael
Title: Re: Tutorial on the debugger
Post by: yop on January 01, 2006, 06:48:43 pm
Even if I have used and continue to use GDB, I must admit that some of your tutorials were useful for me too :D.

To be honest me to :lol:
Title: Re: Tutorial on the debugger
Post by: Game_Ender on January 06, 2006, 06:17:54 am
3. Set breakpoints by clicking on the side bar, you will see red dots. Breakpoints inside constructors are not yet supported, except for that, you can do just what you want -- even breakpoints in plugin dlls and system headers work fine.

There is way to set a break point for a constructor, maybe this should be implemented as a work around if Code::Blocks can figure out that break point is being set in a constructor.  In the GDB command line you can tell it to break on a destructor call by typing "break wxGLCanvas::wxGLCanvas()" for example.  The full constructor signature is needed.  This will drop you into the constructor and you can work from there.  I have done this on Ubuntu 5.10.
Title: Re: Tutorial on the debugger
Post by: mandrav on January 06, 2006, 10:01:56 am
There is way to set a break point for a constructor, maybe this should be implemented as a work around if Code::Blocks can figure out that break point is being set in a constructor.  In the GDB command line you can tell it to break on a destructor call by typing "break wxGLCanvas::wxGLCanvas()" for example.  The full constructor signature is needed.  This will drop you into the constructor and you can work from there.  I have done this on Ubuntu 5.10.

Yes, I know. Actually it was implemented in the previous debugger plugin incarnation but I haven't implemented it in the current plugin.
It will be back though :)