从调试器扩展中设置挂起的断点 [英] set pending breakpoint from within a debugger extension

查看:112
本文介绍了从调试器扩展中设置挂起的断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

Hi there,

我正在编写基于MIEngine的调试器扩展.我想做的一件事是允许在调试器启动时在main处停止,即调试器而不是用户需要在main()处设置断点.

I'm writing a debugger extension based on MIEngine. One thing I want to do is allow stop-at-main on debugger start, namely the debugger instead of user needs to set a breakpoint at main().

在MIDebugEngine/Engine.Impl/DebuggedProcess.cs-> GetInitializeCommands()中,有以下一行:

In MIDebugEngine/Engine.Impl/DebuggedProcess.cs->GetInitializeCommands(), there is this line:
   commands.Add(new LaunchCommand("-break-insert main", ignoreFailures: true));

它确实在main处设置了一个中断.但是当遇到断点时,此代码将对其进行处理:
    DebuggedProcess.HandleBreakModeEvent()
由于这行
    AD7BoundBreakpoint [] bkpt = _breakpointManager.FindHitBreakpoints(bkptno,addr,frame,out fContinue);
在BreakpointManager中找不到断点,此行稍后会发出继续命令
   //我们碰到了一个点,等待删除
   //发布CmdContinueAsync操作,以便在我们删除所有待处理的删除操作之前不会发生
    CmdContinueAsyncConditional(breakRequest);
这意味着该断点实际上已被跳过.

It does set a break at main. But when the breakpoint gets hit, this code handles it:
   DebuggedProcess.HandleBreakModeEvent()
As this line
    AD7BoundBreakpoint[] bkpt = _breakpointManager.FindHitBreakpoints(bkptno, addr, frame, out fContinue);
fails to find the breakpoint in BreakpointManager, a continue command is issued later by this line
   //we hit a bp pending deletion
   //post the CmdContinueAsync operation so it does not happen until we have deleted all the pending deletes
   CmdContinueAsyncConditional(breakRequest);
That means the breakpoint is practically skipped.

要解决该问题,我能想到的最佳解决方案是通过调用此断点来设置main

    Microsoft.MIDebugEngine.AD7Engine.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest,出IDebugPendingBreakpoint2 ppPendingBP)

To solve the problem, the best solution I can think of is to set the breakpoint at main by calling this
   Microsoft.MIDebugEngine.BreakpointManager.CreatePendingBreakpoint((IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
or
   Microsoft.MIDebugEngine.AD7Engine.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)

但是我遇到的障碍是如何创建"pBRRequest" API的对象.  界面 IDebugBreakpointRequest2是一个包含接口的复杂程序.到目前为止,我的研究没有好的方法.

But the road block I run into is how to create the "pBRRequest" object for the API.  The interface IDebugBreakpointRequest2 is a complex one with interfaces in it. My research so far yields no good way.

给我一个例子可以帮助您吗?

Could any one help by giving me an example ?

谢谢!

推荐答案

您好,LingW_2008,

Hi LingW_2008,

以下链接提供了有关如何创建IDebugBreakpointRequest2实例的示例,供您参考.

The following link provide a sample about how to create IDebugBreakpointRequest2 instance for your reference.

https://github.com/Microsoft/MIEngine/blob /master/src/MIDebugEngine/AD7.Impl/AD7PendingBreakpoint.cs

最诚挚的问候,

吴可乐


这篇关于从调试器扩展中设置挂起的断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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