Why can't I debug?

2019-01-14 22:07发布

When I was about to debug C++ program in VS2005,the program didn't stop at the breakpoints.

The VS said"No symbols are loaded for any call stack frame. The source code cannot be displayed".

What can I do?

8条回答
干净又极端
2楼-- · 2019-01-14 22:18

For whatever reason you don't have the right symbols (.pdb files) in the symbol path. This could be for several reasons:

1) Your binary was compiled more recently than the .pdb files. Try recompiling everything.

2) You are trying to debug a .dll and forgot to copy the .pdb files. Copy those files too.

It's also possible that your code isn't being executed like you think.

查看更多
可以哭但决不认输i
3楼-- · 2019-01-14 22:21

I've experienced this problem (using c# in VS) when trying to debug my unit tests.

You can add the following code that will launch a new instance of the debugger that will allow you yo step through your code like normal:

System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();
查看更多
疯言疯语
4楼-- · 2019-01-14 22:21

I have solved this problem in WP7 by doing this:

  1. Right click the project from Solution Explorer (Ctrl+W+S)
  2. Select Rebuild.
  3. Again, select the project, right click it and choose Deploy.
  4. Start Debugging (F5)

I hope it will help you!

查看更多
等我变得足够好
5楼-- · 2019-01-14 22:23

A few steps to try:

  1. Debug->Step Into (this will ensure you stop right after you start)
  2. Debug->Windows->Modules
  3. Look for your foo.exe on the list.
  4. Check Symbol Status. Does it say it is loaded?
  5. If not, go to the path and ensure that: a) there is a file called foo.pdb there b) the timestamp on foo.pdb matches foo.exe (or is really close)
查看更多
倾城 Initia
6楼-- · 2019-01-14 22:32

Complete clean and rebuild, making sure .pdb's get created?

查看更多
Fickle 薄情
7楼-- · 2019-01-14 22:41

Just to add another possibility not yet covered by MainID:

When debugging, I actually started some program that would call into the classes I wanted to debug (it's some sort of add on). The called program is partly written in unmanaged C++. When I checked "Enable unmanaged code debugging" the error would come up (and subsequently the program crashed) because the program did not have any debug information.

查看更多
登录 后发表回答