Debugging Visualizer use method method / function call in preview?

Using Visual Studio 2010 with native C ++. When editing autoexp.dat, is it possible to use the results of a method call in a preview of the debug visualizer?

For example, if my class is Person, how can I do something like:

MyNamespace::Person{ preview( #("FirstName=", $e->GetFirstName()) ) } 

(You may ask why I do not just get the data of private member variables, but because GetFirstName () delegates the method call to a third-party library, so I do not have access to the data member. The method does some calculations.)

+7
source share
2 answers

The Visual Studio debugger does not support direct reading of virtual memory. Support for e> GetFirstName () will require introspection into the GetFirstName () function, which can be very complex if GetFirstName () is non-trivial or virtual (worst of all, GetFirstName () may have side effects or crash). Changing autoexp.dat will not let you get around this problem.

If you really want to get this functionality, you can add a new debug member function, such as std :: string * _firstName, and point it to GetFirstName () when building Person, and then expand the autoexp.dat spread and display this variable for you.

+1
source

All Articles