Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Debugger not attaching quickly enough?

Debugger not attaching quickly enough?

Scheduled Pinned Locked Moved Qt Creator and other tools
2 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KoolaydeTheTaru
    wrote on last edited by
    #1

    Greetings.

    I'm writing a console application using QtCreator on Windows 7 (x64). I installed the Qt SDK via the offline installer tool for Windows. After that finishes, I use the Maintenance application to update the SDK. I'm experiencing a weird issue when I try to use the debugger and breakpoints. I've tried re-installing the SDK a few times via various methods and on different computers but the issue seems to persist.

    When I set breakpoints, all of them seem to be completely ignored and they get skipped. The application continues running until it finishes. The application is set to be a Debug build and I've tried launching the debugger in various ways (using F5, going to the menu bar and selecting Debug > Start Debugging > Start Debugging, using the Start Debugging icon on the bottom left) but they have the same effect.

    If I use QtCreator on Linux everything works as it should.

    I examined the Debugger Logs and it looked like to me that the debugger wasn't attaching fast enough.

    To get the debugger and breakpoints to work on my application on Windows, I have to insert some "hackish" code to make my application wait for a small amount of time to give the debugger a chance to attach. Once I do this, it works as it should. (debugging and breakpoints work) If I don't do this, breakpoints won't work no matter where I set them. It's slightly annoying.

    I can use some very simple code to replicate this behavior:

    @
    #include <iostream>

    int main(int argc, char *argv[])
    {

    //Try setting as many breakpoints as you like, none of them will be hit
    int a = 3;
    int b = 6;
    int c = 9;
    
    std::cout << "a is: " << a << std::endl;
    std::cout << "b is: " << b << std::endl;
    std::cout << "c is: " << c << std::endl;
    
    return 0;
    

    }
    @

    But add this to make it wait a small bit, and breakpoints work again...

    @
    #include <iostream>
    #include <QWaitCondition>
    #include <QReadWriteLock>

    int main(int argc, char *argv[])
    {
    //This code is totally unneeded for the application, but
    //it seems to give the debugger more time to attach so I can use
    //breakpoints.
    QReadWriteLock mutex;
    QWaitCondition cond;
    mutex.lockForRead();
    cond.wait(&mutex, 500);
    mutex.unlock();

    int a = 3;
    int b = 6;
    int c = 9;
    
    std::cout << "a is: " << a << std::endl;
    std::cout << "b is: " << b << std::endl;
    std::cout << "c is: " << c << std::endl;
    
    return 0;
    

    }
    @

    Could this be a bug or is there something I should be adjusting on my system to prevent this from happening? Maybe I'm doing something wrong?

    If the debugging logs will help, I can post those as well if needed. Sorry for the wall of text.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      Please file a "bug report":http://bugreports.qt-project.org/ against Qt Creator. Please attach the debugger log, without it it is really hard to diagnose any debugger related issue. Thanks!

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved