创建 Eclipse 调试视图

发布于 2024-12-28 19:23:28 字数 303 浏览 2 评论 0原文

我正在 Eclipse 插件中开发自定义调试视图。在这个视图中,我需要知道我们何时处于调试模式以及当前是否命中断点。

目前,当我的视图处于活动状态时,我可以通过侦听 DebugPlugin 和 IBreakpointManager 中的各种调试事件来实现此功能。当我的视图已打开并且插件已激活时,此方法有效,但如果我的视图在调试会话期间打开,则它无法知道调试会话是否已启动。

有没有办法明确检查调试会话是否正在进行?一种可能性是强制我的插件在 Eclipse 加载时自动启动,但我宁愿避免这种情况。

有什么想法吗?

谢谢, 艾伦

I am working on a custom debug view in an Eclipse plugin. In this view, I need to know when we are in debug mode and if a breakpoint is currently hit.

At the moment I have this working when my view is active by listening for the various debug events in DebugPlugin and IBreakpointManager. This works when my view has already been opened and the plugin is activated, but if my view is opened during a debug session then it has no way of knowing if a debug session has started or not.

Is there any way to explicitly check if a debug session is in progress? One possibility is to force my plugin to start automatically when Eclipse loads but I would rather avoid that.

Any ideas?

Thanks,
Alan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

执手闯天涯 2025-01-04 19:23:28

当您的插件激活时,您可以获取启动管理器:

ILaunchManager = DebugPlugin.getDefault().getLaunchManager();

ILaunchManager 可以为您提供一组 ILaunch:

ILaunch[] launches = launchManager.getLaunches();

每个 ILaunch 都有一些调试目标:

IDebugTarget[] debugTargets = launch.getDebugTargets();

...并且每个 IDebugTarget 可以告诉您它当前是否已挂起:

debugTarget.isSuspended();

我会建议阅读这些 API 并进行一些调试,以确定如何确定调试会话是否处于活动状态并且当前是否命中断点。我现在没时间帮你查一下。

注意:如果没有使用调试插件,则其默认值为空。

When your plug-in activates you can get a hold of the launch manager:

ILaunchManager = DebugPlugin.getDefault().getLaunchManager();

An ILaunchManager can gives you an array of ILaunch:

ILaunch[] launches = launchManager.getLaunches();

Each ILaunch has some debug targets:

IDebugTarget[] debugTargets = launch.getDebugTargets();

...and each IDebugTarget can tell you if it is currently suspended:

debugTarget.isSuspended();

I would suggest reading these APIs and doing a bit of debugging to determine exactly how to work out if a debug session is active and a breakpoint is currently hit. I haven't got time just now to check that for you.

Note: if the debug plug-in is not being used then its default will be null.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文