• 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/WasmInstructionSet.cs
1
using System;
2
using System.Collections.Generic;
3
using Cpp2IL.Core.Api;
4
using Cpp2IL.Core.Il2CppApiFunctions;
5
using Cpp2IL.Core.ISIL;
6
using Cpp2IL.Core.Logging;
7
using Cpp2IL.Core.Model.Contexts;
8
using Cpp2IL.Core.Utils;
9
using Cpp2IL.Decompiler.IL;
10
using WasmDisassembler;
11

12
namespace Cpp2IL.Core.InstructionSets;
13

14
public class WasmInstructionSet : Cpp2IlInstructionSet
15
{
16
    public override Memory<byte> GetRawBytesForMethod(MethodAnalysisContext context, bool isAttributeGenerator)
17
    {
18
        if (context.Definition is { } methodDefinition)
×
19
        {
20
            var wasmDef = WasmUtils.TryGetWasmDefinition(context);
×
21

22
            if (wasmDef == null)
×
23
            {
24
                Logger.WarnNewline($"Could not find WASM definition for method {methodDefinition.HumanReadableSignature} in {methodDefinition.DeclaringType?.FullName}, probably incorrect signature calculation (signature was {WasmUtils.BuildSignature(context)})", "WasmInstructionSet");
×
25
                return Array.Empty<byte>();
×
26
            }
27

28
            if (wasmDef.AssociatedFunctionBody == null)
×
29
                throw new($"WASM definition {wasmDef}, resolved from MethodAnalysisContext {context.Definition.HumanReadableSignature} in {context.DeclaringType?.FullName} has no associated function body (signature was {WasmUtils.BuildSignature(context)})");
×
30

31
            return wasmDef.AssociatedFunctionBody.Instructions;
×
32
        }
33

34
        return Array.Empty<byte>();
×
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

48
    public override BaseKeyFunctionAddresses CreateKeyFunctionAddressesInstance()
49
    {
50
        return new WasmKeyFunctionAddresses();
×
51
    }
52

53
    public override string PrintAssembly(MethodAnalysisContext context)
54
    {
55
        if (context.Definition == null)
×
56
            return string.Empty;
×
57

58
        var def = WasmUtils.GetWasmDefinition(context);
×
59
        var disassembled = Disassembler.Disassemble(def.AssociatedFunctionBody!.Instructions, (uint)context.UnderlyingPointer);
×
60

61
        return string.Join("\n", disassembled);
×
62
    }
63
}
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