示例#1
0
        public override bool IsMatchingPdb(string pdbPath)
        {
            if (m_peFile == null)
            {
                m_peFile = new PEFile(new ReadVirtualStream(m_runtime.DataReader, (long)m_imageBase, (long)m_size), true);
            }

            string pdbName;
            Guid   pdbGuid;
            int    rev;

            if (!m_peFile.GetPdbSignature(out pdbName, out pdbGuid, out rev))
            {
                throw new ClrDiagnosticsException("Failed to get PDB signature from module.", ClrDiagnosticsException.HR.DataRequestError);
            }

            IDiaDataSource source = DiaLoader.GetDiaSourceObject();
            IDiaSession    session;

            source.loadDataFromPdb(pdbPath);
            source.openSession(out session);
            return(pdbGuid == session.globalScope.guid);
        }
示例#2
0
        public static bool PdbMatches(string filePath, Guid pdbIndexGuid, int revision)
        {
            if (File.Exists(filePath))
            {
                Dia2Lib.IDiaDataSource source  = null;
                Dia2Lib.IDiaSession    session = null;
                try
                {
                    source = DiaLoader.GetDiaSourceObject();
                    source.loadDataFromPdb(filePath);
                    source.openSession(out session);

                    if (pdbIndexGuid == session.globalScope.guid && (uint)revision == session.globalScope.age)
                    {
                        return(true);
                    }
                }
                catch (Exception)
                {
                }
                finally
                {
                    if (source != null)
                    {
                        Marshal.ReleaseComObject(source);
                    }

                    if (session != null)
                    {
                        Marshal.ReleaseComObject(session);
                    }
                }
            }

            return(false);
        }