Пример #1
0
        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);
            }
        }
Пример #2
0
        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) {}
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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 {}
        }
Пример #6
0
        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);
        }