問題描述
我在 Visual Studio 2012 中有一個大型解決方案,其中包含可執行文件和類庫項目.調試應用程序時,不會命中某個特定類庫項目中的斷點.
I have a large solution in Visual Studio 2012 which consists of executables and class library projects. When debugging the application the breakpoints in one particular class library project are not being hit.
我查看了 Debug> Windows> Modules 窗口以檢查該項目的符號狀態,它顯示無法找到或打開 PDB 文件".
它還在 用戶代碼" 列下顯示 否".
我注意到解決方案中的其他一些自定義項目在該列中顯示否",并且它們的符號也無法加載.用戶代碼"下帶有是"的任何內容似乎都已加載它的 pdb 沒有問題.但我不確定這是否相關.
I looked at the Debug> Windows> Modules window to check the status of the symbols for that project and it says "Cannot find or open the PDB file".
It also says "No" under the "User Code" column.
I notice that there are a few other of the custom projects in the solution that are showing "No" in that column and their symbols are also failing to load. Anything with a "Yes" under "User code" seems to have had it's pdb loaded no problem. But I'm not sure if this is relevant.
我在 dll 上使用了 dumpbin/headers,并且 pdb 文件的路徑存在且正確.
I have used dumpbin /headers on the dll and the path for the pdb file is present and correct.
該模塊絕對不在符號加載的排除列表中.
The module is definitely not in the exclude list for the symbol loading.
我還嘗試右鍵單擊模塊窗口中的條目,選擇 加載符號" 并導航到 dll 標頭中給出的路徑.當我選擇 pdb 時,它顯示 在此文件夾中找不到匹配的符號文件".
I have also tried right clicking on the entry in the modules window, selecting "Load symbols" and navigating to the path given in the dll header. When I select the pdb it says "A matching symbol file was not found in this folder".
在我刪除這些文件夾和文件、清理解決方案、關閉它并重建整個東西后,我得到了這個.pdb 肯定是與所討論的 dll 同時構建的.
I get this after I have deleted these folders and files, cleaned the solution, closed it and rebuilt the whole thing. The pdb was definitely built at the same time as the dll in question.
很明顯,問題在于錯誤消息的無法打開 pdb"部分.
So clearly the problem is the "cannot open the pdb" portion of the error message.
我已經在 2 臺計算機上嘗試過這個,并且都表現出相同的行為.
I have tried this on 2 computers and both are exhibiting the same behaviour.
任何人都可以提供任何關于從這里去哪里的建議,也許為什么地球上對應于 dll 的構建 pdb 不會為它加載?
Can anyone offer any suggestions on where to go from here, and perhaps why on earth the built pdb corresponding to the dll won't load for it?
推薦答案
我嘗試了一些工具來檢查 pdb 和 dll 是否真正匹配,并使用 chkmatch 我可以看到正在運行的 dll 中的 GUID 和 obj 文件夾中的 pdb 不匹配.
I tried a few tools to check if the pdb and the dll actually matched, and using chkmatch I could see that the GUIDs in the dll being run and the pdb in the obj folder didn't match.
事實證明,盡管項目的 obj 文件夾中的 dll 和 pdb 是匹配的,但實際上通過構建后事件復制到應用程序目標文件夾的 dll 是先前構建中的舊 dll.
So it turns out that although the dll and pdb in the project's obj folder are a match, the dll that was actually getting copied to the application's destination folder by a post-build event was the old dll from the previous build.
構建后事件在該特定項目構建或至少完成構建之前運行,并且正在從 bin 中復制現有 dll,隨后被繼續構建覆蓋.
The post-build event was running before that particular project had built, or at least finished building, and was copying in the existing dll from the bin which was subsequently overwritten by the continuing build.
我已通過編輯解決方案的項目依賴項并確保具有構建后事件的項目依賴于未加載的項目,現在 pdb 在調試期間加載,從而解決了該問題.
I have resolved the problem by editing the project dependencies for the solution and ensuring that the project with the post-build event is dependent on the project that wasn't loading, and now the pdb loads during debug.
這篇關于未加載符號文件以在 Visual Studio 2012 中調試自定義項目的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!