Debug Visualizer use member 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 debug visualizer preview?
For example, if my class is Person how can I do something like:
MyNamespace::Person{
preview(
#("FirstName=", $e->GetFirstName())
)
}
(You may ask why I don't just get the private member variable data and that is because GetFirstName() delegates to a 3rd party library method call, so I do not have access to the data member. Another reason could be the method performs some calculation.)
You might want to look at the following:
See comments about user custom functions here for some people's experience with this:
No the Visual Studio debugger only supports directly reading virtual memory. Supporting e->GetFirstName() would require doing introspection into the GetFirstName() function, which could be very complicated if GetFirstName() is non-trivial or virtual (worse yet GetFirstName() could have side-effects or crash). Changing autoexp.dat won't let you get around this problem.
If you really want to get this functionality, you could add a new debug-only member function like std::string *_firstName and point it to GetFirstName() on construction of Person, then have autoexp.dat dereference and display this variable for you.
链接地址: http://www.djcxy.com/p/52920.html上一篇: 序列化包含列表<T>的列表<T>