Eclipse 调试器事件

2022-01-16 00:00:00 debugging events eclipse-plugin eclipse

在我的 Eclipse 插件中,我希望收到有关调试器事件的通知(例如,当单步执行或遇到断点时).通过使用以下代码订阅调试事件,我已设法使其在 JDT 环境中工作:

In my Eclipse plugin, I would like to be notified on debugger events (e.g. when stepping or a breakpoint is hit). I've managed to get this working in a JDT environment by subscribing to debug events using this code:

DebugPlugin.getDefault().addDebugEventListener(this);

这给了这个事件处理程序:

Which gives this event handler:

public void handleDebugEvents(DebugEvent[] events)
{
}

在 JDT 中,这是在 Breakpoint 或 Suspend 事件上触发的,我希望 CDT 中的行为相同.然而,事实并非如此.我在调试会话开始时只收到两个 Create 事件:

In JDT this is fired on Breakpoint or Suspend events and I was hoping the behaviour would be the same in CDT. However, it is not. I only get two Create events at the start of the debug session:

DebugEvent[org.eclipse.cdt.dsf.gdb.launching.GDBProcess@ae0aae,创建,未指定]DebugEvent[org.eclipse.debug.core.model.RuntimeProcess@920d5d, CREATE, UNSPECIFIED]

DebugEvent[org.eclipse.cdt.dsf.gdb.launching.GDBProcess@ae0aae, CREATE, UNSPECIFIED] DebugEvent[org.eclipse.debug.core.model.RuntimeProcess@920d5d, CREATE, UNSPECIFIED]

是否存在不需要特定依赖于 JDT 或 CDT 的通用解决方案?

Is there a generic solution that wouldn't require specific dependencies on JDT or CDT?

谢谢,艾伦

推荐答案

我确实找到了解决方案并在这里回答了我的其他问题:Eclipse 插件 - 在步进或中断时处理事件

I did find a solution and have answered my other question here: Eclipse plugin - handling events when stepping or breaking

艾伦

相关文章