return value not shown by Qt Creator debugger
-
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?
-
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.
-
Hi @dave2,
your example works perfectly fine with Creator 4.8.0 on Linux (Ubuntu 18.04 x64) for int variables:
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
-
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
-
Done: https://bugreports.qt.io/browse/QTCREATORBUG-21913
Thank you for your help.