Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: JMP on March 22, 2007, 07:51:38 am

Title: Debugging CB with CB
Post by: JMP on March 22, 2007, 07:51:38 am
Hi, I am new in this forums and, although I have read the messages thoroughly, maybe I have mised this topic.
My cuestion is simple: How can be debugged CB using CB?

Thank you
Title: Re: Debugging CB with CB
Post by: Pecan on March 22, 2007, 01:14:28 pm
Compile CB using a previous nightly or previous SVN version of CB. This creates the .../trunk/src/devel directory.

Run update.bat (MSwindows) or ./update (Linux) to create the .../trunk/src/output directory.

Start CB from the .../trunk/src/output directory. Load the CB project file and hit the debug run button or F8.

Be patient, it sometimes takes awhile for GDB to read all those symbols and start the debugging process.
 
Title: Re: Debugging CB with CB
Post by: JMP on March 22, 2007, 07:46:55 pm
Thank you Pecan,
I have done as you say and now I can run/debug one instance of CB (the debugged instance)from within another one (the debugger instance). In the debugged instance, I load a test project. I can debug this project (set breakpoints) from the debugged instance of CB but I cannot debug this instance of CB (I cannot set breakpoints) from the debugger one. Looks quite quirky. Sorry!
Title: Re: Debugging CB with CB
Post by: thomas on March 22, 2007, 08:31:49 pm
Er... debugging another instance from an instance that is being debugged doesn't make much sense if I'm allowed to say :)
I am not even sure if this is technically possible at all. In any case, it is probably not possible with every debugger, because at least some debuggers use hardware breakpoints and performance counters and such (gdb to my knowledge does not).
Title: Re: Debugging CB with CB
Post by: JMP on March 22, 2007, 09:17:59 pm
Mmmm, really what I want is to debug one instance of CB with another instance of CB. Maybe a different version would do.
I need to run the debugged instance using some test project to edit. Then I track the execution process of this instance of CB (not the test project) from the debugger instance.
My problem is that I cannot set breakpoints in the debugger instance (that is debugging/running the debugged instance) but I can do it in the debugged instance (that is debugging/running the test project).
Is that the right approach?. How do you debug your changes to CB?.
Title: Re: Debugging CB with CB
Post by: thomas on March 23, 2007, 09:14:48 am
Mmmm, really what I want is to debug one instance of CB with another instance of CB. Maybe a different version would do. I need to run the debugged instance using some test project to edit.
This is something I (and many others) do almost every day, and it does not involve any special juju powder.
Compile Code::Blocks as usual and hit the "debug/continue" button. Set/Unset Breakpoints by clicking the margin.
If your debugger is set up correctly, it's really as simple as that.

The three most well-known causes (which you should check) for having problems with breakpoints are:
a) not compiling with debug information
b) compiling with debug information, but stripping the executable
c) setting breakpoints in class constructors

What concerns me is running two debuggers at the same time (and setting breakpoints in both).  This is something I never tried and which I think might possibly not work.
Luckily, unless the debugger is the very thing you want to debug, it isn't necessary, either.