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

SamboyCoding / Cpp2IL / 17216182984

25 Aug 2025 05:35PM UTC coverage: 30.38% (-4.0%) from 34.352%
17216182984

Pull #481

github

web-flow
Merge b82763a24 into d5260685f
Pull Request #481: Decompiler

1804 of 7561 branches covered (23.86%)

Branch coverage included in aggregate %.

100 of 1839 new or added lines in 29 files covered. (5.44%)

41 existing lines in 6 files now uncovered.

4093 of 11850 relevant lines covered (34.54%)

165575.01 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 WasmDisassembler;
10

11
namespace Cpp2IL.Core.InstructionSets;
12

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

21
            if (wasmDef == null)
×
22
            {
23
                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");
×
24
                return Array.Empty<byte>();
×
25
            }
26

27
            if (wasmDef.AssociatedFunctionBody == null)
×
28
                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)})");
×
29

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

33
        return Array.Empty<byte>();
×
34
    }
35

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

41
    public override List<object> GetParameterOperandsFromMethod(MethodAnalysisContext context)
42
    {
43
        return [];
×
44
    }
45

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

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

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

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