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) 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).