Java 使用JDT远程控制Eclipse调试

Java 使用JDT远程控制Eclipse调试,java,eclipse,eclipse-plugin,remote-debugging,eclipse-jdt,Java,Eclipse,Eclipse Plugin,Remote Debugging,Eclipse Jdt,我正在编写一个需要使用EclipseJDT进行远程调试的应用程序。我的应用程序和eclipse之间的通信很好,我正在使用以下方法来管理断点: IBreakpointManager mgr = DebugPlugin.getDefault().getBreakpointManager(); mgr.getBreakpoints(); 要添加断点,请执行以下操作: IJavaLineBreakpoint breakpoint = JDIDebugModel.createLineBreakp

我正在编写一个需要使用EclipseJDT进行远程调试的应用程序。我的应用程序和eclipse之间的通信很好,我正在使用以下方法来管理断点:

 IBreakpointManager mgr = DebugPlugin.getDefault().getBreakpointManager();
 mgr.getBreakpoints();
要添加断点,请执行以下操作:

  IJavaLineBreakpoint breakpoint = JDIDebugModel.createLineBreakpoint(...)
  IJavaLineBreakpoint breakpoint = JDIDebugModel.lineBreakpointExists(...);
  breakpoint.delete();
要删除断点,请执行以下操作:

  IJavaLineBreakpoint breakpoint = JDIDebugModel.createLineBreakpoint(...)
  IJavaLineBreakpoint breakpoint = JDIDebugModel.lineBreakpointExists(...);
  breakpoint.delete();
要列出所有断点,请执行以下操作:

 IBreakpointManager mgr = DebugPlugin.getDefault().getBreakpointManager();
 mgr.getBreakpoints();
但是现在我的项目在我通过编程创建的断点中“暂停”,我不知道如何启动操作(步骤结束、步骤进入、恢复)。我尝试了以下操作,但不起作用:

DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {new DebugEvent(getResource(projectId, fullClassName), DebugEvent.STEP_OVER)});
我需要知道的是:

  • 如何向eclipse调试器发送单步执行和单步执行命令
我在eclipse源代码中做了一些研究,解决了这个问题

诀窍在于,不要像我在创建Breakpont时那样使用静态方法

JDIDebugModel.createLineBreakpoint(...)
resumestepOver方法是在调试模式下执行的线程的一部分。因此,我必须保存ILauch对象,因为这样我就可以访问调试线程

    // I have to store it in a field for late use.
    ILaunch launch = new Launch(null, ILaunchManager.DEBUG_MODE, null);
    ...
    // Then I can access the thread and call stepover or resume methods
    IDebugTarget target = launch.getDebugTarget(); 
    IThread[] threads = target.getThreads();
    threads[0].stepOver();
    threads[0].resume();
    threads[0].stepInto();