Debugging a renamed DLL?

2019-06-26 03:15发布

I am having problems trying to debug a DLL, which has been renamed during the post-build process: WinDBG fails to load the correct symbols (pdb file).

Example:
Original file name was: abc.dll
The created PDB is named: abc.pdb
During post-build process the DLL was renamed to 'a-b.DLL'.

For some reason when debugging I can see the module apears as 'a_b.dll' (hyphen was replaced by underscore, not sure why this happen). In addition, WinDBG cannot load its symbols.

I tried ld a_b /f abc, and also tried to rename PDB as 'a_b.pdb', and then called .reload /f /i a_b, but also this did not work.

All this happens in my Release build, which was set to add debug-info and created PDB, as it does.

1条回答
太酷不给撩
2楼-- · 2019-06-26 03:50

The name of the PDB is part of the DLL. Renaming the DLL will not change its contents, so renaming the PDB as well will not work. Instead, keep the original name.

Make sure your symbols are set up correctly, e.g. use Microsoft symbols and your own symbols:

.symfix c:\debug\symbols
.sympath+ c:\path_to\myproject\bin\Release
.reload

Also, don't worry about the module name in WinDbg. It replaces some special characters, but won't affect symbol loading. If you still have problems getting symbols laded, turn on symbol debug outout

!sym noisy

This should show the paths and file names where WinDbg tries to load symbols from. Check if your location is included. If not, add it via .sympath+. When done, turn symbols debugging off by

!sym quiet

This command is equivalent to

.symopt+ 0x80000000    *** noisy
.symopt- 0x80000000    *** quiet
查看更多
登录 后发表回答