Is there a way to see the return value of a function in Qt Creator (in my case using GDB as the debugger)?
I found answer 3505002 (how to use gdb command list), but I was looking for something within the GUI if possible.
Here is the link to the closest answer found:
How to use gdb command list to print a function's parameter and return value without pausing?
Adding BreakpointsIn the code editor, click the left margin or press F9 (F8 on macOS) on a particular line you want the program to stop. In the Breakpoint Preset view or the Breakpoints view: Double-click the empty part of the view. Right-click the view, and select Add Breakpoint in the context menu.
One can see the return value by stepping out of the function (using the "Step Out" button or the F11 key in the Windows version of Creator) in the GUI.
Note that exiting the function by single stepping (using the Step Over button or F10 in the Windows version of Creator) does not provide the result.
When stepping out, the return value is shown in the Locals and Expressions View in a window that pops up between the stack variables and the expression evaluators.
It would be nice to always be able to see the return value of the most recently exited function, but it appears that gdb does not readily support it, so it may be unlikely that Creator will support it anytime soon. Anyway, using the Step Out feature anytime the return value is needed is a sufficient workaround.
@Felix Dombek:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With