Monday, October 19, 2009

Breakpoint Woes

I am having some serious breakpoint woes with Qt Creator 1.2.92 at the moment. Breakpoints work fine the first time I set them, but once the application has been terminated, attempting to add/remove breakpoints will fail and they are never triggered. This is driving me nuts and only a restart of Qt Creator seems to fix it.


Reproducing this problem is easy.
  1. Fire up Qt Creator and create a new Qt4 Console Application project.
  2. In main() set a breakpoint on the first line of code.
  3. Hit F5 to debug. The breakpoint is triggered.
  4. Quit the application, then set a new breakpoint, or remove the existing one and set it again.
  5. Hit F5 to debug. The breakpoint won't be triggered.
It looks like the second time gdb is started you can only set breakpoints once the application is being debugged. This is all well and good for a GUI app where you may have the opportunity to toggle the breakpoint as your app is running, but for applications such as unit test projects, you don't have time to do this before the application quits!

I find it hard to believe that something so fundamental is broken so if anyone has any hints, I'll be grateful. FWIW I am using the version of gdb that ships with Qt Creator 1.2.92. I have tried pointing this to the 2009.03 version instead, but it makes no difference at all.

Now, what I think is happening is this... when Qt Creator starts a debug session it should apply any breakpoints you've set by registering them with gdb. This explains why, until you debug your app, the breakpoint symbol in your code has a little wait cursor next to it:


When you debug your app the first time this icon changes as Qt Creator successfully applies the breakpoint:


Any new breakpoints you add stay displayed with the wait cursor so it looks like Qt Creator isn't applying them.

0 Comments:

Post a Comment