問(wèn)題描述
我在 Visual Studio 2012 中有一個(gè)大型解決方案,其中包含可執(zhí)行文件和類庫(kù)項(xiàng)目.調(diào)試應(yīng)用程序時(shí),不會(huì)命中某個(gè)特定類庫(kù)項(xiàng)目中的斷點(diǎn).
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 窗口以檢查該項(xiàng)目的符號(hào)狀態(tài),它顯示無(wú)法找到或打開(kāi) PDB 文件".
它還在 用戶代碼" 列下顯示 否".
我注意到解決方案中的其他一些自定義項(xiàng)目在該列中顯示否",并且它們的符號(hào)也無(wú)法加載.用戶代碼"下帶有是"的任何內(nèi)容似乎都已加載它的 pdb 沒(méi)有問(wèn)題.但我不確定這是否相關(guān).
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.
該模塊絕對(duì)不在符號(hào)加載的排除列表中.
The module is definitely not in the exclude list for the symbol loading.
我還嘗試右鍵單擊模塊窗口中的條目,選擇 加載符號(hào)" 并導(dǎo)航到 dll 標(biāo)頭中給出的路徑.當(dāng)我選擇 pdb 時(shí),它顯示 在此文件夾中找不到匹配的符號(hào)文件".
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".
在我刪除這些文件夾和文件、清理解決方案、關(guān)閉它并重建整個(gè)東西后,我得到了這個(gè).pdb 肯定是與所討論的 dll 同時(shí)構(gòu)建的.
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.
很明顯,問(wèn)題在于錯(cuò)誤消息的無(wú)法打開(kāi) pdb"部分.
So clearly the problem is the "cannot open the pdb" portion of the error message.
我已經(jīng)在 2 臺(tái)計(jì)算機(jī)上嘗試過(guò)這個(gè),并且都表現(xiàn)出相同的行為.
I have tried this on 2 computers and both are exhibiting the same behaviour.
任何人都可以提供任何關(guān)于從這里去哪里的建議,也許為什么地球上對(duì)應(yīng)于 dll 的構(gòu)建 pdb 不會(huì)為它加載?
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?
推薦答案
我嘗試了一些工具來(lái)檢查 pdb 和 dll 是否真正匹配,并使用 chkmatch 我可以看到正在運(yùn)行的 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.
事實(shí)證明,盡管項(xiàng)目的 obj 文件夾中的 dll 和 pdb 是匹配的,但實(shí)際上通過(guò)構(gòu)建后事件復(fù)制到應(yīng)用程序目標(biāo)文件夾的 dll 是先前構(gòu)建中的舊 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.
構(gòu)建后事件在該特定項(xiàng)目構(gòu)建或至少完成構(gòu)建之前運(yùn)行,并且正在從 bin 中復(fù)制現(xiàn)有 dll,隨后被繼續(xù)構(gòu)建覆蓋.
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.
我已通過(guò)編輯解決方案的項(xiàng)目依賴項(xiàng)并確保具有構(gòu)建后事件的項(xiàng)目依賴于未加載的項(xiàng)目,現(xiàn)在 pdb 在調(diào)試期間加載,從而解決了該問(wèn)題.
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.
這篇關(guān)于未加載符號(hào)文件以在 Visual Studio 2012 中調(diào)試自定義項(xiàng)目的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!