Is there any proper way to set a conditional breakpoint in Visual Studio 2015 such that it breaks whenever a pointer to a base class points to a specified subclass type? (see example screenshot below)
I don't want to have to spend time writing debug utility code for this, nor do I want to hack virtual table data.
Two ways to do it:
Add below as your breakpoint condition in your IDE:
dynamic_cast<DerivedClassYouWantToBreak*>(ptr.get())
Or add below code to your code and compile:
if (dynamic_cast<DerivedClassYouWantToBreak*>(ptr.get()))
{
int breaksHere = 0; // put breakpoint here
}