有没有正确的方法在Visual Studio 2015中设置条件断点,只要指向基类的指针指向指定的子类 类型 ,它就会中断? (见下面的示例截图)
我不想花时间为此编写调试实用程序代码,也不想破解虚拟表数据。
答案 0 :(得分:1)
两种方法:
在IDE中添加以下作为断点条件:
dynamic_cast<DerivedClassYouWantToBreak*>(ptr.get())
或者在代码中添加以下代码并编译:
if (dynamic_cast<DerivedClassYouWantToBreak*>(ptr.get()))
{
int breaksHere = 0; // put breakpoint here
}