Пример #1
0
        public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode)
        {
            var xOpVar     = (OpVar)aOpCode;
            var xVar       = DebugSymbolReader.GetLocalVariableInfos(aMethod.MethodBase)[xOpVar.Value];
            var xEBPOffset = GetEBPOffsetForLocal(aMethod, xOpVar.Value);

            xEBPOffset += (uint)(((int)GetStackCountForLocal(aMethod, xVar.Type) - 1) * 4);

            XS.Comment("Local type = " + xVar);
            XS.Comment("Local EBP offset = " + xEBPOffset);

            XS.Set(EAX, EBP);
            XS.Sub(EAX, xEBPOffset);
            XS.Push(EAX);
        }
Пример #2
0
        public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode)
        {
            var  xOpVar      = (OpVar)aOpCode;
            var  xVar        = DebugSymbolReader.GetLocalVariableInfos(aMethod.MethodBase)[xOpVar.Value];
            var  xStackCount = (int)GetStackCountForLocal(aMethod, xVar.Type);
            var  xEBPOffset  = (int)GetEBPOffsetForLocal(aMethod, xOpVar.Value);
            var  xSize       = SizeOfType(xVar.Type);
            bool xSigned     = IsIntegerSigned(xVar.Type);

            XS.Comment("Local type = " + xVar);
            XS.Comment("Local EBP offset = " + xEBPOffset);
            XS.Comment("Local size = " + xSize);

            switch (xSize)
            {
            case 1:
                if (xSigned)
                {
                    XS.MoveSignExtend(EAX, EBP, sourceIsIndirect: true, sourceDisplacement: (0 - xEBPOffset), size: RegisterSize.Byte8);
                }
                else
                {
                    XS.MoveZeroExtend(EAX, EBP, sourceIsIndirect: true, sourceDisplacement: (0 - xEBPOffset), size: RegisterSize.Byte8);
                }
                XS.Push(EAX);
                break;

            case 2:
                if (xSigned)
                {
                    XS.MoveSignExtend(EAX, EBP, sourceIsIndirect: true, sourceDisplacement: (0 - xEBPOffset), size: RegisterSize.Short16);
                }
                else
                {
                    XS.MoveZeroExtend(EAX, EBP, sourceIsIndirect: true, sourceDisplacement: (0 - xEBPOffset), size: RegisterSize.Short16);
                }
                XS.Push(EAX);
                break;

            default:
                for (int i = 0; i < xStackCount; i++)
                {
                    XS.Set(EAX, EBP, sourceDisplacement: 0 - (xEBPOffset + (i * 4)));
                    XS.Push(EAX);
                }
                break;
            }
        }
Пример #3
0
        public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode)
        {
            var xOpVar      = (OpVar)aOpCode;
            var xVar        = DebugSymbolReader.GetLocalVariableInfos(aMethod.MethodBase)[xOpVar.Value];
            var xStackCount = (int)GetStackCountForLocal(aMethod, xVar.Type);
            var xEBPOffset  = (int)GetEBPOffsetForLocal(aMethod, xOpVar.Value);
            var xSize       = SizeOfType(xVar.Type);

            XS.Comment("Local type = " + xVar);
            XS.Comment("Local EBP offset = " + xEBPOffset);
            XS.Comment("Local size = " + xSize);

            for (int i = xStackCount - 1; i >= 0; i--)
            {
                XS.Pop(EAX);
                XS.Set(EBP, EAX, destinationDisplacement: 0 - (xEBPOffset + (i * 4)));
            }
        }
Пример #4
0
 public static IList <LocalVariableInfo> GetLocalVariables(this MethodBase aThis)
 {
     return(DebugSymbolReader.GetLocalVariableInfos(aThis));
 }