Debugging with Pdb file and Source Code File in Visual Studio

一笑奈何 提交于 2019-12-03 14:14:52

问题


I have a web project that posts from client-side code to a method in external dll, which I have source code file and pdb file of this external dll. What I would like to do is to debug external dll using source code file and pdb. Visual studio does not stop to say no symbols are loaded for the module since.


回答1:


To debug an dll a symbol file with the same version is allways needed. When you are debugging your own applications you usually don't have to care about this.

But there are things happening in the background. Visual stuido allways puts the symbol files in the debug folder when you build your application and also loads them as described under Loading the symbols automatic.

(When you distribute your application you usually do not want to distribute those symbols and therefore they won't be copied to the release directory you change your build configuration to release.)

Loading the symbols manuell

If you want to load the symbols manually you can load them with the Modules dialog.

"Debug" -> "Windows" -> "Modules".

You can right click a row and there is the option "Load Symbols" which lets you sepecifiy a pdb file to load.

Loading the symbols automatic

Visual studio also loads the symbols automaticly when they can be found in one of the following places.

  • The location that is specified inside the DLL or the executable file. (By default, if you have built a DLL or an executable file on your computer, the linker places the full path and file name of the associated .pdb file inside the DLL or the executable file. The debugger first checks to see if the symbol file exists in the location that is specified inside the DLL or the executable file. This is helpful, because you always have symbols available for code that you have compiled on your computer.)

  • .pdb files that could be present in the same folder as the DLL or executable file.

  • Any local symbol cache folders.
  • Any network, internet, or local symbol servers and locations that are specified on, such as the Microsoft symbol server if enabled.

If you want to read more about how the symbols are used with visual studio you can read this article about Understanding symbol files and Visual Studio’s symbol settings.



来源:https://stackoverflow.com/questions/44383026/debugging-with-pdb-file-and-source-code-file-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!