Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SymbolStore] Add support to index .NET Framework Runtime debugging modules #4616

Merged
Prev Previous commit
Next Next commit
[SymbolStore] Add helper to build Ids from PEFile properties
  • Loading branch information
mdh1418 committed May 8, 2024
commit c0f4dacc64dcc5c72157aef8c3eebbef459f5465
13 changes: 9 additions & 4 deletions src/Microsoft.SymbolStore/KeyGenerators/PEFileKeyGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public override IEnumerable<SymbolStoreKey> GetKeys(KeyTypeFlags flags)
// Return keys for SOS modules for a given runtime module
if ((flags & (KeyTypeFlags.ClrKeys)) != 0)
{
string coreclrId = string.Format("{0:X8}{1:x}", _peFile.Timestamp, _peFile.SizeOfImage);
string coreclrId = BuildId(_peFile.Timestamp, _peFile.SizeOfImage);
foreach (string specialFileName in GetSOSFiles(GetFileName(_path)))
{
yield return BuildKey(specialFileName, coreclrId);
Expand All @@ -105,7 +105,7 @@ public override IEnumerable<SymbolStoreKey> GetKeys(KeyTypeFlags flags)
// Return keys for DAC and DBI modules for a given runtime module
if ((flags & (KeyTypeFlags.ClrKeys | KeyTypeFlags.DacDbiKeys)) != 0)
{
string coreclrId = string.Format("{0:X8}{1:x}", _peFile.Timestamp, _peFile.SizeOfImage);
string coreclrId = BuildId(_peFile.Timestamp, _peFile.SizeOfImage);
foreach (string specialFileName in GetDACFiles(GetFileName(_path)))
{
yield return BuildKey(specialFileName, coreclrId);
Expand All @@ -116,7 +116,7 @@ public override IEnumerable<SymbolStoreKey> GetKeys(KeyTypeFlags flags)
{
if ((_peFile.FileHeader.Characteristics & (ushort)ImageFile.Dll) == 0 && !_peFile.IsILImage)
{
string id = string.Format("{0:X8}{1:x}", _peFile.Timestamp, _peFile.SizeOfImage);
string id = BuildId(_peFile.Timestamp, _peFile.SizeOfImage);

// The host program as itself (usually dotnet.exe)
yield return BuildKey(_path, id);
Expand Down Expand Up @@ -235,8 +235,13 @@ public static SymbolStoreKey GetKey(string path, uint timestamp, uint sizeOfImag
bool clrSpecialFile = s_knownRuntimeSpecialFiles.Contains(fileName) ||
(s_knownFilesWithLongNameVariant.Any((file) => fileName.StartsWith(Path.GetFileNameWithoutExtension(file).ToLowerInvariant() + "_")) && Path.GetExtension(fileName) == ".dll");

string id = string.Format("{0:X8}{1:x}", timestamp, sizeOfImage);
string id = BuildId(timestamp, sizeOfImage);
return BuildKey(path, id, clrSpecialFile);
}

private static string BuildId(uint timestamp, uint sizeOfImage)
{
return string.Format("{0:X8}{1:x}", timestamp, sizeOfImage);
}
}
}