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

SamboyCoding / Cpp2IL / 25641285720

10 May 2026 10:18PM UTC coverage: 35.104% (-0.2%) from 35.33%
25641285720

Pull #542

github

web-flow
Merge 9249bcb5b into 6af99f218
Pull Request #542: Remove static mutable state from LibCpp2IL 2: Electric Boogaloo

1877 of 6693 branches covered (28.04%)

Branch coverage included in aggregate %.

303 of 569 new or added lines in 66 files covered. (53.25%)

12 existing lines in 11 files now uncovered.

4394 of 11171 relevant lines covered (39.33%)

268486.35 hits per line

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

2.33
/Cpp2IL.Core/OutputFormats/WasmMappingOutputFormat.cs
1
using System;
2
using System.IO;
3
using System.Linq;
4
using System.Text;
5
using Cpp2IL.Core.Api;
6
using Cpp2IL.Core.Logging;
7
using Cpp2IL.Core.Model.Contexts;
8
using Cpp2IL.Core.Utils;
9
using LibCpp2IL.Wasm;
10

11
namespace Cpp2IL.Core.OutputFormats;
12

13
public class WasmMappingOutputFormat : Cpp2IlOutputFormat
14
{
15
    public override string OutputFormatId => "wasmmappings";
1✔
16
    public override string OutputFormatName => "WebAssembly Method Mappings";
×
17

18
    public override void DoOutput(ApplicationAnalysisContext context, string outputRoot)
19
    {
20
        if (context.Binary is not WasmFile wasmFile)
×
21
            throw new("This output format only works with WebAssembly files");
×
22

23
        Logger.InfoNewline("Generating WebAssembly method mappings...This may take up to a minute...", "WasmMappingOutputFormat");
×
24
        var output = new StringBuilder();
×
25

26
        foreach (var assemblyAnalysisContext in context.Assemblies)
×
27
        {
28
            output.Append("// ").Append(assemblyAnalysisContext.Name).Append(".dll").AppendLine().AppendLine();
×
29

30
            foreach (var typeAnalysisContext in assemblyAnalysisContext.Types)
×
31
            foreach (var methodAnalysisContext in typeAnalysisContext.Methods)
×
32
            {
33
                if (methodAnalysisContext is InjectedMethodAnalysisContext || methodAnalysisContext.Definition == null)
×
34
                    continue;
35

36
                output.Append(methodAnalysisContext.Definition.ReturnType)
×
37
                    .Append(' ')
×
38
                    .Append(methodAnalysisContext.DeclaringType!.FullName)
×
39
                    .Append("::")
×
40
                    .Append(methodAnalysisContext.Definition.Name)
×
41
                    .Append('(')
×
42
                    .Append(string.Join(", ", methodAnalysisContext.Definition.Parameters!.Select(p => $"{p.Type} {p.ParameterName}")))
×
43
                    .Append(") -> ");
×
44

45
                try
46
                {
47
                    var wasmDef = WasmUtils.GetWasmDefinition(methodAnalysisContext);
×
NEW
48
                    var ghidraName = WasmUtils.GetGhidraFunctionName(context.Binary, wasmDef);
×
49

50
                    output.AppendLine(ghidraName);
×
51
                }
×
52
                catch (Exception)
×
53
                {
54
                    output.AppendLine("<not resolved>");
×
55
                }
×
56
            }
57

58
            output.AppendLine().AppendLine();
×
59
        }
60

61
        var outPath = Path.Combine(outputRoot, "wasm_mappings.txt");
×
62
        File.WriteAllText(outPath, output.ToString());
×
63

64
        Logger.InfoNewline("Wasm mappings written to: " + outPath, "WasmMappingOutputFormat");
×
65
    }
×
66
}
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

© 2026 Coveralls, Inc