Skip to content

Commit

Permalink
Removed ... for anonymized path
Browse files Browse the repository at this point in the history
Added Unclassified in ImGui renderer
  • Loading branch information
Aragas committed Oct 4, 2024
1 parent d245b77 commit 4787bd6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/BUTR.CrashReport.Renderer.Html/CrashReportHtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ void AppendAssembly(AssemblyModel assembly)
.AppendIf(!isDynamic, sb => sb.Append(assembly.Hash).Append(", "))
.AppendIf(isDynamic && !hasPath, "DYNAMIC")
.AppendIf(!isDynamic && !hasPath, "EMPTY")
.AppendIf(!isDynamic && hasPath, sb => sb.Append("<a href='javascript:;'>...").Append(Path.DirectorySeparatorChar).Append(assembly.AnonymizedPath).Append("</a>"))
.AppendIf(!isDynamic && hasPath, sb => sb.Append("<a href='javascript:;'>").Append(assembly.AnonymizedPath).Append("</a>"))
.Append("</li>");
}

Expand All @@ -547,7 +547,7 @@ void AppendNative(NativeAssemblyModel assembly)
.Append(assembly.Id.Name).Append(", ")
.Append(assembly.Id.Version).Append(", ")
.Append(assembly.Architecture.ToString()).Append(", ")
.Append("<a href='javascript:;'>...").Append(Path.DirectorySeparatorChar).Append(assembly.AnonymizedPath).Append("</a>")
.Append("<a href='javascript:;'>").Append(assembly.AnonymizedPath).Append("</a>")
.Append("</li>");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using ImGuiNET;

using System.Collections.Generic;
using System.IO;

namespace BUTR.CrashReport.Renderer.ImGui.Renderer;

Expand All @@ -27,8 +26,8 @@ private class AssemblyModelEqualityComparer : IEqualityComparer<AssemblyModel>
private static bool _hideLoaderAssemblies;
private static bool _hideLoaderPluginsAssemblies;
private static bool _hideDynamicAssemblies;
private static bool _hideUnclassifiedAssemblies;

private readonly Dictionary<AssemblyModel, byte[]> _assemblyPathUtf8 = new(AssemblyModelEqualityComparer.Instance);
private readonly Dictionary<AssemblyModel, byte[]> _assemblyFullNameUtf8 = new(AssemblyModelEqualityComparer.Instance);

private static readonly byte[][] _architectureTypeNames =
Expand All @@ -46,7 +45,6 @@ private void InitializeAssemblies()
for (var i = 0; i < _crashReport.Assemblies.Count; i++)
{
var assembly = _crashReport.Assemblies[i];
_assemblyPathUtf8[assembly] = UnsafeHelper.ToUtf8Array($"..{Path.DirectorySeparatorChar}{assembly.AnonymizedPath}");
_assemblyFullNameUtf8[assembly] = UnsafeHelper.ToUtf8Array(assembly.GetFullName());
}
}
Expand All @@ -62,7 +60,8 @@ private void RenderAssemblies()
_imgui.CheckboxSameLine(" Modules | \0"u8, ref _hideModulesAssemblies);
_imgui.CheckboxSameLine(" Loader | \0"u8, ref _hideLoaderAssemblies);
_imgui.CheckboxSameLine(" Loader Plugins | \0"u8, ref _hideLoaderPluginsAssemblies);
_imgui.Checkbox(" Dynamic \0"u8, ref _hideDynamicAssemblies);
_imgui.CheckboxSameLine(" Dynamic \0"u8, ref _hideDynamicAssemblies);
_imgui.Checkbox(" Unclassified | \0"u8, ref _hideUnclassifiedAssemblies);
_imgui.PopStyleVar();

for (var i = 0; i < _crashReport.Assemblies.Count; i++)
Expand All @@ -76,6 +75,7 @@ private void RenderAssemblies()
if (_hideLoaderAssemblies && assembly.Type.IsSet(AssemblyModelType.Loader)) continue;
if (_hideLoaderPluginsAssemblies && assembly.Type.IsSet(AssemblyModelType.LoaderPlugin)) continue;
if (_hideDynamicAssemblies && assembly.Type.IsSet(AssemblyModelType.Dynamic)) continue;
if (_hideUnclassifiedAssemblies && assembly.Type == AssemblyModelType.Unclassified) continue;

var isDynamic = assembly.Type.IsSet(AssemblyModelType.Dynamic);
var hasPath = assembly.AnonymizedPath != "EMPTY" && assembly.AnonymizedPath != "DYNAMIC" && !string.IsNullOrWhiteSpace(assembly.AnonymizedPath);
Expand All @@ -94,7 +94,7 @@ private void RenderAssemblies()
if (hasPath)
{
_imgui.TextSameLine(", \0"u8);
_imgui.SmallButton(_assemblyPathUtf8[assembly]);
_imgui.SmallButton(assembly.AnonymizedPath);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,8 @@ private class NativeAssemblyModelEqualityComparer : IEqualityComparer<NativeAsse
"Arm"u8.ToArray(), // Arm
"Arm64"u8.ToArray(), // Arm64
];

private readonly Dictionary<NativeAssemblyModel, byte[]> _nativePathUtf8 = new(NativeAssemblyModelEqualityComparer.Instance);

private void InitializeNatives()
{
for (var i = 0; i < _crashReport.NativeModules.Count; i++)
{
var native = _crashReport.NativeModules[i];
_nativePathUtf8[native] = UnsafeHelper.ToUtf8Array($"..{Path.DirectorySeparatorChar}{native.AnonymizedPath}");
}
}

private void InitializeNatives() { }

private void RenderNatives()
{
Expand All @@ -54,7 +45,7 @@ private void RenderNatives()
_imgui.TextSameLine(", \0"u8);
_imgui.TextSameLine(assembly.Hash);
_imgui.TextSameLine(", \0"u8);
_imgui.SmallButton(_nativePathUtf8[assembly]);
_imgui.SmallButton(assembly.AnonymizedPath);
}
}
}

0 comments on commit 4787bd6

Please sign in to comment.