VS 调试器跳过 base class 中的 ctors

VS debugger skips ctors in base class

似乎 Visual Studio 调试器(我检查了 VS 2015 和 VS 2017)跳过了基础 class 中的构造函数和赋值运算符。如果我使用以下代码创建一个新的 C++ Win32 控制台应用程序项目

#include <iostream>

struct B
{
    B() { std::cout << "ctor"; }
};

struct S : B { };

int main()
{
    S s1;

    return 0;
}

我无法进入 B::B(),打印 "ctor" 并且调试器转到 "return 0;" 行。在反汇编中,"call S::S (01713D4h)" 后跟一段不属于任何来源的代码 ("Source not available"):

00E51DF0  push        ebp  
00E51DF1  mov         ebp,esp  
00E51DF3  sub         esp,0CCh  
00E51DF9  push        ebx  
00E51DFA  push        esi  
00E51DFB  push        edi  
00E51DFC  push        ecx  
00E51DFD  lea         edi,[ebp-0CCh]  
00E51E03  mov         ecx,33h  
00E51E08  mov         eax,0CCCCCCCCh  
00E51E0D  rep stos    dword ptr es:[edi]  
00E51E0F  pop         ecx  
00E51E10  mov         dword ptr [this],ecx  
00E51E13  mov         ecx,dword ptr [this]  
00E51E16  call        B::B (0E51389h)  

如何进入 B::B()(不使用断点)?

我遇到了和你一样的问题,没有找到可能影响调试器工具的 VS 设置,所以我帮你把这个问题报告给这里的产品团队:

https://developercommunity.visualstudio.com/content/problem/77978/vs-debugger-skips-ctors-in-base-class.html.

如果可能,您也可以添加您的评论并直接对该报告进行投票。如果我从产品团队那里得到任何更新,我会在这里分享。