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. Pretty Printer for std::vector not working

Pretty Printer for std::vector not working

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
14 Posts 3 Posters 3.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.
  • T Offline
    T Offline
    tkansgar
    wrote on last edited by
    #1

    Hi all,

    I'm using the Pretty Printers for gdb in QtCreator since a long time. All of them work fine, but the values of std::vector and some other stl containers cannot be displayed when debugging with gdb in QtCreator. I found the directory share/qtcreator/debugger in my QtCreator and there stdtypes.py handling std::vector too. So my question is, why doesn't it work?

    Some Info:
    QtCreator: 4.6.2 (licensed)
    gdb: 8.1.0.20180409-git
    gcc: 7.3.0
    Ubuntu: 18.04

    Best Regards
    tkansgar

    aha_1980A 1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on last edited by
      #2

      I'm not sure if this could be related or if you are even installing Qt via the Maintenance Tool, but some time in Qt 5.11.x releases, the 'Qt Debug Information Files' where a made separate selection in the Qt Maintenance Tool. At least this is the case on Windows .

      1 Reply Last reply
      0
      • T tkansgar

        Hi all,

        I'm using the Pretty Printers for gdb in QtCreator since a long time. All of them work fine, but the values of std::vector and some other stl containers cannot be displayed when debugging with gdb in QtCreator. I found the directory share/qtcreator/debugger in my QtCreator and there stdtypes.py handling std::vector too. So my question is, why doesn't it work?

        Some Info:
        QtCreator: 4.6.2 (licensed)
        gdb: 8.1.0.20180409-git
        gcc: 7.3.0
        Ubuntu: 18.04

        Best Regards
        tkansgar

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @tkansgar

        Mhmm, works for me(tm):
        0_1554998595862_2d47f2d9-9ca9-468e-b7f4-5bbfa3fd0df5-grafik.png
        Ubuntu 18.04, gcc 7.3.0, gdb 8.1, Creator 4.9-rc

        Maybe it's time to upgrade Creator? (If you wait some days more, Creator 4.9 will be released officially).

        Regards

        Qt has to stay free or it will die.

        1 Reply Last reply
        3
        • T Offline
          T Offline
          tkansgar
          wrote on last edited by
          #4

          Hi,

          I just tested your code (with one small extension):
          0_1555518747884_Bildschirmfoto vom 2019-04-17 18-29-08.png
          I see only "<not accessible>", where you see the four vector items. But the program works as expected.

          I also tried this tip from a colleague: https://sourceware.org/gdb/wiki/STLSupport. It's just implemented here, but doesn't help too.

          Does anyone know, that QtCreator 4.6.2 cannot display std::vevtor values? I really can't believe that.

          Best Regards
          tkansgar

          aha_1980A 1 Reply Last reply
          0
          • T tkansgar

            Hi,

            I just tested your code (with one small extension):
            0_1555518747884_Bildschirmfoto vom 2019-04-17 18-29-08.png
            I see only "<not accessible>", where you see the four vector items. But the program works as expected.

            I also tried this tip from a colleague: https://sourceware.org/gdb/wiki/STLSupport. It's just implemented here, but doesn't help too.

            Does anyone know, that QtCreator 4.6.2 cannot display std::vevtor values? I really can't believe that.

            Best Regards
            tkansgar

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @tkansgar why don't you upgrade Creator?

            4.9 was released some day ago: https://blog.qt.io/blog/2019/04/15/qt-creator-4-9-0-released

            and as shown above, it works nicely.

            Qt has to stay free or it will die.

            T 1 Reply Last reply
            1
            • aha_1980A aha_1980

              @tkansgar why don't you upgrade Creator?

              4.9 was released some day ago: https://blog.qt.io/blog/2019/04/15/qt-creator-4-9-0-released

              and as shown above, it works nicely.

              T Offline
              T Offline
              tkansgar
              wrote on last edited by
              #6

              @aha_1980 said in Pretty Printer for std::vector not working:

              @tkansgar why don't you upgrade Creator?

              4.9 was released some day ago: https://blog.qt.io/blog/2019/04/15/qt-creator-4-9-0-released

              and as shown above, it works nicely.

              Hi,

              I installed 4.9.0. But now all gets much worse! When I now try to debug the program above, gdb hangs at the breakpoint at the beginning of main, increases its memory usage up to ~57GB and then terminates. What is going wrong here now?

              Best Regards
              tkansgar

              aha_1980A 1 Reply Last reply
              0
              • T tkansgar

                @aha_1980 said in Pretty Printer for std::vector not working:

                @tkansgar why don't you upgrade Creator?

                4.9 was released some day ago: https://blog.qt.io/blog/2019/04/15/qt-creator-4-9-0-released

                and as shown above, it works nicely.

                Hi,

                I installed 4.9.0. But now all gets much worse! When I now try to debug the program above, gdb hangs at the breakpoint at the beginning of main, increases its memory usage up to ~57GB and then terminates. What is going wrong here now?

                Best Regards
                tkansgar

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @tkansgar

                What is going wrong here now?

                I really don't know! And it is the simple example from above?

                Have you already removed the build foldr and .pro.user file and tried again?

                Qt has to stay free or it will die.

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tkansgar
                  wrote on last edited by
                  #8

                  @aha_1980 said in Pretty Printer for std::vector not working:

                  @tkansgar

                  What is going wrong here now?

                  I really don't know! And it is the simple example from above?

                  Have you already removed the build foldr and .pro.user file and tried again?

                  Hi aha_1980,

                  yes, source and binary are those from 4/17/2019. Nothing is rebuilt. And I don't have any project files for this sample. I just used "Debug external application" from the Debug menu in both test cases.

                  And I just tested gdb with this sample from the shell command line (without QtCreator). It works very fine (and can print the four values of v too):

                  (gdb) print v
                  $1 = std::vector of length 4, capacity 4 = {1, 2, 3, 4}
                  

                  Any ideas?

                  Best Regards
                  tkansgar

                  aha_1980A 1 Reply Last reply
                  0
                  • T tkansgar

                    @aha_1980 said in Pretty Printer for std::vector not working:

                    @tkansgar

                    What is going wrong here now?

                    I really don't know! And it is the simple example from above?

                    Have you already removed the build foldr and .pro.user file and tried again?

                    Hi aha_1980,

                    yes, source and binary are those from 4/17/2019. Nothing is rebuilt. And I don't have any project files for this sample. I just used "Debug external application" from the Debug menu in both test cases.

                    And I just tested gdb with this sample from the shell command line (without QtCreator). It works very fine (and can print the four values of v too):

                    (gdb) print v
                    $1 = std::vector of length 4, capacity 4 = {1, 2, 3, 4}
                    

                    Any ideas?

                    Best Regards
                    tkansgar

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @tkansgar

                    And I don't have any project files for this sample. I just used "Debug external application" from the Debug menu in both test cases.

                    Can you try with a minimal project?

                    I guess debugging external apps is more rarely used...

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    1
                    • T Offline
                      T Offline
                      tkansgar
                      wrote on last edited by
                      #10

                      Hi again,

                      I found some time to create a project for my test file. But the issue remains the same. gdb reaches the breakpoint at the opening { of main and hangs. In the variables view on the right there is an endless turning circle radial lines. top shows 100% CPU usage for gdb and its memory comsumption increases more and more. Then I killed gdb.

                      Started on the command line gdb works totally normally with my test file, just like expected. So it must be an issue with qtcreator but not gdb. My suspicion is, it has to do with the attempt of qtcreator to get the variable values from gdb.

                      Do you need some more info about my test project?

                      Best Regards
                      tkansgar

                      aha_1980A 1 Reply Last reply
                      0
                      • T tkansgar

                        Hi again,

                        I found some time to create a project for my test file. But the issue remains the same. gdb reaches the breakpoint at the opening { of main and hangs. In the variables view on the right there is an endless turning circle radial lines. top shows 100% CPU usage for gdb and its memory comsumption increases more and more. Then I killed gdb.

                        Started on the command line gdb works totally normally with my test file, just like expected. So it must be an issue with qtcreator but not gdb. My suspicion is, it has to do with the attempt of qtcreator to get the variable values from gdb.

                        Do you need some more info about my test project?

                        Best Regards
                        tkansgar

                        aha_1980A Offline
                        aha_1980A Offline
                        aha_1980
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @tkansgar

                        Do you need some more info about my test project?

                        Every info you have helps to solve the issue.

                        But for your current problem, you can directly create a report at bugreports.qt.io - please add a link here. Attach the sample project and the debugger log (Window > Views > Debugger Log) there.

                        sorry, but thats all I can do for you now :(

                        Qt has to stay free or it will die.

                        T 1 Reply Last reply
                        0
                        • aha_1980A aha_1980

                          @tkansgar

                          Do you need some more info about my test project?

                          Every info you have helps to solve the issue.

                          But for your current problem, you can directly create a report at bugreports.qt.io - please add a link here. Attach the sample project and the debugger log (Window > Views > Debugger Log) there.

                          sorry, but thats all I can do for you now :(

                          T Offline
                          T Offline
                          tkansgar
                          wrote on last edited by
                          #12

                          Hi again,
                          I just tried it with qtcreator 4.8.2. The result is the same. When encountering the first breakpoint in the test code, gdb hangs (trying to obtain the variable values).

                          @aha_1980 said in Pretty Printer for std::vector not working:

                          ...

                          But for your current problem, you can directly create a report at bugreports.qt.io - please add a link here. Attach the sample project and the debugger log (Window > Views > Debugger Log) there.

                          I wil do that now and come back again here.

                          Best Regards
                          tkansgar

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

                            Here is the link to my bug report:
                            https://bugreports.qt.io/browse/QTCREATORBUG-22483

                            1 Reply Last reply
                            2
                            • T Offline
                              T Offline
                              tkansgar
                              wrote on last edited by
                              #14

                              Hi again,

                              I just solved both issues, displaying std::vector item values and hanging of gdb in qtcreator 4.9: If I switch on both "Use Debugging Helper" and "Load system GDB pretty printers", gdb hangs on the first breakpoint. If one of them is switched off, gdb works properly. But "Load system GDB pretty printers" seems to be useless for me now, and "Use Debugging Helper" provides exactly that functionality I missed here.

                              Best Regards
                              tkansgar

                              1 Reply Last reply
                              1

                              • Login

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