static void ReadScopeAndLocals(ISymbolScope scope, Cil.Scope parent, Cil.MethodBody body, IDictionary instructions) { Cil.Scope s = new Cil.Scope(); s.Start = GetInstruction(body, instructions, scope.StartOffset); s.End = GetInstruction(body, instructions, scope.EndOffset); if (parent != null) { parent.Scopes.Add(s); } else { body.Scopes.Add(s); } foreach (ISymbolVariable local in scope.GetLocals()) { Cil.VariableDefinition variable = body.Variables [local.AddressField1]; variable.Name = local.Name; s.Variables.Add(variable); } foreach (ISymbolScope child in scope.GetChildren()) { ReadScopeAndLocals(child, s, body, instructions); } }
public void Read(Cil.MethodBody body, IDictionary instructions) { try { ISymbolMethod method = m_reader.GetMethod(new SymbolToken((int)body.Method.MetadataToken.ToUInt())); ReadSequencePoints(method, instructions); ReadScopeAndLocals(method.RootScope, null, body, instructions); } catch (COMException) {} }
static Cil.Instruction GetInstruction(Cil.MethodBody body, IDictionary instructions, int offset) { Cil.Instruction instr = (Cil.Instruction)instructions [offset]; if (instr != null) { return(instr); } return(body.Instructions.Outside); }
Cil.Instruction GetInstruction(Cil.MethodBody body, Hashtable instructions, int offset) { Cil.Instruction instr = (Cil.Instruction)instructions [offset]; if (instr != null) { return(instr); } return(body.Instructions.Outside); }
public void Read(Cil.MethodBody body) { try { ISymbolMethod method = m_reader.GetMethod(new SymbolToken((int)body.Method.MetadataToken.ToUInt())); Hashtable instructions = GetInstructions(body); ReadSequencePoints(method, instructions); ReadScopeAndLocals(method.RootScope, null, body, instructions); } catch {} }
Hashtable GetInstructions(Cil.MethodBody body) { Hashtable instructions = new Hashtable(body.Instructions.Count); foreach (Cil.Instruction i in body.Instructions) { instructions.Add(i.Offset, i); } return(instructions); }