Eclipse :Edit the source and continue debugging

后端 未结 3 1283
被撕碎了的回忆
被撕碎了的回忆 2021-02-08 07:31

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 debu

相关标签:
3条回答
  • 2021-02-08 08:12

    If you just want to change the value of a5 during debugging its alot easier than changing the source. You can set a new value in the variables view you can see when in the debugging perspective in Eclipse.

    See the manual here and here

    0 讨论(0)
  • 2021-02-08 08:18

    If you happen to be running your application using a 1.3 JVM or higher versions, there's one final step with the debugger still running: -> change the problem line - in your case "a4 value" and then Save the file, then press the Resume button to get the application running again.

    This Saving of that particular java file that you have edited during debugging, will make the session to continue debugging from start(Constructor) of the file with new values.

    This editing and saving can be done n number of times, and once you save it, the debugging session will automatically resume from the start of that particular file.

    0 讨论(0)
  • 2021-02-08 08:21

    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).

    If you are running Java Virtual Machine (JVM) V1.4 or higher, Eclipse supports a feature called Hotswap Bug Fixing (not available in JVM V1.3 or lower). It allows the changing of source code during a debugger session, which is better than exiting the application, changing the code, recompiling, then starting another debugging session. To use this function, simply change the code in the editor and resume debugging.

    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:

    Hotswap Bug Fixing in Action

    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

    0 讨论(0)
提交回复
热议问题