Debug eclipse IDE itself

前端 未结 5 1220
别跟我提以往
别跟我提以往 2020-12-14 13:21

I would love to learn how to debug eclipse IDE. Back to the time when I was using VS for .NET development, I can attach VS to a process at anytime and start to trace down th

相关标签:
5条回答
  • 2020-12-14 13:35

    One thing you can do with any Java application to see what is going on right now is send it a kill -QUIT. This will cause the JVM to dump the stack traces for all of its threads to stdout. Do this three times with a second in between and you can see which threads are not moving along nicely.

    Another thing to try is to attach a JConsole to the running process.

    0 讨论(0)
  • 2020-12-14 13:38

    Back to the time when I was using VS for .NET development, I can attach VS to a process at anytime and start to trace down the problem.

    Remote debugging is also possible in Java with the Java Platform Debugger Architecture (JPDA), you just need to start the application you want to debug with remote debugging enabled. Here is an article showing how to do this and how to configure Eclipse to debug a remove application.

    Note that starting from Java 5, you should prefer the -agentlib:jdwp option over the -Xdebug and -Xrunjdwp options as explained in Sun VM Invocation Options.

    Update: Eclipse is a Java application so it should be possible to add the options mentioned in the article in eclipse.ini. Never tried that though (I missed the fact that you want to debug Eclipse itself).

    0 讨论(0)
  • 2020-12-14 13:38

    There are basically two ways of debugging a Java application (e.g. Eclipse). You can use JConsole, but it won't give you a lot of details. For attaching JConsole you have to enable remote debugging; this needs a JVM argument that you can write into the eclipse.ini file right next to the Eclipse executable.

    Another option is to start a runtime workbench from Eclipse: this is used to test your own plug-ins, but as Eclipse plug-ins are the same, it is possible to start a debug session with an Eclipse application. To do this, you need at least one plug-in in your workspace (e.g. create a new hello world plugin project), and you can then debug this as an Eclipse application.

    0 讨论(0)
  • 2020-12-14 13:41

    Edit your eclipse.ini file an add the following to the bottom (beneath -vmargs):

    -Xdebug
    -Xnoagent
    -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
    

    Then in another Eclipse of the same version, you can import the plugins you are interested in debugging. File -> Import ... -> Plug-in Development -> Plug-ins and Fragments. Import From the active platform, and Import As "Projects With Source Folders", on the next tab select the plugins you are interested in.

    Set breakpoints as appropriate.

    Then create in Debug Configurations, create a new "Remote Java Application". localhost, port 8000. Add the Java projects on the source tab, and debug.

    0 讨论(0)
  • 2020-12-14 13:49

    There's a thread about finding cause of a freezing Eclipse.

    One of the solutions suggests starting Eclipse with -consolelog option. This might be useful for taking a quick glance on what's going on (before doing actual debugging).

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