News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Debugging CB with CB

Started by JMP, March 22, 2007, 07:51:38 AM

Previous topic - Next topic

JMP

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

Pecan

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.

JMP

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!

thomas

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).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

JMP

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?.

thomas

Quote from: 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.
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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."