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. Why is GDB so slow on Windows?
QtWS25 Last Chance

Why is GDB so slow on Windows?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
14 Posts 3 Posters 1.5k 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.
  • D Offline
    D Offline
    deisik
    wrote on 13 Jul 2023, 10:42 last edited by deisik
    #1

    Just to give you an idea how slow GDB is to show this in locals:

    <Rebuild Watchmodel 17 @ 13:33:53.447 [347535ms] >
     Finished retrieving data.
    

    It takes more than 5 minutes

    What's wrong with it?

    J 1 Reply Last reply 13 Jul 2023, 11:17
    0
    • D deisik
      13 Jul 2023, 10:42

      Just to give you an idea how slow GDB is to show this in locals:

      <Rebuild Watchmodel 17 @ 13:33:53.447 [347535ms] >
       Finished retrieving data.
      

      It takes more than 5 minutes

      What's wrong with it?

      J Offline
      J Offline
      JonB
      wrote on 13 Jul 2023, 11:17 last edited by
      #2

      @deisik
      Obviously it ought not take this long, but what do you have to show in locals? I assume it does not happen if e.g. you just look at an empty main() function.

      D 1 Reply Last reply 13 Jul 2023, 11:25
      0
      • J JonB
        13 Jul 2023, 11:17

        @deisik
        Obviously it ought not take this long, but what do you have to show in locals? I assume it does not happen if e.g. you just look at an empty main() function.

        D Offline
        D Offline
        deisik
        wrote on 13 Jul 2023, 11:25 last edited by deisik
        #3

        Obviously it ought not take this long, but what do you have to show in locals? I assume it does not happen if e.g. you just look at an empty main() function.

        Whatever. Even simple classes are taking like 20-30 seconds

        The point is GDB is close to instant on Linux with the same codebase

        I set _NO_DEBUG_HEAP = 1 and it didn't help

        J 1 Reply Last reply 13 Jul 2023, 11:34
        0
        • D deisik
          13 Jul 2023, 11:25

          Obviously it ought not take this long, but what do you have to show in locals? I assume it does not happen if e.g. you just look at an empty main() function.

          Whatever. Even simple classes are taking like 20-30 seconds

          The point is GDB is close to instant on Linux with the same codebase

          I set _NO_DEBUG_HEAP = 1 and it didn't help

          J Offline
          J Offline
          JonB
          wrote on 13 Jul 2023, 11:34 last edited by
          #4

          @deisik
          I don't know. I don't use Windows gdb. Of course it's instantaneously fast under Linux.

          Try obvious stuff:

          • You're using command-line gdb in both, not a UI, right?
          • You're not using/sitting in OneDrive, like I have seen some people do, are you?
          • No "slow" devices for wherever it might be looking for source code, including system stuff, like, say, network/Internet?
          • During the "5 minutes", run up Task Manager, is anything happening there? Is gdb using CPU time or not?
          • Go into Resource Monitor. Look at the Disk activity. If it's doing anything check the file paths it's accessing.
          D 1 Reply Last reply 13 Jul 2023, 11:40
          0
          • D deisik has marked this topic as solved on 13 Jul 2023, 11:37
          • D deisik has marked this topic as unsolved on 13 Jul 2023, 11:37
          • J JonB
            13 Jul 2023, 11:34

            @deisik
            I don't know. I don't use Windows gdb. Of course it's instantaneously fast under Linux.

            Try obvious stuff:

            • You're using command-line gdb in both, not a UI, right?
            • You're not using/sitting in OneDrive, like I have seen some people do, are you?
            • No "slow" devices for wherever it might be looking for source code, including system stuff, like, say, network/Internet?
            • During the "5 minutes", run up Task Manager, is anything happening there? Is gdb using CPU time or not?
            • Go into Resource Monitor. Look at the Disk activity. If it's doing anything check the file paths it's accessing.
            D Offline
            D Offline
            deisik
            wrote on 13 Jul 2023, 11:40 last edited by deisik
            #5

            Try obvious stuff:

            • You're using command-line gdb in both, not a UI, right?
            • You're not using/sitting in OneDrive, like I have seen some people do, are you?
            • No "slow" devices for wherever it might be looking for source code, including system stuff, like, say, network/Internet?
            • During the "5 minutes", run up Task Manager, is anything happening there? Is gdb using CPU time or not?
            • Go into Resource Monitor. Look at the Disk activity. If it's doing anything check the file paths it's accessing.

            I have 2 machines and it is absolutely the same on both of them. The application itself runs pretty fast so it is not a resource issue

            It is all local, CPU is like 70% idle, no disk or network activity at all. GDB takes around 1Gb of memory, with 78% used all in all, so it's not memory related

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cristian-adam
              wrote on 13 Jul 2023, 12:26 last edited by
              #6

              Not that it matters that much, but for protocol, which version of gdb are you using?

              Do you have many breakpoints?

              D 1 Reply Last reply 13 Jul 2023, 14:19
              0
              • C cristian-adam
                13 Jul 2023, 12:26

                Not that it matters that much, but for protocol, which version of gdb are you using?

                Do you have many breakpoints?

                D Offline
                D Offline
                deisik
                wrote on 13 Jul 2023, 14:19 last edited by deisik
                #7

                @cristian-adam

                Mostly the one equipped with QtCreator. I tried whatever was installed before, no luck either. Today I installed QtCreator 11.0.0-rc1 (10.0.84), it didn't change anything

                One breakpoint is enough to make GDB that slow

                This issue seems to be with Windows, not so much GDB as such (I'm using Windows 10)

                C 1 Reply Last reply 13 Jul 2023, 14:36
                0
                • D deisik
                  13 Jul 2023, 14:19

                  @cristian-adam

                  Mostly the one equipped with QtCreator. I tried whatever was installed before, no luck either. Today I installed QtCreator 11.0.0-rc1 (10.0.84), it didn't change anything

                  One breakpoint is enough to make GDB that slow

                  This issue seems to be with Windows, not so much GDB as such (I'm using Windows 10)

                  C Offline
                  C Offline
                  cristian-adam
                  wrote on 13 Jul 2023, 14:36 last edited by
                  #8

                  Okay, I assume gdb 11.2.0 from c:\Qt\Tools\mingw1120_64\bin\gdb.exe.

                  gdb on Windows is known to be slow, and I don't think the developers are very keen on fixing stuff for Windows.

                  If I remember correctly gdb on Linux is using multi-threaded code, which is not enabled on Windows.

                  You could try either gdb on Linux with WSL2, or lldb.exe from https://github.com/mstorsjo/llvm-mingw.

                  C D 2 Replies Last reply 13 Jul 2023, 14:43
                  1
                  • C cristian-adam
                    13 Jul 2023, 14:36

                    Okay, I assume gdb 11.2.0 from c:\Qt\Tools\mingw1120_64\bin\gdb.exe.

                    gdb on Windows is known to be slow, and I don't think the developers are very keen on fixing stuff for Windows.

                    If I remember correctly gdb on Linux is using multi-threaded code, which is not enabled on Windows.

                    You could try either gdb on Linux with WSL2, or lldb.exe from https://github.com/mstorsjo/llvm-mingw.

                    C Offline
                    C Offline
                    cristian-adam
                    wrote on 13 Jul 2023, 14:43 last edited by
                    #9

                    https://www.reddit.com/r/cpp/comments/u8awwt/faster_gdb_startup/ is the thread with the information about multi threading.

                    1 Reply Last reply
                    1
                    • C cristian-adam
                      13 Jul 2023, 14:36

                      Okay, I assume gdb 11.2.0 from c:\Qt\Tools\mingw1120_64\bin\gdb.exe.

                      gdb on Windows is known to be slow, and I don't think the developers are very keen on fixing stuff for Windows.

                      If I remember correctly gdb on Linux is using multi-threaded code, which is not enabled on Windows.

                      You could try either gdb on Linux with WSL2, or lldb.exe from https://github.com/mstorsjo/llvm-mingw.

                      D Offline
                      D Offline
                      deisik
                      wrote on 13 Jul 2023, 14:49 last edited by deisik
                      #10

                      @cristian-adam
                      or lldb.exe

                      I tried that. lldb crashes on start-up

                      CALL: SETUP ENGINE
                      STARTING LLDB: 
                      ERROR: Lldb stderr: qtcreator_ctrlc_stub: Command line failed: ""
                      
                      D 1 Reply Last reply 13 Jul 2023, 18:02
                      0
                      • D deisik
                        13 Jul 2023, 14:49

                        @cristian-adam
                        or lldb.exe

                        I tried that. lldb crashes on start-up

                        CALL: SETUP ENGINE
                        STARTING LLDB: 
                        ERROR: Lldb stderr: qtcreator_ctrlc_stub: Command line failed: ""
                        
                        D Offline
                        D Offline
                        deisik
                        wrote on 13 Jul 2023, 18:02 last edited by deisik
                        #11

                        In fact, lldb wasn't in the path, so I corrected it and now lldb (Python?) complains:

                        ERROR: Lldb stderr: ValueError: compile(): unrecognised flags
                        
                        C 1 Reply Last reply 17 Jul 2023, 19:54
                        0
                        • D deisik
                          13 Jul 2023, 18:02

                          In fact, lldb wasn't in the path, so I corrected it and now lldb (Python?) complains:

                          ERROR: Lldb stderr: ValueError: compile(): unrecognised flags
                          
                          C Offline
                          C Offline
                          cristian-adam
                          wrote on 17 Jul 2023, 19:54 last edited by
                          #12

                          At https://bugreports.qt.io/browse/QTBUG-107516 I've posted two videos of Qt Creator 11 built with MinGW 11.2.0 and LLVM-MinGW 16.0.6.

                          • MinGW 11.2.0 - 1 min 14 seconds until this was expanded
                          • LLVM-MinGW 16.0.6 - 34 seconds until this was expanded

                          I had to compile Qt 6.4.3 mysef, I've uploaded my build here. It has debugging information and I think my path was c:/Projects/Qt/repo and I've compiled only the modules needed for Qt Creator.

                          C 1 Reply Last reply 19 Jul 2023, 16:11
                          3
                          • C cristian-adam
                            17 Jul 2023, 19:54

                            At https://bugreports.qt.io/browse/QTBUG-107516 I've posted two videos of Qt Creator 11 built with MinGW 11.2.0 and LLVM-MinGW 16.0.6.

                            • MinGW 11.2.0 - 1 min 14 seconds until this was expanded
                            • LLVM-MinGW 16.0.6 - 34 seconds until this was expanded

                            I had to compile Qt 6.4.3 mysef, I've uploaded my build here. It has debugging information and I think my path was c:/Projects/Qt/repo and I've compiled only the modules needed for Qt Creator.

                            C Offline
                            C Offline
                            cristian-adam
                            wrote on 19 Jul 2023, 16:11 last edited by
                            #13

                            If all goes well at https://lists.qt-project.org/pipermail/development/2023-July/044172.html we could migrate to llvm-mingw and lldb!

                            gdb can't be slow anymore, when there is no more gdb 🙂

                            1 Reply Last reply
                            2
                            • D Offline
                              D Offline
                              deisik
                              wrote on 24 Aug 2023, 11:26 last edited by deisik
                              #14

                              I switched to MSVC and now debugging is great again (with cdb)

                              1 Reply Last reply
                              3
                              • D deisik has marked this topic as solved on 24 Aug 2023, 11:27

                              • Login

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