检查jdb中方法的返回值
假设在 jdb 中,我位于代码中的以下位置:
return 22;
-->}
如何转储要返回的对象(或基元)的值?在返回之前必须将返回值存储在局部变量中似乎很痛苦,这样我就可以看到将要返回的内容。
实际上,我想在 jdb 中执行 gdb 链接中描述的操作:
Suppose in jdb I am at the following spot in the code:
return 22;
-->}
How do I dump the value of the object (or primitive) that is going to be returned? It seems like a pain to have to store the return value in a local variable before returning it, just so that I can see what's going to be returned.
Effectively, I want to do in jdb what is described in the link for gdb:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虚拟机是面向堆栈的,因此不需要读取那些寄存器。在方法中,您可以跟踪方法退出,方法退出时将显示返回值。这并不完全是您所要求的,因为您只有在方法退出后才能看到该值。您的另一个选择是
打印
将返回的表达式,假设这没有副作用。Well the VM is stack orientated and so there is nothing like those registers to read. While in the method you can do
trace method exit
and the return value will be displayed when the method exits. This is not exactly what you asked since you only see the value once the method has exited. Your other option is toprint
the expression that will be returned, assuming this has no side-effects.