Skip to content

Commit

Permalink
Support multiple DWARF path prefixes in CI report generator
Browse files Browse the repository at this point in the history
  • Loading branch information
JanWichelmann committed Apr 14, 2023
1 parent dda5ae0 commit f5c52f8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Tools/CiReportGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Console.WriteLine("Supported map modes:");
Console.WriteLine(" dwarf");
Console.WriteLine(" - Directory with DWARF dumps, e.g. \"/mw/dwarf/\"");
Console.WriteLine(" - Path prefix which all source files share and which should be removed, e.g. \"/mw/src/\"");
Console.WriteLine(" - Path prefix(es) which all source files share and which should be removed, separated by colons, e.g. \"/mw/src/\"");
Console.WriteLine(" js-map");
Console.WriteLine(" - Directory with MAP files generated by the JavascriptTracer plugin, e.g. \"/mw/maps/\"");
return;
Expand Down Expand Up @@ -50,7 +50,7 @@
if(argMode == "dwarf")
{
string argDwarfDirectory = args[argIndex++];
string argUriPrefix = args[argIndex++];
string[] argUriPrefixes = args[argIndex++].Split(':');

// Read DWARF files and extract statement info
foreach(var dwarfFile in Directory.EnumerateFiles(argDwarfDirectory, "*.dwarf"))
Expand Down Expand Up @@ -102,9 +102,15 @@
// Remove quotation marks
uri = uri.Substring(1, uri.Length - 2);

// Remove path prefix
if(uri.StartsWith(argUriPrefix))
uri = uri.Substring(argUriPrefix.Length);
// Remove path prefix and relative stuff
foreach(var prefix in argUriPrefixes)
{
if(uri.StartsWith(prefix))
uri = uri.Substring(prefix.Length);
}
uri = uri.Replace("/./", "/");
if(uri.StartsWith("./"))
uri = uri.Substring(2);
if(uri.StartsWith('/'))
uri = uri.Substring(1);

Expand Down

0 comments on commit f5c52f8

Please sign in to comment.