I’m writing some logic for academic purposes symbol source server.
I have to check assembly and its pdb file if they match each other so users could use them without any problems.
I’ve made little research, but without anything spectacular. If VS will get wrong symbols debugging it might show information:
The following module was built either with optimizations enabled or without debug information: assembly.dll
To debug this module, change its project build co开发者_如何学JAVAnfiguration to Debug mode. To suppress this message, disable the 'Warn if no user code on launch' debugger option.
I’m also wondering what information VS gets from pdb and assembly to validate them.
Is there any (managed) API? Or even unmanaged?
Any ideas?
This page contains an excellent article on the gory details of PDB and DBG files. It explains exactly what is stored in a symbol file, how to read it, and how to determine whether the binary file (EXE or DLL) and the symbol file (PDB or DBG) match.
http://www.debuginfo.com/articles/debuginfomatch.html#details
I think the name of the API Visual Studio uses is DIA; it's a COM API that you can call from C#.
The Mono.Cecil library provides a nice set of classes for accessing assemblies and their symbols; it uses DIA underneath for .pdb files. I would call Cecil directly for this; if not, the source code should provide a guide.
精彩评论