• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SamboyCoding / Cpp2IL / 13988197905

21 Mar 2025 09:03AM UTC coverage: 23.407% (-3.8%) from 27.187%
13988197905

Pull #426

github

web-flow
Merge 4aa36af61 into 76a9b72af
Pull Request #426: ISIL -> CIL Decompiler

1270 of 7736 branches covered (16.42%)

Branch coverage included in aggregate %.

5 of 1526 new or added lines in 31 files covered. (0.33%)

4 existing lines in 3 files now uncovered.

3383 of 12143 relevant lines covered (27.86%)

107291.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Cpp2IL.Core/InstructionSets/Arm64InstructionSet.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using Cpp2IL.Core.Api;
6
using Cpp2IL.Core.Graphs;
7
using Cpp2IL.Core.Il2CppApiFunctions;
8
using Cpp2IL.Core.ISIL;
9
using Cpp2IL.Core.Model.Contexts;
10
using Cpp2IL.Core.Utils;
11
using Cpp2IL.Decompiler.IL;
12
using LibCpp2IL;
13

14
namespace Cpp2IL.Core.InstructionSets;
15

16
public class Arm64InstructionSet : Cpp2IlInstructionSet
17
{
18
    public override Memory<byte> GetRawBytesForMethod(MethodAnalysisContext context, bool isAttributeGenerator)
19
    {
20
        //Avoid use of capstone where possible
21
        if (true || context is not ConcreteGenericMethodAnalysisContext)
22
        {
23
            //Managed method or attr gen => grab raw byte range between a and b
24
            var startOfNextFunction = (int)MiscUtils.GetAddressOfNextFunctionStart(context.UnderlyingPointer) - 1;
×
25
            var ptrAsInt = (int)context.UnderlyingPointer;
×
26
            var count = startOfNextFunction - ptrAsInt;
×
27

28
            if (startOfNextFunction > 0)
×
29
                return LibCpp2IlMain.Binary!.GetRawBinaryContent().AsMemory(ptrAsInt, count);
×
30
        }
31

32
        var instructions = Arm64Utils.GetArm64MethodBodyAtVirtualAddress(context.UnderlyingPointer);
×
33

34
        return instructions.SelectMany(i => i.Bytes).ToArray();
×
35
    }
36

37
    public override List<InstructionSetIndependentInstruction> GetIsilFromMethod(MethodAnalysisContext context)
38
    {
39
        return [];
×
40
    }
41

42
    public override List<Instruction> GetDecompilerIlFromMethod(MethodAnalysisContext context, out List<object> ilParams)
43
    {
NEW
44
        ilParams = [];
×
NEW
45
        return [];
×
46
    }
47

UNCOV
48
    public override BaseKeyFunctionAddresses CreateKeyFunctionAddressesInstance() => new Arm64KeyFunctionAddresses();
×
49

50
    public override string PrintAssembly(MethodAnalysisContext context)
51
    {
52
        var sb = new StringBuilder();
×
53

54
        var instructions = Arm64Utils.GetArm64MethodBodyAtVirtualAddress(context.UnderlyingPointer);
×
55

56
        var first = true;
×
57
        foreach (var instruction in instructions)
×
58
        {
59
            if (!first)
×
60
                sb.AppendLine();
×
61

62
            first = false;
×
63
            sb.Append("0x").Append(instruction.Address.ToString("X")).Append(" ").Append(instruction.Mnemonic).Append(" ").Append(instruction.Operand);
×
64
        }
65

66
        return sb.ToString();
×
67
    }
68
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc