在autoexp.dat内创建一个简单的VS2008可视化工具(铸造问题) [英] Creating a simple VS2008 visualizer inside autoexp.dat (problem with casting)

查看:251
本文介绍了在autoexp.dat内创建一个简单的VS2008可视化工具(铸造问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个混合C / C ++的大项目。我为ICU UnicodeString类创建了一个简单的可视化工具,如下:

  [inside autoexp.dat] 
icu_4_2 :: UnicodeString {
preview([$ c.fUnion.fFields.fArray,su])
}

...并且工作正常。在调试器中,无论我在哪里看到对象,我现在看到预览行中的文本。



然后我创建了一个包含这些对象的包装类如下:

  class StringHandleData 
{
public:
icu_4_2 :: UnicodeString str;
};

...然后为此创建另一个可视化工具...

  [inside autoexp.dat] 
StringHandleData {
preview([$ c.str.fUnion.fFields.fArray,su])
}

...再次,工作正常。每当我在调试器中看到一个StringHandleData对象,我看到的字符串里面的文本。



但是,我的问题出现时,我定义一个typedef我可以使用C代码this ...

  typedef void * StringHandle; 

...它实际上只是一个ptr到StringHandleData对象。所以当我尝试创建一个可视化的StringHandle类型像这样...

  [inside autoexp.dat] 
StringHandle {
preview([((StringHandleData)$ c).str.fUnion.fFields.fArray,su])
}

...它不工作。我试过很多其他的方式来铸造对象,但没有运气到目前为止。如果我去我的观察窗口,并施放一个StringHandle像这样... (StringHandleData *)stringHandle 然后调试器使正确的转换和预览 - 但我只是似乎无法得到它

解决方案

感谢您的帮助。 p> Visual studio的visualizer对于typedef是盲目的,会认为 StringHandle 是一个 void *


I have a large project of mixed C/C++. I've created a simple visualizer for the ICU UnicodeString class as follows...

[inside autoexp.dat]
icu_4_2::UnicodeString {
        preview     ([$c.fUnion.fFields.fArray,su])
}

...and that works fine. Inside the debugger wherever I see the object I now see the text inside in the preview line.

I then created a wrapper class containing one of these objects as follows...

class StringHandleData
{
public:
    icu_4_2::UnicodeString str;
};

...and then created another visualizer for this...

[inside autoexp.dat]
StringHandleData {
    preview     ([$c.str.fUnion.fFields.fArray,su])
}

...which again, works fine. Whenever I see a StringHandleData object in the debugger I see the text inside in the string.

However, my problem comes when I define a typedef I can use inside C code like this...

typedef void* StringHandle;

...which under the hood is actually just a ptr to a StringHandleData object. So when I try and create a visualizer for the StringHandle type like this...

[inside autoexp.dat]
StringHandle {
    preview     ([((StringHandleData)$c).str.fUnion.fFields.fArray,su])
}

...it doesn't work. I've tried lots of other ways of casting the object too but with no luck so far. If I go to my watch window and cast a StringHandle like this... (StringHandleData*)stringHandle then the debugger makes the cast and previews correctly - but I just can't seem to get it to do it automatically from inside autoexp.dat

Thanks for any help.

解决方案

Visual studio's visualiser is blind to typedefs and will think StringHandle is a void *.

这篇关于在autoexp.dat内创建一个简单的VS2008可视化工具(铸造问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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