Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-4997

Windows Qt Creator debugger skips breakpoints set at the first lines of main()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • Qt Creator 2.5.0-beta
    • Qt Creator 2.2.0
    • Debugger
    • None
    • Windows 7 x64, Qt SDK 1.1.1
    • 785b82177fe55d2773b7c30884979759c4ab9291

      I'm an educator and stepping through code line-by-line from line #1 is very important for the first class intro of the development environment. This problem got better in Qt Creator 2.1, compared to 2.0.1 and prior, but it's not still completely working. Prior to 2.1, the debugger session of any standard C++ hello world type console application on Windows Qt Creator didn't respond at all. From 2.1, it's now functioning (I guess qtcreator_process_stub.exe is now somehow fixed). However, when I set a breakpoint at the very first line of main() in such a console application, the debugger doesn't stop at the breakpoint. It does stop if I add "cin.get();" in the previous line of the breakpoint, so I guess it's related to some timing issue between gdb.exe and qtcreator_process_stub.exe. I tried this same scenario on a Linux installation and it doesn't occur there. Here's the source code I tried, even though it's so obvious:

      #include <iostream>
      
      using namespace std;
      
      int main(int argc, char *argv[])
      {
          cin.get(); // if commented out, the debugger doesn't stop at the breakpoint in the next line.
      
          cout << "Hello, world!" << endl; // breakpoint
      
          int sum = 0;
          for (int i = 1; i <= 10; i++)
              sum += i;
      
          cout << sum << endl;
      
          cout << "Enter a number: ";
      
          int n;
      
          cin >> n;
      
          cout << "You entered " << n << "!" << endl;
      
          return 0;
      }
      

      Thanks.

        1. debugger.log
          15 kB
        2. master.log
          15 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            hjk hjk
            hosungs Hosung Song
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes