《Professional Visual Studio 2008 Extensibility》第三章(二)

     3. Visualizer 的作用是在debug 时能根据用户的特殊需求来展示自定义数据,这个扩展和WATCH1查看变量的功能很类似。

         例如,可以将下面这个类型的数据,以特点的方式展示给用户,易于用户理解(20xx/xx/xx)

typedef struct _SYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;

         EEAddIn Sample: Debugging Expression Evaluator Add-In 可以从这个链接中看到频屏和源代码。

      其中,在custview.h头文件的声明是不能更改的。


typedef struct tagDEBUGHELPER
{
    DWORD dwVersion;
    BOOL (WINAPI *ReadDebuggeeMemory)( struct tagDEBUGHELPER *pThis, DWORD dwAddr, DWORD nWant, VOID* pWhere, DWORD *nGot );
    // from here only when dwVersion >= 0x20000
    DWORDLONG (WINAPI *GetRealAddress)( struct tagDEBUGHELPER *pThis );
    BOOL (WINAPI *ReadDebuggeeMemoryEx)( struct tagDEBUGHELPER *pThis, DWORDLONG qwAddr, DWORD nWant, VOID* pWhere, DWORD *nGot );
    int (WINAPI *GetProcessorType)( struct tagDEBUGHELPER *pThis );
   

} DEBUGHELPER;

typedef HRESULT (WINAPI *CUSTOMVIEWER)( DWORD dwAddress, DEBUGHELPER *pHelper, int nBase, BOOL bUniStrings, char *pResult, size_t max, DWORD reserved );

      谁来调用AddIn_SystemTime这个函数呢,答案是NatDbgEE.dll!7198d8e8()  如下图所示:

01   

     如何才能在AddIn_SystemTime函数中下断点呢?

      1. 分别用VS打开eeaddin solution 和Debugging Evaluator solution.

      2. 编译eeaddin solution 并将其DLL和pdb 放到D:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE中

      3. 修改autoexp.dat如

             [AutoExpand]
             _SYSTEMTIME=$ADDIN(eeaddin.dll,AddIn_SystemTime)

      4.编译运行Debugging Evaluator solution. 显示正确。

      5. 将eeaddin solution attach到 Debugging Evaluator solution VS IDE,然后再运行Debugging Evaluator solution.将在AddIn_SystemTime中下断点。 当mouse move over SYSTEMTIME 变量时,断点就被激活。

源码:SampleCode-NativeCoding-VCVisualizer

转载于:https://www.cnblogs.com/fbwang2011/archive/2013/03/11/2953321.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值