private string GetCacheFilePath(SymbolStoreKey key) { if (SymbolStoreKey.IsKeyValid(key.Index)) { return(Path.Combine(CacheDirectory, key.Index)); } Tracer.Error("CacheSymbolStore: invalid key index {0}", key.Index); return(null); }
private async Task ScanFileAsync([NotNull] string sourceDir, [NotNull] string sourceFile, [NotNull] ITracer tracer) { var srcFile = Path.GetRelativePath(sourceDir, sourceFile); tracer.Information($" Scanning {srcFile}..."); foreach (var key in GetKeyInfos(tracer, sourceFile)) { var index = key.Item1.Index; if (!SymbolStoreKey.IsKeyValid(index)) { tracer.Error($"Invalid key index in file {index}"); } else if (key.Item2 == KeyType.Elf && Path.GetExtension(sourceFile) == ".debug" && !index.EndsWith("/_.debug")) { // Bug: Check that ELF .debug was processed right way! See https://github.com/dotnet/symstore/issues/158 tracer.Error($"ELF file {sourceFile} was processed incorrectly because Microsoft.SymbolStore doesn't support .debug extension"); } else { var dstFile = index.NormalizeSystem(); if ( myCompressWPdb && key.Item2 == KeyType.WPdb || myCompressPe && key.Item2 == KeyType.Pe) { await myProcessCompressed(sourceDir, srcFile, Path.ChangeExtension(dstFile, PathUtil.GetPackedExtension(Path.GetExtension(dstFile)))); if (myIsKeepNonCompressed) { await myProcessNormal(sourceDir, srcFile, dstFile); } } else { await myProcessNormal(sourceDir, srcFile, dstFile); } } } }
protected override Task <SymbolStoreFile> GetFileInner(SymbolStoreKey key, CancellationToken token) { SymbolStoreFile result = null; if (SymbolStoreKey.IsKeyValid(key.Index)) { string filePath = Path.Combine(Directory, Path.GetFileName(key.FullPathName)); if (File.Exists(filePath)) { try { Stream fileStream = File.OpenRead(filePath); var file = new SymbolStoreFile(fileStream, filePath); var generator = new FileKeyGenerator(Tracer, file); foreach (SymbolStoreKey targetKey in generator.GetKeys(KeyTypeFlags.IdentityKey)) { if (key.Equals(targetKey)) { result = file; break; } } } catch (Exception ex) when(ex is UnauthorizedAccessException || ex is IOException) { } } } else { Tracer.Error("DirectorySymbolStore: invalid key index {0}", key.Index); } return(Task.FromResult(result)); }