Creating a simple VS2008 visualizer inside autoexp.dat (cast problem)

I have a big mixed C / C ++ project. I 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 it works great. Inside the debugger, where I see the object, now I see the text inside the preview line.

Then I 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 works fine again. Whenever I see a StringHandleData object in the debugger, I see the text inside the string.

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

 typedef void* StringHandle; 

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

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

... this does not work. I tried many other ways to drop an object, but so far no luck. If I go to my viewport and draw a StringHandle like this ... (StringHandleData *) stringHandle , then the debugger will do the translations and previews correctly, but I just can't get it to do it automatically from inside autoexp.dat

Thanks for any help.

+4
source share
1 answer

The visual studio renderer is blind to typedefs and will think that StringHandle is void * .

+3
source

Source: https://habr.com/ru/post/1306110/


All Articles