Skip to content

Commit a8f901b

Browse files
ds5678gompoc
authored andcommitted
X86Utils overloads for MethodAnalysisContext
1 parent 5d4be29 commit a8f901b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Cpp2IL.Core/InstructionSets/X86InstructionSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public override List<InstructionSetIndependentInstruction> GetIsilFromMethod(Met
5151
{
5252
var builder = new IsilBuilder();
5353

54-
foreach (var instruction in X86Utils.Iterate(context.RawBytes, context.UnderlyingPointer))
54+
foreach (var instruction in X86Utils.Iterate(context))
5555
{
5656
ConvertInstructionStatement(instruction, builder, context);
5757
}

Cpp2IL.Core/Utils/X86Utils.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.RegularExpressions;
66
using Cpp2IL.Core.Extensions;
77
using Cpp2IL.Core.Logging;
8+
using Cpp2IL.Core.Model.Contexts;
89
using Iced.Intel;
910
using LibCpp2IL;
1011

@@ -34,6 +35,11 @@ public static InstructionList Disassemble(byte[] bytes, ulong methodBase)
3435
return instructions;
3536
}
3637

38+
public static InstructionList Disassemble(MethodAnalysisContext context)
39+
{
40+
return Disassemble(context.RawBytes, context.UnderlyingPointer);
41+
}
42+
3743
public static IEnumerable<Instruction> Iterate(Memory<byte> bytes, ulong methodBase)
3844
{
3945
return Iterate(bytes.AsEnumerable(), methodBase);
@@ -53,6 +59,11 @@ public static IEnumerable<Instruction> Iterate(IEnumerable<byte> bytes, ulong me
5359
}
5460
}
5561

62+
public static IEnumerable<Instruction> Iterate(MethodAnalysisContext context)
63+
{
64+
return Iterate(context.RawBytes, context.UnderlyingPointer);
65+
}
66+
5667
public static Memory<byte> GetRawManagedOrCaCacheGenMethodBody(ulong ptr, bool isCaGen)
5768
{
5869
var rawAddr = LibCpp2IlMain.Binary!.MapVirtualAddressToRaw(ptr, false);

0 commit comments

Comments
 (0)