diff --git a/Cpp2IL.Core/InstructionSets/X86InstructionSet.cs b/Cpp2IL.Core/InstructionSets/X86InstructionSet.cs index 702ce9f9..f485d440 100644 --- a/Cpp2IL.Core/InstructionSets/X86InstructionSet.cs +++ b/Cpp2IL.Core/InstructionSets/X86InstructionSet.cs @@ -51,7 +51,7 @@ public override List GetIsilFromMethod(Met { var builder = new IsilBuilder(); - foreach (var instruction in X86Utils.Iterate(context.RawBytes, context.UnderlyingPointer)) + foreach (var instruction in X86Utils.Iterate(context)) { ConvertInstructionStatement(instruction, builder, context); } diff --git a/Cpp2IL.Core/Utils/X86Utils.cs b/Cpp2IL.Core/Utils/X86Utils.cs index 77572084..8f20aff9 100644 --- a/Cpp2IL.Core/Utils/X86Utils.cs +++ b/Cpp2IL.Core/Utils/X86Utils.cs @@ -5,6 +5,7 @@ using System.Text.RegularExpressions; using Cpp2IL.Core.Extensions; using Cpp2IL.Core.Logging; +using Cpp2IL.Core.Model.Contexts; using Iced.Intel; using LibCpp2IL; @@ -34,6 +35,11 @@ public static InstructionList Disassemble(byte[] bytes, ulong methodBase) return instructions; } + public static InstructionList Disassemble(MethodAnalysisContext context) + { + return Disassemble(context.RawBytes, context.UnderlyingPointer); + } + public static IEnumerable Iterate(Memory bytes, ulong methodBase) { return Iterate(bytes.AsEnumerable(), methodBase); @@ -53,6 +59,11 @@ public static IEnumerable Iterate(IEnumerable bytes, ulong me } } + public static IEnumerable Iterate(MethodAnalysisContext context) + { + return Iterate(context.RawBytes, context.UnderlyingPointer); + } + public static Memory GetRawManagedOrCaCacheGenMethodBody(ulong ptr, bool isCaGen) { var rawAddr = LibCpp2IlMain.Binary!.MapVirtualAddressToRaw(ptr, false);