예제 #1
0
        public void Search(string searchPathEntry, FileSearchInfo searchInfo, FileSearchResult result)
        {
            if (searchPathEntry == FileLocator.FirstSearchEntry || searchPathEntry == FileLocator.LastSearchEntry)
            {
                return;
            }
            if (searchInfo.SearchKind == FileSearchInfo.FileSearchKind.Source)
            {
                return;
            }

            // don't search for ngen images on the symbol server, we won't find them
            if (searchInfo.Path.EndsWith(".ni.dll", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            string fileName    = Path.GetFileName(searchInfo.Path);
            string indexString = ComputeIndexString(searchInfo);

            SymStore store;

            if (searchPathEntry.StartsWith("srv*"))
            {
                store = SymStore.FromPath(searchPathEntry);
            }
            else
            {
                store = SymStore.FromPath(@"srv**" + searchPathEntry);
            }
            string filePath;

            if (store.TryGetFile(fileName, indexString, out filePath))
            {
                result.CreateEntry(filePath);
            }
        }
예제 #2
0
        static string GetPdbFileForModule(string fileName)
        {
            string retVal;

            // look in the "cache" of already successfully opened
            if (s_pdbFileForModule.TryGetValue(fileName, out retVal))
            {
                return(retVal);
            }

            retVal = null;
            CodeViewDebugData cvdd = CvDataFromPE(fileName);

            if (cvdd != null)
            {
                if (s_symStore == null)
                {
                    s_symStore = SymStore.FromPath(s_symbolServerPath);
                }

                if (s_symStore != null)
                {
                    Stream         pdbStream;
                    string         indexString   = cvdd.Signature.ToString().Replace("-", "").ToUpper() + cvdd.Age.ToString();
                    string         localFileName = Path.GetFileName(cvdd.PdbPath);
                    SymStoreResult symResult     = new SymStoreResult();
                    if (s_symStore.TryGetFile(localFileName, indexString, symResult, out pdbStream))
                    {
                        retVal = symResult.CachedPath;
                    }
                }
            }

            s_pdbFileForModule.Add(fileName, retVal);
            return(retVal);
        }