From a10d151edf6955a6e174429af26bef652d918fad Mon Sep 17 00:00:00 2001 From: Brian Robbins Date: Thu, 9 Apr 2026 10:27:43 -0700 Subject: [PATCH 1/2] Fix PDB symbol resolution for unmerged Windows traces The ELF symbol work introduced a switch on BinaryFormat in LookupSymbolsForModule that only handled PE and ELF cases. For unmerged Windows traces, symbolInfo is null (no RSDS events in the ETL), so BinaryFormat returns Unspecified, causing symbol resolution to be skipped entirely. Add a case for ModuleBinaryFormat.Unspecified that falls back to PDB lookup on Windows. OpenPdbForModuleFile handles missing PDB signatures gracefully by checking the local file on disk. Also rename ModuleBinaryFormat.Unknown to Unspecified to better reflect that the format was not specified in the trace data. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/TraceEvent/TraceLog.cs | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/src/TraceEvent/TraceLog.cs b/src/TraceEvent/TraceLog.cs index 2da6882f0..fb0f65fe1 100644 --- a/src/TraceEvent/TraceLog.cs +++ b/src/TraceEvent/TraceLog.cs @@ -8970,10 +8970,34 @@ private void LookupSymbolsForModule(SymbolReader reader, TraceModuleFile moduleF } break; + case ModuleBinaryFormat.Unspecified: + { + // For unmerged Windows traces, symbolInfo is null because the ETL + // didn't contain RSDS events with PDB identity info. + // Fall back to PDB lookup on Windows, which handles missing signatures + // gracefully and returns null if the file isn't a PE binary. + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + reader.m_log.WriteLine("LookupSymbolsForModule: Binary format unspecified for {0}, looking up PDB info from local file.", moduleFile.FilePath); + NativeSymbolModule moduleReader = OpenPdbForModuleFile(reader, moduleFile) as NativeSymbolModule; + if (moduleReader != null) + { + symbolLookup = moduleReader; + } + // Standard PE RVA computation. + computeRva = (address) => (uint)(address - moduleFile.ImageBase); + } + else + { + reader.m_log.WriteLine("LookupSymbolsForModule: Binary format unspecified for {0}, skipping.", moduleFile.FilePath); + } + } + break; + default: { - Debug.Assert(false, "LookupSymbolsForModule: unknown binary format " + moduleFile.BinaryFormat); - reader.m_log.WriteLine("LookupSymbolsForModule: Unknown binary format {0} for {1}, skipping.", moduleFile.BinaryFormat, moduleFile.FilePath); + Debug.Assert(false, "LookupSymbolsForModule: unrecognized binary format " + moduleFile.BinaryFormat); + reader.m_log.WriteLine("LookupSymbolsForModule: Unrecognized binary format {0} for {1}, skipping.", moduleFile.BinaryFormat, moduleFile.FilePath); } break; } @@ -10568,7 +10592,7 @@ public string Name /// /// The binary format of this module file (PE, ELF, or Unknown). /// - public ModuleBinaryFormat BinaryFormat { get { return symbolInfo?.Format ?? ModuleBinaryFormat.Unknown; } } + public ModuleBinaryFormat BinaryFormat { get { return symbolInfo?.Format ?? ModuleBinaryFormat.Unspecified; } } /// /// PE-specific symbol info (PDB identity + R2R). Null if this is not a PE module. @@ -10780,7 +10804,7 @@ void IFastSerializable.ToStream(Serializer serializer) serializer.WriteAddress(imageBase); // Write symbol info with format discriminator - byte format = (byte)(symbolInfo?.Format ?? ModuleBinaryFormat.Unknown); + byte format = (byte)(symbolInfo?.Format ?? ModuleBinaryFormat.Unspecified); serializer.Write(format); if (symbolInfo != null) { @@ -10836,8 +10860,8 @@ void IFastSerializable.FromStream(Deserializer deserializer) /// public enum ModuleBinaryFormat : byte { - /// The module format is unknown. - Unknown = 0, + /// The module format was not specified in the trace. + Unspecified = 0, /// Windows Portable Executable format. PE = 1, /// Linux ELF (Executable and Linkable Format). From 7c44261d80711417924af75e223f949825a7418a Mon Sep 17 00:00:00 2001 From: Brian Robbins Date: Thu, 9 Apr 2026 10:28:02 -0700 Subject: [PATCH 2/2] Bump version to 3.2.2 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index f1642de14..dc593e2de 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -19,7 +19,7 @@ - 3.2.1 + 3.2.2 $(ReleaseVersion) $(ReleaseVersion) $(ReleaseVersion)