Author Topic: Debugging CB with CB  (Read 5443 times)

Offline JMP

  • Multiple posting newcomer
  • *
  • Posts: 11
Debugging CB with CB
« 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

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2813
Re: Debugging CB with CB
« Reply #1 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.
 

Offline JMP

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugging CB with CB
« Reply #2 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!

Offline thomas

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

Offline JMP

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Debugging CB with CB
« Reply #4 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?.

Offline thomas

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