Inspect method return value in jdb

Suppose in jdb I am in the following place in the code:

return 22; -->} 

How can I reset the value of the returned object (or primitive)? It seems that pain should store the return value in a local variable before returning it so that I can see what will be returned.

In fact, I want to do in jdb what is described in the link for gdb:

How to check function return value in gdb?

+6
java debugging jdb
source share
1 answer

It’s good that the virtual machine is stack oriented, and therefore there is nothing like these registers. In the method, you can make the trace method exit , and the return value will be displayed when the method exits. This is not quite what you requested, since you only see the value after the method exits. Another option is a print expression that will be returned if it has no side effects.

+4
source share

All Articles