I finally figured out why my debug symbols on Windows were messed up.

By doing "!sym noisy", I saw that WinDbg found that nsd.pdb file was
"mismatched" with nsd.dll, and therefore ignored it.  That's why the
backtraces it was giving me were so useless.

chkmatch.exe agreed that there was a problem.  Oddly, it said the
problem was and "Age mismatch" between for nsd.pdb and nsd.dll,
whatever that really means.  Interestingly, it reported that my
nsd.pdb file WAS correctly matched with nsd.exe, just not with
nsd.dll.  Hm...

Yep, the root cause of this problem was simply that the compiler was
emitting TWO files named "nsd.pdb" into the same directory, and the
second one for nsd.exe clobbered the first one for nsd.dll!

To fix, I simply changed the (Windows only) makefiles to name the
library files "libnsd.dll" and "libnsd.lib", here:

  
https://bitbucket.org/apiskors/naviserver/commits/55797002913598dd2152d2bea4dba7bbeef589bf

That's all it takes!  Now I have separate nsd.pdb (for the exe) and
libnad.pdb files, and once I set its symbol path correctly WinDbg
finds and loads them without trouble.


------------------------------------------------------------
Some WinDbg commands to check this stuff:

.sympath 
C:\web\nsd-32-tcl85\lib;SRV*C:\MyLocalSymbols*http://msdl.microsoft.com/download/symbols
!sym noisy
lml
.reload nsd.dll

------------------------------------------------------------
C:\web\nsd-32-tcl85>chkmatch -c bin\nsd.exe lib\nsd.pdb

Executable:
TimeDateStamp: 5456f3e9
Debug info: 2 ( CodeView )
TimeStamp: 5456f3e9  Characteristics: 0  MajorVer: 0  MinorVer: 0
Size: 62  RVA: 00059694  FileOffset: 00058094
CodeView format: RSDS
Signature: {1fd5b2d7-be66-40cd-ac8f-84e2f61d4fe6}  Age: 2
PdbFile: Z:\web\ns-fork\naviserver\nsd\nsd.pdb

Debug information file:
Format: PDB 7.00
Signature: {1fd5b2d7-be66-40cd-ac8f-84e2f61d4fe6}  Age: 2

Result: Matched

------------------------------------------------------------
C:\web\nsd-32-tcl85>chkmatch -c bin\nsd.dll lib\nsd.pdb

Executable:
TimeDateStamp: 5456f3e8
Debug info: 2 ( CodeView )
TimeStamp: 5456f3e8  Characteristics: 0  MajorVer: 0  MinorVer: 0
Size: 62  RVA: 0010c1f4  FileOffset: 0010a9f4
CodeView format: RSDS
Signature: {1fd5b2d7-be66-40cd-ac8f-84e2f61d4fe6}  Age: 1
PdbFile: Z:\web\ns-fork\naviserver\nsd\nsd.pdb

Debug information file:
Format: PDB 7.00
Signature: {1fd5b2d7-be66-40cd-ac8f-84e2f61d4fe6}  Age: 2

Result: Unmatched (reason: Age mismatch)

------------------------------------------------------------
Finally, here's my current HTML list of useful WinDbg links:

<h4>The <a 
href="http://msdn.microsoft.com/en-us/library/windows/hardware/hh406283%28v=vs.85%29.aspx";>WinDbg</a>
 Debugger:</h4>
<ul>
<li>Mike Taulty's <a 
href="http://mtaulty.com/communityserver/blogs/mike_taultys_blog/archive/2004/08/03/4656.aspx";>WinDbg
 debugger</a> tips
<li>Moving <a 
href="http://blogs.msdn.com/b/doronh/archive/2006/07/21/673317.aspx";>up and 
down</a> the stack
<li><a href="http://windbg.info/doc/1-common-cmds.html";>Common commands</a> by 
purpose
<li>A wordy <a 
href="http://www.virtualdub.org/blog/pivot/entry.php?id=215";>cheat sheet</a>
<li>Debugging the damn <a 
href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff560260%28v=vs.85%29.aspx";>symbol
 path</a>
<li>The <a href="http://www.debuginfo.com/tools/chkmatch.html";>ChkMatch.exe</a> 
utility
<li>Use <a 
href="http://www.debuginfo.com/articles/debuginfomatch.html";>.symopt+0x40</a> 
to load mismatched symbols
<li>Use <a 
href="http://stackoverflow.com/questions/744870/how-can-you-change-an-age-mismatched-pdb-to-match-properly";>How
 can you change an age-mismatched PDB to match properly?</a>
</ul>

-- 
Andrew Piskorski <a...@piskorski.com>

------------------------------------------------------------------------------
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to