public override ProcedureSignature Deserialize(SerializedSignature ss, Core.Frame frame) { if (ss == null) { return(null); } var argser = new ArgumentSerializer(this, Architecture, frame, ss.Convention); Identifier ret = null; if (ss.ReturnValue != null) { ret = argser.DeserializeReturnValue(ss.ReturnValue); } var args = new List <Identifier>(); this.gr = 0; if (ss.Arguments != null) { for (int iArg = 0; iArg < ss.Arguments.Length; ++iArg) { var sArg = ss.Arguments[iArg]; Identifier arg = DeserializeArgument(argser, sArg); args.Add(arg); } } var sig = new ProcedureSignature(ret, args.ToArray()); return(sig); }
public override ProcedureSignature Deserialize(SerializedSignature ss, Frame frame) { if (ss == null) { return(null); } this.argser = new ArgumentSerializer(this, Architecture, frame, ss.Convention); Identifier ret = null; int fpuDelta = FpuStackOffset; FpuStackOffset = 0; if (ss.ReturnValue != null) { ret = argser.DeserializeReturnValue(ss.ReturnValue); fpuDelta += FpuStackOffset; } FpuStackOffset = 0; var args = new List <Identifier>(); if (ss.Arguments != null) { if (ss.Convention == "pascal") { for (int iArg = ss.Arguments.Length - 1; iArg >= 0; --iArg) { var sArg = ss.Arguments[iArg]; var arg = DeserializeArgument(sArg, iArg, ss.Convention); args.Add(arg); } args.Reverse(); } else { for (int iArg = 0; iArg < ss.Arguments.Length; ++iArg) { var sArg = ss.Arguments[iArg]; var arg = DeserializeArgument(sArg, iArg, ss.Convention); args.Add(arg); } } fpuDelta -= FpuStackOffset; } FpuStackOffset = fpuDelta; var sig = new ProcedureSignature(ret, args.ToArray()); ApplyConvention(ss, sig); return(sig); }
public void ArgSet_DerserializeReturnRegisterWithType() { var arg = new Argument_v1 { Kind = new Register_v1("eax"), Type = new PointerType_v1 { DataType = new PrimitiveType_v1 { ByteSize = 1, Domain = Domain.Character } } }; var id = argser.DeserializeReturnValue(arg); Assert.AreEqual("(ptr char)", id.DataType.ToString()); }