So, if you've just taken a step in live debugging (F10 or F11), you can use the Step Backward button to quickly navigate to the previous step. This will automatically put Visual Studio in Historical debugging mode, at the line of code you've stepped back to.
Smart step intoFrom the main menu, select Run | Debugging Actions | Smart Step Into or press Shift+F7 . Click the method. You can also select it using the arrow keys or tabs and press Enter / F7 .
You can click on the Run icon in the gutter area and select the Debug option. You can invoke context actions on the class or main method by using Alt+Enter and choose the Debug action. You can also start it from the Run menu, or by pressing Shift F9.
On IntelliJ IDEA 2016.3: it's hidden inside the cog button of the debug panel. Ensure Show Method Return Values
is checked.
Use the debugger to break somewhere inside the function whose return value you'd like to see.
Step out of the function (or step over until you escape):
Observe that the return value appears in your variables:
There is Watch method return values button available in the debugger panel.
Watch method return values: Click this button to watch return values of the last executed method.
IDEA 12 configuration:
There seems to be a couple ways you can do this. The first one involves setting up the breakpoint on the method signature, in your case you would setup a breakpoint on Object method(){ . This will allow you to watch for the entrance and exit of the method. I believe you have to use this in conjunction with "Watch method return values" like stated above, but I haven't been able to completely test this as it takes too long to compute. Beware, this does dramatically decrease the performance of the debugger and it will take longer to debug.
Also you can do the following manually.
Note: If you create a breakpoint, there are a lot of things you can tell IDEA to do with them, such as if you break on a breakpoint, you can tell them to perform an expression and log it. You can look around with what you can do if you right-click on a breakpoint and click properties.
UPDATE: Try this in conjunction with the first way of doing it. Don't use "Watch method return values" as it seems to slow down or freeze up the debugging session. Instead do the following
Remember that method breakpoints are slower so it might take more time, a tricky way to improve this if you are noticing too much of a performance hit is by just setting the return statement breakpoint (without having a method breakpoint) and then adding the method breakpoint AFTER the return statement breakpoint hits and then continuing.
Hope this helps,
This was asked a while ago, but I use a different method when I want to handle this situation.
When debugging, you can mark the expression (in your case, the expression right after the "return") and hit CTRL + ALT + F8 (Quick Evaluate Expression). IntelliJ will pop up a little window showing you the value that will be returned.
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