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. return value not shown by Qt Creator debugger
QtWS25 Last Chance

return value not shown by Qt Creator debugger

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
creator 4debuggerreturn value
9 Posts 3 Posters 2.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.
  • D Offline
    D Offline
    dave2
    wrote on 30 Jan 2019, 06:08 last edited by Chris Kawa
    #1

    I cannot get the return value of functions shown by Qt Creator debugger.

    Details:

    https://stackoverflow.com/questions/54421152/return-value-not-shown-by-qt-creator-debugger

    (where no one was able to help).

    Any idea why this doesn't work?

    A 1 Reply Last reply 30 Jan 2019, 13:21
    0
    • D dave2
      30 Jan 2019, 06:08

      I cannot get the return value of functions shown by Qt Creator debugger.

      Details:

      https://stackoverflow.com/questions/54421152/return-value-not-shown-by-qt-creator-debugger

      (where no one was able to help).

      Any idea why this doesn't work?

      A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 30 Jan 2019, 13:21 last edited by
      #2

      @dave2

      Could be a bug. Can you create a minimal example that we could try also? I have to admit, I didn't know about this function. I (most often) write my return result to a variable to allow inspecting ;)

      Qt has to stay free or it will die.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dave2
        wrote on 30 Jan 2019, 15:29 last edited by
        #3

        The code I used to reproduce this problem is visible in its entirety in the stackoverflow link in my post above. Anyway, here is debugger_return_pane.pro:

        TEMPLATE = app
        SOURCES += main.cpp
        TARGET = DebuggerReturnPane
        

        and here is main.cpp:

        int foo()
        {
            return 0;
        }
        
        int main()
        {
            int x = foo();
            return x;
        }
        

        I am not sure how it could be more minimal.

        My environment:

        • Windows 10, 64-bit
        • Microsoft Visual Studio 2015 Update 3
        • Qt 5.6.2
        • Qt Creator 4.8.1

        Steps to reproduce:

        • set a breakpoint on the first statement of main()
        • lauch the debugger
        • F11 (steps into foo())
        • Shift+F11 (steps out of foo())
        • problem: no return value visible

        According to http://doc.qt.io/qtcreator/creator-debug-mode.html#local-variables-and-function-parameters :

        The Locals view consists of the Locals pane and the Return Value pane (hidden when empty).

        Whenever a program stops under the control of the debugger, it retrieves information about the topmost stack frame and displays it in the Locals view. The Locals pane shows information about parameters of the function in that frame as well as the local variables. If the last operation in the debugger was returning from a function after pressing Shift+F11, the Return Value pane displays the value returned by the function.

        This functionality (which is available in every debugger I can think of) is very useful. It avoids having to use the awkward workaround you mentioned in your answer.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dave2
          wrote on 30 Jan 2019, 18:42 last edited by
          #4

          Just tried at home, where I have the following environment:

          • Windows 10, 64-bit
          • Microsoft Visual Studio 2015 Update 3
          • Qt 5.11.3 (note the more recent version)
          • Qt Creator 4.8.1

          Same problem.

          A 1 Reply Last reply 30 Jan 2019, 20:20
          0
          • D dave2
            30 Jan 2019, 18:42

            Just tried at home, where I have the following environment:

            • Windows 10, 64-bit
            • Microsoft Visual Studio 2015 Update 3
            • Qt 5.11.3 (note the more recent version)
            • Qt Creator 4.8.1

            Same problem.

            A Offline
            A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on 30 Jan 2019, 20:20 last edited by aha_1980
            #5

            Hi @dave2,

            your example works perfectly fine with Creator 4.8.0 on Linux (Ubuntu 18.04 x64) for int variables:

            0_1548879543764_2179a5ff-091c-4c30-a3a1-5d40cd4b8891-grafik.png

            It fails, however, for the QString value (that might be a debugger limitation, I'm not sure).

            So the feature is working in principle, but it seems to have limitations depending on the debugger backend and data type.

            Regards

            Qt has to stay free or it will die.

            1 Reply Last reply
            3
            • D Offline
              D Offline
              dave2
              wrote on 31 Jan 2019, 06:00 last edited by
              #6

              Thank you for investigating this problem.

              Which version of Qt Creator do you have on Linux?

              A 1 Reply Last reply 31 Jan 2019, 06:07
              0
              • D dave2
                31 Jan 2019, 06:00

                Thank you for investigating this problem.

                Which version of Qt Creator do you have on Linux?

                A Offline
                A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on 31 Jan 2019, 06:07 last edited by aha_1980
                #7

                @dave2

                It's 4.8.0 here. I'll check on Windows later when I'm in office.

                Edit: I tested with:

                • MinGW + GDB: int is working, QString is displayed as ""
                • MSVC2010 + CDB does not work at all.

                @dave2: Would you mind creating a report at bugreports.qt.io containing your example? And please provide a link to that ticket here. Thanks

                Qt has to stay free or it will die.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dave2
                  wrote on 31 Jan 2019, 08:16 last edited by
                  #8

                  Done: https://bugreports.qt.io/browse/QTCREATORBUG-21913

                  Thank you for your help.

                  J 1 Reply Last reply 31 Jan 2019, 08:42
                  2
                  • D dave2
                    31 Jan 2019, 08:16

                    Done: https://bugreports.qt.io/browse/QTCREATORBUG-21913

                    Thank you for your help.

                    J Offline
                    J Offline
                    J.Hilk
                    Moderators
                    wrote on 31 Jan 2019, 08:42 last edited by
                    #9

                    @dave2
                    for completeness sake, I tested it with MacOS & Clang + LLDB, doesn't work at all there as well


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply
                    0

                    3/9

                    30 Jan 2019, 15:29

                    topic:navigator.unread, 6
                    • Login

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