Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to check if pdb file is valid for debugging an assembly

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 configuration 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?

like image 364
satori Avatar asked Dec 08 '10 21:12

satori


2 Answers

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

like image 149
HairOfTheDog Avatar answered Oct 17 '22 19:10

HairOfTheDog


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.

like image 43
Tim Robinson Avatar answered Oct 17 '22 20:10

Tim Robinson