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. Qt debugger is taking its own initial values
Qt 6.11 is out! See what's new in the release blog

Qt debugger is taking its own initial values

Scheduled Pinned Locked Moved Qt Creator and other tools
15 Posts 6 Posters 7.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
    koahnig
    wrote on last edited by
    #4

    I have moved your thread to tools. That will probably attract the right people for helping you.

    You should give probably also some details on the operation system, compiler and the actual debugger.

    Vote the answer(s) that helped you to solve your issue(s)

    1 Reply Last reply
    0
    • T Offline
      T Offline
      TheDestroyer
      wrote on last edited by
      #5

      I'm using MinGW that comes with the SDK 1.2 under Windows 7 64-bit. Any other information I could prepare if needed!!!

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #6

        To make sure it actually is the debugger I would put some qDebug() output into the method and print out the values of i, j and k.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • T Offline
          T Offline
          TheDestroyer
          wrote on last edited by
          #7

          I've done that. The debugger is sometimes skipping some lines... I tried setting a breakpoint at the very first line

          @vector<T> tempData = data;@

          and it some times skips it!!!!! I don't understand what's going on!!! it's acting crazy!

          Is there someway (that I don't know of) to start debugging from the middle? perhaps I'm doing that without knowing it!!!!

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lgeyer
            wrote on last edited by
            #8

            Are you sure that the code matches the binary? If the debugger skips lines, halts on strange locations and shows odd values you most probably looking at a different version of the source than the one which was used to compile the current binary.

            Try to recompile your project with the sources you are actually using to debug the binary.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              TheDestroyer
              wrote on last edited by
              #9

              Yes, I'm pretty sure.

              I think I know what the problem is. The debugger is "resuming" the last debug. Apparently, if you stop the debugger and run it again, it resumes, and doesn't start from the beginning...!! I never knew that!!!

              How could I reset the debugger manually? is there an option for that?

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

                Are you using an optimized build?

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  TheDestroyer
                  wrote on last edited by
                  #11

                  If you mean with optimised build using -O2 or -O3 for compiling, then no. The option for the compiler is set to Debug; i.e., to -g.

                  If that's not what you mean, please explain what an optimised build is.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    apoenitz
                    wrote on last edited by
                    #12

                    Can you please double check this is a clean build, without any -Ox option, and if the problem persists, paste the debugger log somewhere? Are there any jumps/returns in the "..." part of your code?

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      TheDestroyer
                      wrote on last edited by
                      #13

                      Here's the build log for a debug version:


                      17:54:15: Running build steps for project MergeSort...
                      17:54:15: Configuration unchanged, skipping qmake step.
                      17:54:16: Starting: "D:\QtSDK\mingw\bin\mingw32-make.exe"
                      D:/QtSDK/mingw/bin/mingw32-make.exe -f Makefile.Debug
                      mingw32-make.exe[1]: Entering directory C:/Users/Sam/Dropbox/common_src/MergeSort/MergeSort-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"d:\QtSDK\Desktop\Qt\4.8.0\mingw\include\QtCore" -I"d:\QtSDK\Desktop\Qt\4.8.0\mingw\include" -I"d:\QtSDK\Desktop\Qt\4.8.0\mingw\include\ActiveQt" -I"debug" -I"..\MergeSort" -I"." -I"d:\QtSDK\Desktop\Qt\4.8.0\mingw\mkspecs\win32-g++" -o debug\main.o ..\MergeSort\main.cpp ..\MergeSort\main.cpp: In function 'int main(int, char**)': ..\MergeSort\main.cpp:143: warning: comparison between signed and unsigned integer expressions ..\MergeSort\main.cpp: In function 'void sort(std::vector<T, std::allocator<_CharT> >&) [with T = double]': ..\MergeSort\main.cpp:147: instantiated from here ..\MergeSort\main.cpp:28: warning: comparison between signed and unsigned integer expressions ..\MergeSort\main.cpp:32: warning: comparison between signed and unsigned integer expressions ..\MergeSort\main.cpp:147: instantiated from here ..\MergeSort\main.cpp:103: warning: unused variable 'xxx' g++ -Wl,-subsystem,console -mthreads -o debug\MergeSort.exe debug/main.o -L"d:\QtSDK\Desktop\Qt\4.8.0\mingw\lib" -lQtCored4 mingw32-make.exe[1]: Leaving directory C:/Users/Sam/Dropbox/common_src/MergeSort/MergeSort-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug'
                      17:54:19: The process "D:\QtSDK\mingw\bin\mingw32-make.exe" exited normally.


                      The part "..." has only some other while loops and break commands. No goto or return commands.

                      I don't have a problem now, since I finished writing the sort function I wanted to write. But the problem persists and still there, and in the future it will happen again.

                      The problem is that the debugger "resumes" debugging after stopping it, and not starting from the beginning. I don't know how to disable this stupid feature. If anyone knows, please say, because this summarises the problem.

                      Please start a console program with your Qt and try to debug stuff similar to my code, and you'll see how it "resumes" debugging. I'm using Qt SDK 1.2.

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        apoenitz
                        wrote on last edited by
                        #14

                        I don't see it here. Can you please open a bugreport at bugreports.qt-project.org and add a minimal example showing that behaviour? Preferably with the debugger log (the contents of the right pane of Windows->Views->Debugger Log) attached?

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          TheDestroyer
                          wrote on last edited by
                          #15

                          Bug reported:

                          https://bugreports.qt-project.org/browse/QTBUG-24388

                          Thanks for the help guys. Hopefully they'll solve it soon :-)

                          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