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. how to step into qt source code when debug
Forum Update on Monday, May 27th 2025

how to step into qt source code when debug

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 4 Posters 11.7k 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.
  • B Offline
    B Offline
    betterorbest
    wrote on 24 Jun 2017, 09:03 last edited by
    #1

    I have tried a few days, but can't do this.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 24 Jun 2017, 12:22 last edited by
      #2

      Hi
      You might have to build a debug version of the Qt you are using.
      with configure option -debug-and-release.
      If using visual studio, in some versions of Qt the PDB files are included.
      So it depends on what you have installed
      http://qihome.org/qiliang/2013/01/30/how-to-debug-into-qt-library-in-qt-creator-with-cdb/

      B 1 Reply Last reply 25 Jun 2017, 08:36
      3
      • M mrjj
        24 Jun 2017, 12:22

        Hi
        You might have to build a debug version of the Qt you are using.
        with configure option -debug-and-release.
        If using visual studio, in some versions of Qt the PDB files are included.
        So it depends on what you have installed
        http://qihome.org/qiliang/2013/01/30/how-to-debug-into-qt-library-in-qt-creator-with-cdb/

        B Offline
        B Offline
        betterorbest
        wrote on 25 Jun 2017, 08:36 last edited by
        #3

        @mrjj
        I have added src files and debug symbols shown in the following picture.
        firstly, the src dir mapping:
        0_1498379471710_dff65ae3-0615-4dee-a5f8-675820edc644-image.png
        secondly, the debug symbol setting:
        0_1498379643250_5b315ffc-f081-43b6-a36b-b34c2475b822-image.png .
        However, I still couldn't step into the source code.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          VRonin
          wrote on 26 Jun 2017, 08:55 last edited by
          #4

          Maybe I'm taking a detour here, why are you looking to debug inside Qt?
          Are you looking to contribute to Qt itself?

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          A B 2 Replies Last reply 26 Jun 2017, 09:48
          0
          • V VRonin
            26 Jun 2017, 08:55

            Maybe I'm taking a detour here, why are you looking to debug inside Qt?
            Are you looking to contribute to Qt itself?

            A Offline
            A Offline
            Asperamanca
            wrote on 26 Jun 2017, 09:48 last edited by
            #5

            @VRonin said in how to step into qt source code when debug:

            Maybe I'm taking a detour here, why are you looking to debug inside Qt?
            Are you looking to contribute to Qt itself?

            Stepping into Qt code can be enlightening in many cases where you don't quite understand why things behave as they do. I can highly recommend it.

            B 1 Reply Last reply 26 Jun 2017, 12:49
            4
            • V VRonin
              26 Jun 2017, 08:55

              Maybe I'm taking a detour here, why are you looking to debug inside Qt?
              Are you looking to contribute to Qt itself?

              B Offline
              B Offline
              betterorbest
              wrote on 26 Jun 2017, 12:27 last edited by
              #6

              @VRonin
              I wanted to know something as Asperamanca said.

              1 Reply Last reply
              0
              • A Asperamanca
                26 Jun 2017, 09:48

                @VRonin said in how to step into qt source code when debug:

                Maybe I'm taking a detour here, why are you looking to debug inside Qt?
                Are you looking to contribute to Qt itself?

                Stepping into Qt code can be enlightening in many cases where you don't quite understand why things behave as they do. I can highly recommend it.

                B Offline
                B Offline
                betterorbest
                wrote on 26 Jun 2017, 12:49 last edited by
                #7

                @Asperamanca
                So do you have any suggestion to step into the qt source code? Thank you.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Asperamanca
                  wrote on 26 Jun 2017, 13:59 last edited by
                  #8

                  When I had trouble stepping into Qt source, usually the application used the "release" dlls of Qt (e.g. Qt5Core.dll instead of Qt5Cored.dll). See if your debugger shows you which dlls are loaded on startup.

                  If this is the problem, the easiest way to fix it is to put only the debug dlls in the application's start path.

                  B 1 Reply Last reply 28 Jun 2017, 08:13
                  0
                  • A Asperamanca
                    26 Jun 2017, 13:59

                    When I had trouble stepping into Qt source, usually the application used the "release" dlls of Qt (e.g. Qt5Core.dll instead of Qt5Cored.dll). See if your debugger shows you which dlls are loaded on startup.

                    If this is the problem, the easiest way to fix it is to put only the debug dlls in the application's start path.

                    B Offline
                    B Offline
                    betterorbest
                    wrote on 28 Jun 2017, 08:13 last edited by
                    #9

                    @Asperamanca
                    Sorry that this is not my problem.
                    Also I want to say, if you are in debug mode, it will not use Qt5Core.dll. The Qt Creator has already set the correct .dll files with *d.dll in debug and *.dll in release.

                    A 1 Reply Last reply 28 Jun 2017, 08:17
                    0
                    • B betterorbest
                      28 Jun 2017, 08:13

                      @Asperamanca
                      Sorry that this is not my problem.
                      Also I want to say, if you are in debug mode, it will not use Qt5Core.dll. The Qt Creator has already set the correct .dll files with *d.dll in debug and *.dll in release.

                      A Offline
                      A Offline
                      Asperamanca
                      wrote on 28 Jun 2017, 08:17 last edited by
                      #10

                      @betterorbest said in how to step into qt source code when debug:

                      @Asperamanca
                      Sorry that this is not my problem.
                      Also I want to say, if you are in debug mode, it will not use Qt5Core.dll. The Qt Creator has already set the correct .dll files with *d.dll in debug and *.dll in release.

                      What is your problem then? Can you describe

                      • What you intend to do
                      • How you do it
                      • What you expect to happen
                      • What actually happens
                      B 1 Reply Last reply 28 Jun 2017, 08:33
                      0
                      • A Asperamanca
                        28 Jun 2017, 08:17

                        @betterorbest said in how to step into qt source code when debug:

                        @Asperamanca
                        Sorry that this is not my problem.
                        Also I want to say, if you are in debug mode, it will not use Qt5Core.dll. The Qt Creator has already set the correct .dll files with *d.dll in debug and *.dll in release.

                        What is your problem then? Can you describe

                        • What you intend to do
                        • How you do it
                        • What you expect to happen
                        • What actually happens
                        B Offline
                        B Offline
                        betterorbest
                        wrote on 28 Jun 2017, 08:33 last edited by
                        #11

                        @Asperamanca
                        I intend to step into the Qt source code;
                        I have installed Qt5.5.0 with Src selected. As what people online say, with the Src directory setted, I can step into Qt src code. But this didn't happened. For example, I can't step into the func show() of qwidgets.
                        In Qtcreator, I have done what the following link says, http://qihome.org/qiliang/2013/01/30/how-to-debug-into-qt-library-in-qt-creator-with-cdb/.

                        A 1 Reply Last reply 28 Jun 2017, 08:52
                        0
                        • B betterorbest
                          28 Jun 2017, 08:33

                          @Asperamanca
                          I intend to step into the Qt source code;
                          I have installed Qt5.5.0 with Src selected. As what people online say, with the Src directory setted, I can step into Qt src code. But this didn't happened. For example, I can't step into the func show() of qwidgets.
                          In Qtcreator, I have done what the following link says, http://qihome.org/qiliang/2013/01/30/how-to-debug-into-qt-library-in-qt-creator-with-cdb/.

                          A Offline
                          A Offline
                          Asperamanca
                          wrote on 28 Jun 2017, 08:52 last edited by
                          #12

                          @betterorbest
                          I mostly debug with Visual Studio, but I just tried it with Qt Creator and Qt 5.9 MinGW. In my case, I could step into Qt sources but the lines numbers were all wrong (the program was clearly executing other code than what I saw as the 'current line').
                          Sorry if I can't help you - but with Creator, I simply lack the experience.

                          B 1 Reply Last reply 28 Jun 2017, 08:59
                          0
                          • A Asperamanca
                            28 Jun 2017, 08:52

                            @betterorbest
                            I mostly debug with Visual Studio, but I just tried it with Qt Creator and Qt 5.9 MinGW. In my case, I could step into Qt sources but the lines numbers were all wrong (the program was clearly executing other code than what I saw as the 'current line').
                            Sorry if I can't help you - but with Creator, I simply lack the experience.

                            B Offline
                            B Offline
                            betterorbest
                            wrote on 28 Jun 2017, 08:59 last edited by
                            #13

                            @Asperamanca
                            Really thank you for your answer.
                            I also debugged with visual stuido 2013 and qt add-in. I have set the src directory in Solution setting. Also I downloaded pdb-msvc-2013-32.7z and set the debug symbol in visual studio. However it didn't work.

                            1 Reply Last reply
                            0
                            • B Offline
                              B Offline
                              betterorbest
                              wrote on 1 Jul 2017, 11:36 last edited by
                              #14

                              I have solved the problem after I downloaded Qt5.8.0 and installed it. Maybe the problem is just in Qt5.5.0 because of the incorrect pdb files downloaded from Qt official website.

                              1 Reply Last reply
                              0

                              1/14

                              24 Jun 2017, 09:03

                              • Login

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