Author Topic: Tutorial on the debugger  (Read 9800 times)

Offline Acs

  • Single posting newcomer
  • *
  • Posts: 6
Tutorial on the debugger
« 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!!!

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Tutorial on the debugger
« Reply #1 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Tutorial on the debugger
« Reply #2 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 tutorials ;)
Life would be so much easier if we could just look at the source code.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Tutorial on the debugger
« Reply #3 on: January 01, 2006, 06:36:02 pm »
To understand what the gdb debugger is/does you can read any of these 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

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Tutorial on the debugger
« Reply #4 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:
Life would be so much easier if we could just look at the source code.

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: Tutorial on the debugger
« Reply #5 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.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Tutorial on the debugger
« Reply #6 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 :)
Be patient!
This bug will be fixed soon...