3
votes

I'm using Visual Studio 2015 Update 3 and I have a very simple pure Win32 console C++ "Hello World" like this, that serves no purpose other than doing experimentation:

int main()
{
  printf("Hello world");
  char *test = (char*)malloc(100);
}

I cannot step into malloc if the project uses the Multi-threaded DLL runtime library (Project Properties->Configuration Properties->C/C++/->Runtime Library : Multi-threaded Debug DLL (/MDd)).

But when I change this setting to Multi-threaded Debug (/MTd), then steping into malloc works fine.

But stepping info printf always works fine. Stepping into my own code always works fine too.

Is there a way to enable stepping into the runtime library DLL ?

2
That DLL was built by Microsoft, you don't have the PDB for it. You'll need to get from Microsoft's symbol server by enabling it. Tools > Options > Debugging > Symbols. Works fine for Update 2, not sure about 3, I'm going to wait out the large number of bugs in that update. - Hans Passant
@HansPassant I've just tried that, but "Microsoft Symbol Servers" was already checked, and that wouldn't explain why stepping into printf works but not into malloc. BTW I installed Update 2 yesterday, but once the installation was finished, it turned out to be actually Update 3. I haven't tried stepping into mallocwith earlier versions of VS. - Jabberwocky
Malloc() is located in a different DLL, ucrtbased.dll. That one should not have changed, ymmv. Use Debug > Windows > Modules and look at the Symbol File column to see where the PDB is located. Delete it so it has to download a fresh copy. - Hans Passant
@HansPassant just tried this. I deleted the PDB file successfully after quitting Visual Studio. Then I restarted VS, I debugged the code again, VS downloaded the ucrtbased.pdb again, but I'm still unable to step into malloc. - Jabberwocky
Nothing anybody here can do about it, you need to use connect.microsoft.com to report this problem. - Hans Passant

2 Answers

6
votes

There was an error when the symbols for ucrtbased.dll build 10.0.10240.0 were published to the symbol server; the unstripped symbols (with source information) were originally published to the symbol server, but then were overwritten later when the stripped symbols were published.

We have resolved this issue and re-published the unstripped symbols. If you attempt to download symbols for this DLL from the symbol server now, you should get the unstripped symbols.

If you have already downloaded the stripped symbols, you will need to delete them from your symbol cache in order for the debugger to consider re-downloading the unstripped symbols. In Visual Studio, go to Tools => Options, Debugging => Symbols. There is a text box there, "Cache symbols in this directory." Close Visual Studio. Open that directory in Windows Explorer and search for "ucrtbased". Delete all of the PDB files that the search turns up.

1
votes

Install Windows 10 SDK (it will also update ucrtbased.dll in System32 as a side effect).