Eclipse 中 drop to frame 的调试技巧

Select the Drop to Frame command [ ] to re-enter the selected stack frame in the Debug View.

Note this command is only available if the current VM supports drop to frame and the selected stackframe is not the top frame or a frame in a native method.

就是说,这个功能可以重新跳到当前方法的开始处重新执行,并且所有上下文变量的值也回到那个时候。不一定是当前方法,可以点击当前调用栈中的任何一个frame跳到那里(除了最开始的那个frame)。主要用途是所有变量状态快速恢复到方法开始时候的样子重新执行一遍,即可以一遍又一遍地在那个你关注的上下文中进行多次调试(结合改变变量值等其它功能),而不用重来一遍调试到哪里了。当然,原来执行过程中产生的副作用是不可逆的(比如你往数据库中插入了一条记录)。

猜你喜欢

转载自angie.iteye.com/blog/2324872