Skip to content

Commit

Permalink
X86Utils overloads for MethodAnalysisContext
Browse files Browse the repository at this point in the history
  • Loading branch information
ds5678 authored and gompoc committed Dec 24, 2024
1 parent 5d4be29 commit a8f901b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cpp2IL.Core/InstructionSets/X86InstructionSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public override List<InstructionSetIndependentInstruction> 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);
}
Expand Down
11 changes: 11 additions & 0 deletions Cpp2IL.Core/Utils/X86Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<Instruction> Iterate(Memory<byte> bytes, ulong methodBase)
{
return Iterate(bytes.AsEnumerable(), methodBase);
Expand All @@ -53,6 +59,11 @@ public static IEnumerable<Instruction> Iterate(IEnumerable<byte> bytes, ulong me
}
}

public static IEnumerable<Instruction> Iterate(MethodAnalysisContext context)
{
return Iterate(context.RawBytes, context.UnderlyingPointer);
}

public static Memory<byte> GetRawManagedOrCaCacheGenMethodBody(ulong ptr, bool isCaGen)
{
var rawAddr = LibCpp2IlMain.Binary!.MapVirtualAddressToRaw(ptr, false);
Expand Down

0 comments on commit a8f901b

Please sign in to comment.