Problems with CDB Debugger in QtCreator

Some time ago Locals and Expressions view in QtCreator just stopped working for me. No locals were listed when the program stopped on a breakpoint, watches did not show the values, hovering with the mouse over a variable in the editor did not show its value in a tooltip. No fiddling with IDE options helped. This was on Windows using compiler from Visual C++ and CDB as a debugger.

It was quite annoying but I was mostly working on UI at that time and could live with occasional dumping of few variables into a log. Few weeks later I moved to some math heavy stuff and the situation became desperate — I had to fix this!

At first, I suspected the debugger or the compiler. Since reinstalling and trying different versions did not help I also tried different versions of Qt and QtCreator itself. Still broken. And Googling for broken CDB only revealed problems with CDB getting unusably slow.

After QtCreator reinstall, I noticed the settings were preserved from the old version. So maybe they are somehow corrupted?  I found them in C:\Users\username\AppData\Roaming\QtProject\qtcreator\, made a backup of that folder, and deleted it. And it started working! Locals and Expressions were back!

Of course, I also wanted my old settings back. So I switched back to the old settings and started QtCreator again and to my surprise it still worked! I took a closer look and saw that the problem lies in the session file (*.qws) — when I previously deleted the settings folder QtCreator created a new session for me and this one I reopened in the IDE after the switch back to the old settings (just copied the files into the folder so the new session file stayed there).

So I opened the session file with an intention to start deleting suspicious stuff until it works. It’s a XML file and apart from one big base64 blob there is not much else. Besides a breakpoint list, the only thing that seemed related to debugging was a list of maybe ten old watch expressions (which were not listed in the IDE anymore!). I deleted it and voilà, I could see the values of locals and variables again!

After a few weeks, debugging started to get slow. Stepping over code took a few seconds and values of the variables showed up only after considerable time (tens of seconds). This time I knew what to do, deleting watch expressions from the session file helped again. So I came to the conclusion that in the first case the values could eventually show up after a few minutes (stepping over code was not slowed down though). It was just very very slow. Then the Googled complaints about slow CDB made more sense to me. And indeed, I found out someone fixed it the same way but I was not paying attention to just slow debugging before, I was looking for broken debugging!

Recapitulation

  1. Debugging in QtCreator using CDB in Windows is very slow and/or values of locals and expressions never show up.
  2. Go to the folder where QtCreator stores your session file (C:\Users\username\AppData\Roaming\QtProject\qtcreator\).
  3. Open the session file (*.qws) in text editor and look for this XML subtree:
    <data>
        <variable>value-Watchers</variable>
        <valuelist type="QVariantList">
            <value type="QString">some expression 1</value>
            <value type="QString">some expression 2</value>
            <value type="QString">some expression 3</value>
        </valuelist>
    </data>
    
  4. Delete this subtree (or just the expressions) and save the file.
  5. Start QtCreator, open the fixed session, and do some debugging.

11 thoughts on “Problems with CDB Debugger in QtCreator

  1. I just had same problem on Ubuntu 12.04, installed new qt, new g++, upgraded gdb, and variables disappeared. In my case, I deleted debuggers.xml in qtcreator settings folder and now it’s fixed. I had the idea after reading this helpful article and renamed qtcreator settings folder and then it started to work again.

  2. I spent hours, over several days, trying to figure out why debugging in QTCreator was so slow. I see quite a few posts from people having issues but no solutions that worked for me. Made sure I was using 32bit compiler with 32bit cdb. The strange thing is that when I first load CTCreator debugging seems acceptable, but then after a few go-rounds it slows to a crawl…press F10 and go get a cup of coffee. I really like the Creator environment but stepping through code in debug was a no go, and had me convinced to go back to Visual Studio. But low and behold this actually worked and I only had 2 items in the list, but i guess that was enough. This will be filed under routing maintenance. Can’t thank you enough.

  3. This post saved my bacon !
    Using Qt Creator 4.0.2 I also found in the debug symbols window, (if you wait for it to get it’s **stuff** together and come back from whatever the heck it is doing) the right-click context menu item “Remove all expression evaluators” seemed to have the same effect, without having to exit and restart Qt Creator.

  4. I also met this problem, after some days of debugging, it gets impossible to debug cause it’s so slow. I tried your way and it works, thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *