Ejemplo n.º 1
0
        public DiaFile(String pdbFile, String dllFile)
        {
            m_dsc = GetDiaSourceClass();
            string pdbPath = System.IO.Path.GetDirectoryName(pdbFile);

            // Open the PDB file, validating it matches the supplied DLL file
            DiaLoadCallback loadCallback = new DiaLoadCallback();

            try
            {
                m_dsc.loadDataForExe(dllFile, pdbPath, loadCallback);
            }
            catch (System.Exception diaEx)
            {
                // Provide additional diagnostics context and rethrow
                string       msg   = "ERROR from DIA loading PDB for specified DLL";
                COMException comEx = diaEx as COMException;
                if (comEx != null)
                {
                    if (Enum.IsDefined(typeof(DiaHResults), comEx.ErrorCode))
                    {
                        // This is a DIA-specific error code,
                        DiaHResults hr = (DiaHResults)comEx.ErrorCode;
                        msg += ": " + hr.ToString();

                        // Additional clarification for the common case of the DLL not matching the PDB
                        if (hr == DiaHResults.E_PDB_NOT_FOUND)
                        {
                            msg +=
                                " - The specified PDB file does not match the specified DLL file";
                        }
                    }
                }
                throw new ApplicationException(msg, diaEx);
            }

            // Save the path of the PDB file actually loaded
            Debug.Assert(loadCallback.LoadedPdbPath != null, "Didn't get PDB load callback");
            m_loadedPdbPath = loadCallback.LoadedPdbPath;

            // Also use DIA to get the debug directory entry in the DLL referring
            // to the PDB, and save it's timestamp comparison at runtime.
            m_debugTimestamp = loadCallback.DebugTimeDateStamp;
            Debug.Assert(m_debugTimestamp != 0, "Didn't find debug directory entry");

            m_dsc.openSession(out m_session);
            m_global      = new DiaSymbol(m_session.globalScope);
            m_publicsEnum = null;
        }
Ejemplo n.º 2
0
    public DiaFile(String pdbFile, String dllFile)
    {
        m_dsc = new DiaSourceClass();
        string pdbPath = System.IO.Path.GetDirectoryName(pdbFile);

        // Open the PDB file, validating it matches the supplied DLL file
        DiaLoadCallback loadCallback = new DiaLoadCallback();
        try
        {
            m_dsc.loadDataForExe(dllFile, pdbPath, loadCallback);
        }
        catch (System.Exception diaEx)
        {
            // Provide additional diagnostics context and rethrow
            string msg = "ERROR from DIA loading PDB for specified DLL";
            COMException comEx = diaEx as COMException;
            if (comEx != null)
            {
                if (Enum.IsDefined(typeof(DiaHResults), comEx.ErrorCode))
                {
                    // This is a DIA-specific error code,
                    DiaHResults hr = (DiaHResults)comEx.ErrorCode;
                    msg += ": " + hr.ToString();

                    // Additional clarification for the common case of the DLL not matching the PDB
                    if (hr == DiaHResults.E_PDB_NOT_FOUND)
                    {
                        msg += " - The specified PDB file does not match the specified DLL file";
                    }
                }
            }
            throw new ApplicationException(msg, diaEx);
        }

        // Save the path of the PDB file actually loaded
        Debug.Assert(loadCallback.LoadedPdbPath != null, "Didn't get PDB load callback");
        m_loadedPdbPath = loadCallback.LoadedPdbPath;

        // Also use DIA to get the debug directory entry in the DLL referring
        // to the PDB, and save it's timestamp comparison at runtime.
        m_debugTimestamp = loadCallback.DebugTimeDateStamp;
        Debug.Assert(m_debugTimestamp != 0, "Didn't find debug directory entry");

        m_dsc.openSession(out m_session);
        m_global = new DiaSymbol(m_session.globalScope);
        m_publicsEnum = null;
    }