Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Several problems with data breakpoint

Several problems with data breakpoint

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 366 Views
  • 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.
  • Z Offline
    Z Offline
    zzzhhhzzzhhh
    wrote on last edited by
    #1

    The data breakpoint in Qt Creator doesn't behave the way I want. The code snippet is as follows:

    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        //qDebug("6! is %lu", MathFunctions::factorial(6));
        int values[] = { 6, 7, 8 };
        for(unsigned int i = 0; i < sizeof(values)/sizeof(int); i++)
        {
            qDebug() << values[i] << "! = "
                << MathFunctions::factorial(values[i]);
        }
    
        return a.exec();
    }
    

    I first set a normal breakpoint at QCoreApplication a(argc, argv); Then step over until the for line. Right click over i in the Local tab, Add Data Breakpoint -> Add Data Breakpoint at Object's Address (0x...), then press F5 to continue.

    Problem 1.
    The execution breaks twice instead of once at the for line. My understanding of data breakpoint is that it causes the execution to stop wherever the code changes the value of the variable (i here). But i is only changed at i++ at this line. Why does the debugger break twice?

    Problem 2.
    The execution also breaks inside the for loop (at qDebug() << line) which does not change i at all. According to my understanding above, the debugger shouldn't break because the value of i is not changed. Why does the debugger break here?

    Problem 3.
    I stopped the debugging and restart it using the steps described above. The data breakpoint does not work this time. The program just runs ahead over the for loop. The data breakpoint is still listed in the breakpoints pane and I have enabled it. Why is the data breakpoint not hit?

    My environment

    • Windows 10, 64 bit
    • Desktop Qt 5.10.1 for Visual Studio 2015 (default kit) and 2017, Qt Creator 4.6.1
    • Visual Studio 2015 and 2017
    • CDB installed
      alt text

    If you need any other information for troubleshooting, please let me know. Thank you.

    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