在Visual Studio扩展中,如何检测调试器何时继续 [英] In a Visual Studio Extension, how to detect when the debugger Continues

查看:104
本文介绍了在Visual Studio扩展中,如何检测调试器何时继续的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要我的Visual Studio扩展才能对调试事件做出反应.我已经注册了IDebugEventCallback2并且正在接收事件,但是我为每个事件得到的只是一个不透明的IDebugEvent2和Guid,其中许多不仅没有文档记录,而且没有出现在网络上的任何位置(或在我的注册表中.)

我目前的具体要求是知道流程何时继续-即.用户点击了继续",运行到光标"等.我应该寻找什么向导?

或者我应该订阅其他活动项目吗?

(更一般地说,当许多事件没有出现在MSDN或其他任何地方时,我是否有某种方式找不到传递给我的IDebugEventCallback2::Event回调的事件?谢谢!)

解决方案

没有简单的方法可以做到这一点.诸如 Continue Run to cursor 之类的操作是Visual Studio所实现的抽象,与调试引擎有关,不与任何唯一事件相对应.调试引擎事件报告界面IDebugEventCallback2将使您仅在诸如创建断点或达到断点之类的细粒度事件时得到通知.

虽然Visual Studio使您能够以编程方式执行诸如 Continue (继续)和 Run to cursor (运行到光标)之类的操作,但它并没有提供直接的方式来通知用户何时采取措施./p>

您可以使用 EnvDTE.DebuggerEvents.OnXxx 事件来在即将发生的事情时得到通知.特别地,OnEnterBreakMode事件使您能够拦截断点命中并可能采取措施.您还可以使用当前检查到达的断点的所有详细信息.事件处理程序中的EnvDTE.Debugger .

现在,您可以花一些精力,使用这些构造来实现与所有Visual Studio调试操作相对应的事件,包括准确地继续运行到光标.如果您需要EnvDTE.DebuggerEvents未提供的其他事件(例如,插入断点时),则别无选择,只能使用IDebugEventCallback2.Event.在这种情况下,如果您考虑到特定事件,请明确提及它们,我也许可以告诉您相应的IDebugEventCallback2.Event GUID.

I need my Visual Studio extension to react to debugging events. I've registered a IDebugEventCallback2 and I'm receiving events, but all I get for each event is an opaque IDebugEvent2 and a Guid, many of which are not only undocumented but don't appear anywhere on the web (or in my registry).

My specific requirement at the moment is to know when the process is Continued - ie. the user has hit Continue, Run to cursor, etc. What Guid should I be looking for?

Or is there some other event family that I should be subscribing to?

(More generally, is there some way I'm missing to find out about the events that are delivered to my IDebugEventCallback2::Event callback, when many of them don't appear in MSDN or anywhere else? Thanks!)

解决方案

There is no easy way to do this. Actions such as Continue and Run to cursor are abstractions implemented by Visual Studio and do not correspond to any unique event(s) with respect to the debug engine. The debug engine event reporting interface IDebugEventCallback2 will enable you to get notified only on fine-grained events such as when creating a breakpoint or reaching a breakpoint.

While Visual Studio enables you to perform actions such as Continue and Run to cursor programmatically, it does not provide a direct way to get notified when they are taken.

You can use EnvDTE.DebuggerEvents.OnXxx events to get notified when something is about to happen. In particular, the OnEnterBreakMode event enables you to intercept a breakpoint hit and possibly take an action. You can also inspect all the details of the reached breakpoint(s) using the current EnvDTE.Debugger inside the event handler.

Now with some effort, you can use these constructs to implement events that correspond to all Visual Studio debugging actions including Continue and Run to cursor accurately. If you require additional events not provided by EnvDTE.DebuggerEvents (such as when a breakpoint is inserted), you have no choice but use IDebugEventCallback2.Event. In this case if you have specific events in mind, please mention them explicitly and I might be able to tell you the corresponding IDebugEventCallback2.Event GUIDs.

这篇关于在Visual Studio扩展中,如何检测调试器何时继续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆