本文介绍了Eclipse:编辑源代码并继续调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse IDE(Helios版本)
在Eclipse中调试时,是否可以编辑源代码并继续调试?



例如我有这个文件
调试时,我尝试修改a4值在调试时不反映?

  public class Tes {

public static void main(String args []){
int a4 = 15; (int i = 0; i


I am using Eclipse IDE (Helios Version) While debugging in Eclipse , is it possible to edit the source and continue debugging ??

For example i have this file While debugging when i tried to modify the a4 value during debugging its not reflecting ??

public class Tes {

    public static void main(String args[]) {
        int a4 = 15;

        for (int i = 0; i < a4; i++) {
            System.out.println(i);
        }

    }
}
解决方案

Yes it is possible to edit the source and continue debugging in Eclipse! You'll find extensive information here: Debugging with the Eclipse Platform (scroll down to the section Hotswap Bug Fixing: On-the-fly code fixing).

There are some cases where the feature will not work. E.g. if you make changes to your main method's a4 variable, the JVM will not be able to remove all stack frames running old code from the call stack. The debugger data will be lost.

To see the Hotswap Bug Fixing JVM feature in action, just move the code from your main method in the Test class to some other class. Here's what I mean:

Now you can modify the code on the fly while debugging in the MyObject class. Have fun!

EDIT: Just found a similar question at superuser.com: Debugging in Eclipse, how to run until a breakpoint

这篇关于Eclipse:编辑源代码并继续调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-03 23:48
查看更多