解决方案没有简单的方法可以做到这一点.诸如 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扩展中,如何检测调试器何时继续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-19 11:17