Eclipse 调试器事件

2023-08-22Java开发问题
4

本文介绍了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

艾伦

这篇关于Eclipse 调试器事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

在 Eclipse 项目中使用西里尔文 .properties 文件
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)...
2024-08-25 Java开发问题
18

Eclipse 在尝试启动 Android 应用程序时卡住了
Eclipse gets stuck when trying to launch Android app(Eclipse 在尝试启动 Android 应用程序时卡住了)...
2024-08-25 Java开发问题
14

Eclipse:无法初始化监视器线程:无法建立环回连接
Eclipse: Failed to initialize Monitor Thread: Unable to establish loopback connection(Eclipse:无法初始化监视器线程:无法建立环回连接)...
2024-08-25 Java开发问题
4

Eclipse-找不到JDK
Eclipse- JDK not found(Eclipse-找不到JDK)...
2024-08-25 Java开发问题
6

如何让 Eclipse 在 Windows 7 任务栏中表现良好?
How to make Eclipse behave well in the Windows 7 taskbar?(如何让 Eclipse 在 Windows 7 任务栏中表现良好?)...
2024-08-25 Java开发问题
9

本机方法中的致命错误:JDWP 未初始化传输,jvmtiError=AGENT_ERROR_TRANSPORT_INIT
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)(本机方法中的致命错误:JDWP 未初始化传输,jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197))...
2024-08-25 Java开发问题
107