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

QtCreator starts application before debugger, when "Run in terminal" is set in Projects>Run options

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • Qt Creator 2.5.0-beta
    • Qt Creator 2.3.0
    • Debugger
    • None
    • Ms Windows 7 x64, Qt 4.7.4
    • 785b82177fe55d2773b7c30884979759c4ab9291

    Description

      Step to reproduce:
      1. Create simple Qt console application
      2. Add a few instructions and set a break point somewhere
      3. Make sure you have "Run in terminal" option set in Projects>Run options
      4. Go to debug tab and show debugger log for better understanding of the issue (Window > Views > Debugger's log
      5. Run the debugger (e.g. F5)

      What's happening:
      QtCreator spawns new command prompt window and runs the debugging application inside it, before gdb fully starts (you can see, that the magic is still outputting in debugger's log, when the application being debugged is already run), which results in break points not being respected (in fact, the application will manage to finish before gdb even sets any breakpoints).

      How it should work:
      Gdb starts before application is run.

      An example:

      // main.cpp
      #include <iostream>
      #include <cstdlib>
      
      int main(int argc, char *argv[])
      {
      //        system("pause");
      
          int i = 5;
          ++i;
          std::cout << i << std::endl;
          return 0;
      }
      

      Example's description:
      Set a break point at the ++i; instruction and watch how it's not being respected by the "too-late-start" debugger. Next, uncomment the system("pause"); instruction, run debugging (terminal window starts and waits; gdb is being started), wait for the debugger to start (wait until the magic in the log stops generating), press any key in the terminal window and watch, how debugger correctly breaks execution at desired line.

      Attachments

        1. debugger.log
          12 kB
        2. gdbLog.withoutPause.txt
          12 kB
        3. gdbLog.withPause.txt
          21 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              hjk hjk
              phan Dominik Dera
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes