Eclipse 插件 - 处理单步或中断时的事件
是否有从 Eclipse 调试器接收事件通知的通用方法。具体来说,我只想知道用户何时跨过/进入以及何时命中断点。
我已经在 JDT 中实现了此功能(请参阅我的其他问题:Eclipse 调试器事件),但技术相同在 CDT 中不起作用(我正在使用 DebugPlugin.addDebugEventListener)。
如果没有通用的方法来做到这一点,那么有没有办法避免 CDT 依赖项在 JDT 中运行时破坏插件?
谢谢, 艾伦
Is there a generic way of receiving event notifications from the Eclipse debugger. Specifically I would just like to know when the user steps over/into and when a breakpoint is hit.
I have already got this working in JDT (see my other question: Eclipse Debugger Events) but the same technique doesn't work in CDT (I am using DebugPlugin.addDebugEventListener).
If there is no generic way of doing this, then is there a way to avoid the CDT dependencies from breaking the plugin when it is run in JDT?
Thanks,
Alan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我找到了可能对其他人有用的替代方案。您可以使用上面概述的方法在会话创建和终止时侦听调试事件。
对于任何步进事件,我发现的一种方法是注册一个 IExecutionListener,以便收到 Eclipse 工作区中发生的所有命令的通知。您可以通过获取 ICommandService 来注册执行侦听器,如下所示:
然后添加执行侦听器:
这将为您提供各种事件处理程序(notHandled、postExecuteFailure、postExecuteSuccess、preExecute),您可以从中通过 commandId 值进行过滤。
我希望这对其他人有帮助。
艾伦
OK, I've found an alternative that may be of use for others. You can use the method outlined above to listen for debug events when the session is created and terminated.
For any stepping events, one way I found was to register an IExecutionListener to be notified of all commands that take place in the Eclipse workspace. You can register an execution listener by getting hold of an ICommandService as follows:
Then add an execution listener:
This will give you various event handlers (notHandled, postExecuteFailure, postExecuteSuccess, preExecute) from which you can filter by the commandId value.
I hope this helps someone else.
Alan