DLL調試中斷點失效的問題

    用VS2008編寫了一個DLL工程,打算加上application進行調試,結果點下F5,DLL工程中的所有斷點都被禁掉了,顯示如下:

 

    The breakpoint will not currently be hit. No symbols have been loaded for this document.

 

   在網上搜了一下有沒有找到合適的結果,自己瞎折騰倒是折騰出來了,再搜,找到了合適的結果,總結如下:

 

 

   原因

 

  DLL工程中的 pdb 文件的時間戳與application路徑下的dll文件的時間戳 不一致。即當DLL工程新編譯後,沒有將工程下的新編譯的dll文件拷貝至 application路徑下,使得 application路徑下的dll文件仍然爲舊的。

 

  解決辦法

 

  1. 將application exe拷貝至DLL功能debug目錄下,這樣就不會發生上述情況。


  2. 在每次新編譯dll後及時更新 application路徑下的dll文件。

 

  順帶附上在網上找到的一個英文解決辦法,沒看太懂,是C#,不過道理估計是相通的。

 

two projects, the first one (A) calls the second (B) as a .dll .Both are projects for PocketPC (Smart device applications).
When i set a Breakpoint in the code of B it looks OK but when i Debug Question Mark appears with the infamous

note: The Breakpoint will not currently be hit. No Symbols have been loaded for this document.

The B.pdb has a timestamp different from B.dll and THIS is the problem. You have to DELETE B.pdb NOT ONLY from the Debug/bin directory because THERE IS ANOTHER COPY of this B.pdb in the obj directory and you CAN'T touch this copy so easily. So here is the complete walkthrough:

1) For your project set "Generate DEBUG information" to FALSE
2) DELETE ALL the occurences of B.pdb under /bin and /obj
3) Set "Generate DEBUG information" back to TRUE
4) BUILD


Between 2 and 3 I also built once but i think this is not necessary.

Now my pdb and dll have the same timestamp and all is working perfectly

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章