//public void ReadPDB() {
// PDBReader reader = new PDBReader(this.fileName);
// foreach (ClassDef cDef in GetClasses())
// foreach (MethodDef mDef in cDef.GetMethods()) {
// CILInstructions buffer = mDef.GetCodeBuffer();
// PDBMethod meth = reader.GetMethod((int) mDef.Token());
// if (meth == null)
// continue; // no symbols for this method
// PDBSequencePoint[] spList = meth.SequencePoints;
// MergeBuffer mergeBuffer = new MergeBuffer(buffer.GetInstructions());
// PDBScope outer = meth.Scope;
// buffer.currentScope = ReadPDBScope(outer, mergeBuffer, null, mDef);
// foreach (PDBSequencePoint sp in spList) {
// PDBDocument doc = sp.Document;
// mergeBuffer.Add(new Line((uint) sp.Line, (uint) sp.Column, (uint) sp.EndLine, (uint) sp.EndColumn,
// SourceFile.GetSourceFile(doc.URL, doc.Language, doc.LanguageVendor, doc.DocumentType)),
// (uint) sp.Offset);
// }
// buffer.SetInstructions(mergeBuffer.Instructions);
// }
// }
private Scope ReadPDBScope(PDBScope scope, MergeBuffer mergeBuffer, Scope parent, MethodDef thisMeth)
{
Scope thisScope = new Scope(parent, thisMeth);
if (parent != null) mergeBuffer.Add(new OpenScope(thisScope), (uint) scope.StartOffset);
foreach (PDBVariable var in scope.Variables)
thisScope.AddLocalBinding(var.Name, var.Address);
foreach (PDBScope child in scope.Children)
ReadPDBScope(child, mergeBuffer, thisScope, thisMeth);
if (parent != null) mergeBuffer.Add(new CloseScope(thisScope), (uint) scope.EndOffset);
return thisScope;
}