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.)
In the Visual Studio toolbar, make sure the configuration is set to Debug. To start debugging, select the profile name in the toolbar, such as <project profile name>, IIS Express, or <IIS profile name> in the toolbar, select Start Debugging from the Debug menu, or press F5.
vscode on the left-navigation pane of the Explorer (Command+shift+e), enter Command+shift+d to enter into the “run and debug” set-up.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With