Delete non-supported handling of Windows-specific PDBs in ilasm (#45979)
authorJan Kotas <jkotas@microsoft.com>
Sat, 12 Dec 2020 01:22:23 +0000 (17:22 -0800)
committerGitHub <noreply@github.com>
Sat, 12 Dec 2020 01:22:23 +0000 (17:22 -0800)
I do not expect we will ever add the classic PDB support back in ilasm.

Fixes #45492

src/coreclr/ilasm/assem.cpp
src/coreclr/ilasm/assembler.cpp
src/coreclr/ilasm/assembler.h
src/coreclr/ilasm/grammar_after.cpp
src/coreclr/ilasm/main.cpp
src/coreclr/ilasm/method.hpp
src/coreclr/ilasm/writer.cpp
src/coreclr/ilasm/writer_enc.cpp

index bfe765c..c8ef269 100644 (file)
@@ -106,8 +106,6 @@ Assembler::Assembler()
     m_ulLastDebugColumn = 0xFFFFFFFF;
     m_ulLastDebugLineEnd = 0xFFFFFFFF;
     m_ulLastDebugColumnEnd = 0xFFFFFFFF;
-    m_pSymWriter = NULL;
-    m_pSymDocument = NULL;
     m_dwIncludeDebugInfo = 0;
     m_fGeneratePDB = FALSE;
     m_fIsMscorlib = FALSE;
@@ -158,7 +156,6 @@ Assembler::Assembler()
     dummyClass = new Class(NULL);
     indexKeywords(&indxKeywords);
 
-    m_pdbFormat = CLASSIC;
     m_pPortablePdbWriter = NULL;
 }
 
@@ -199,18 +196,10 @@ Assembler::~Assembler()
     while((m_szNamespace = m_NSstack.POP())) ;
     delete [] m_szFullNS;
 
-    m_DocWriterList.RESET(true);
-
     m_MethodBodyList.RESET(true);
 
     m_TypeDefDList.RESET(true);
 
-    if (m_pSymWriter != NULL)
-    {
-        m_pSymWriter->Close();
-        m_pSymWriter->Release();
-        m_pSymWriter = NULL;
-    }
     if (m_pImporter != NULL)
     {
         m_pImporter->Release();
@@ -234,7 +223,7 @@ Assembler::~Assembler()
 }
 
 
-BOOL Assembler::Init(BOOL generatePdb, PdbFormat pdbFormat)
+BOOL Assembler::Init(BOOL generatePdb)
 {
     if (m_pCeeFileGen != NULL) {
         if (m_pCeeFile)
@@ -254,7 +243,6 @@ BOOL Assembler::Init(BOOL generatePdb, PdbFormat pdbFormat)
     if (FAILED(m_pCeeFileGen->GetSectionCreate (m_pCeeFile, ".tls", sdReadWrite, &m_pTLSSection))) return FALSE;
 
     m_fGeneratePDB = generatePdb;
-    m_pdbFormat = pdbFormat;
 
     return TRUE;
 }
@@ -527,65 +515,10 @@ BOOL Assembler::EmitMethodBody(Method* pMethod, BinStr* pbsOut)
             //--------------------------------------------------------------------------------
             if(m_fGeneratePDB)
             {
-                if (m_pSymWriter != NULL)
-                {
-                    m_pSymWriter->OpenMethod(pMethod->m_Tok);
-                    ULONG N = pMethod->m_LinePCList.COUNT();
-                    if(pMethod->m_fEntryPoint) m_pSymWriter->SetUserEntryPoint(pMethod->m_Tok);
-                    if(N)
-                    {
-                        LinePC  *pLPC;
-                        ULONG32  *offsets=new ULONG32[N], *lines = new ULONG32[N], *columns = new ULONG32[N];
-                        ULONG32  *endlines=new ULONG32[N], *endcolumns=new ULONG32[N];
-                        if(offsets && lines && columns && endlines && endcolumns)
-                        {
-                            DocWriter* pDW;
-                            unsigned j=0;
-                            while((pDW = m_DocWriterList.PEEK(j++)))
-                            {
-                                if((m_pSymDocument = pDW->pWriter))
-                                {
-                                    int i, n;
-                                    for(i=0, n=0; (pLPC = pMethod->m_LinePCList.PEEK(i)); i++)
-                                    {
-                                        if(pLPC->pWriter == m_pSymDocument)
-                                        {
-                                            offsets[n] = pLPC->PC;
-                                            lines[n] = pLPC->Line;
-                                            columns[n] = pLPC->Column;
-                                            endlines[n] = pLPC->LineEnd;
-                                            endcolumns[n] = pLPC->ColumnEnd;
-                                            n++;
-                                        }
-                                    }
-                                    if(n) m_pSymWriter->DefineSequencePoints(m_pSymDocument,n,
-                                                                       offsets,lines,columns,endlines,endcolumns);
-                                } // end if(pSymDocument)
-                            } // end while(pDW = next doc.writer)
-                            pMethod->m_LinePCList.RESET(true);
-                        }
-                        else report->error("\nOutOfMemory!\n");
-                        delete [] offsets;
-                        delete [] lines;
-                        delete [] columns;
-                        delete [] endlines;
-                        delete [] endcolumns;
-                    }//enf if(N)
-                    HRESULT hrr;
-                    if(pMethod->m_ulLines[1])
-                        hrr = m_pSymWriter->SetMethodSourceRange(m_pSymDocument,pMethod->m_ulLines[0], pMethod->m_ulColumns[0],
-                                                           m_pSymDocument,pMethod->m_ulLines[1], pMethod->m_ulColumns[1]);
-                    EmitScope(&(pMethod->m_MainScope)); // recursively emits all nested scopes
-
-                    m_pSymWriter->CloseMethod();
-                }
-                else if (IsPortablePdb())
-                {
-                    if (FAILED(m_pPortablePdbWriter->DefineSequencePoints(pMethod)))
-                        return FALSE;
-                    if (FAILED(m_pPortablePdbWriter->DefineLocalScope(pMethod)))
-                        return FALSE;
-                }
+                if (FAILED(m_pPortablePdbWriter->DefineSequencePoints(pMethod)))
+                    return FALSE;
+                if (FAILED(m_pPortablePdbWriter->DefineLocalScope(pMethod)))
+                    return FALSE;
             } // end if(fIncludeDebugInfo)
             //-----------------------------------------------------
 
@@ -732,44 +665,6 @@ HRESULT Assembler::EmitPinvokeMap(mdToken tk, PInvokeDescriptor* pDescr)
                         pDescr->mrDll);         // [IN] ModuleRef token for the target DLL.
 }
 
-void Assembler::EmitScope(Scope* pSCroot)
-{
-    static ULONG32          scopeID;
-    static ARG_NAME_LIST    *pVarList;
-    int                     i;
-    WCHAR*                  wzVarName=&wzUniBuf[0];
-    char*                   szPhonyName=(char*)&wzUniBuf[dwUniBuf >> 1];
-    Scope*                  pSC = pSCroot;
-    if(pSC && m_pSymWriter)
-    {
-        if(SUCCEEDED(m_pSymWriter->OpenScope(pSC->dwStart,&scopeID)))
-        {
-            if(pSC->pLocals)
-            {
-                for(pVarList = pSC->pLocals; pVarList; pVarList = pVarList->pNext)
-                {
-                    if(pVarList->pSig)
-                    {
-                        if((pVarList->szName)&&(*(pVarList->szName))) strcpy_s(szPhonyName,dwUniBuf >> 1,pVarList->szName);
-                        else sprintf_s(szPhonyName,(dwUniBuf >> 1),"V_%d",pVarList->dwAttr);
-
-                        WszMultiByteToWideChar(g_uCodePage,0,szPhonyName,-1,wzVarName,dwUniBuf >> 1);
-
-                        m_pSymWriter->DefineLocalVariable(wzVarName,0,pVarList->pSig->length(),
-                            (BYTE*)pVarList->pSig->ptr(),ADDR_IL_OFFSET,pVarList->dwAttr,0,0,0,0);
-                    }
-                    else
-                    {
-                        report->error("Local Var '%s' has no signature\n",pVarList->szName);
-                    }
-                }
-            }
-            for(i = 0; (pSC = pSCroot->SubScope.PEEK(i)); i++) EmitScope(pSC);
-            m_pSymWriter->CloseScope(pSCroot->dwEnd);
-        }
-    }
-}
-
 BOOL Assembler::EmitMethod(Method *pMethod)
 {
 // Emit the metadata for a method definition
index b9bc13f..f28552f 100644 (file)
@@ -1417,7 +1417,6 @@ void Assembler::EmitOpcode(Instr* instr)
                 pLPC->LineEnd = instr->linenum_end;
                 pLPC->ColumnEnd = instr->column_end;
                 pLPC->PC = m_CurPC;
-                pLPC->pWriter = instr->pWriter;
 
                 pLPC->pOwnerDocument = instr->pOwnerDocument;
                 if (0xfeefee == instr->linenum &&
@@ -2390,51 +2389,11 @@ void Assembler::SetSourceFileName(__in __nullterminated char* szName)
             }
             if(m_fGeneratePDB)
             {
-                if (IsPortablePdb())
+                if (FAILED(m_pPortablePdbWriter->DefineDocument(szName, &m_guidLang)))
                 {
-                    if (FAILED(m_pPortablePdbWriter->DefineDocument(szName, &m_guidLang)))
-                    {
-                        report->error("Failed to define a document: '%s'", szName);
-                    }
-                    delete[] szName;
-                }
-                else
-                {
-                    DocWriter* pDW;
-                    unsigned i = 0;
-                    while ((pDW = m_DocWriterList.PEEK(i++)) != NULL)
-                    {
-                        if (!strcmp(szName, pDW->Name)) break;
-                    }
-                    if (pDW)
-                    {
-                        m_pSymDocument = pDW->pWriter;
-                        delete[] szName;
-                    }
-                    else if (m_pSymWriter)
-                    {
-                        HRESULT hr;
-                        WszMultiByteToWideChar(g_uCodePage, 0, szName, -1, wzUniBuf, dwUniBuf);
-                        if (FAILED(hr = m_pSymWriter->DefineDocument(wzUniBuf, &m_guidLang,
-                            &m_guidLangVendor, &m_guidDoc, &m_pSymDocument)))
-                        {
-                            m_pSymDocument = NULL;
-                            report->error("Failed to define a document writer");
-                        }
-                        if ((pDW = new DocWriter()) != NULL)
-                        {
-                            pDW->Name = szName;
-                            pDW->pWriter = m_pSymDocument;
-                            m_DocWriterList.PUSH(pDW);
-                        }
-                        else
-                        {
-                            report->error("Out of memory");
-                            delete[] szName;
-                        }
-                    }
-                    else delete[] szName;
+                    report->error("Failed to define a document: '%s'", szName);
                 }
+                delete[] szName;
             }
             else delete [] szName;
         }
@@ -2471,21 +2430,15 @@ HRESULT Assembler::SavePdbFile()
     HRESULT hr = S_OK;
     mdMethodDef entryPoint;
 
-    if (m_pdbFormat == PORTABLE)
-    {
-        if (FAILED(hr = (m_pPortablePdbWriter == NULL ? E_FAIL : S_OK))) goto exit;
-        if (FAILED(hr = (m_pPortablePdbWriter->GetEmitter() == NULL ? E_FAIL : S_OK))) goto exit;
-        if (FAILED(hr = m_pCeeFileGen->GetEntryPoint(m_pCeeFile, &entryPoint))) goto exit;
-        if (FAILED(hr = m_pPortablePdbWriter->BuildPdbStream(m_pEmitter, entryPoint))) goto exit;
-        if (FAILED(hr = m_pPortablePdbWriter->GetEmitter()->Save(m_wzPdbFileName, NULL))) goto exit;
-    }
+    if (FAILED(hr = (m_pPortablePdbWriter == NULL ? E_FAIL : S_OK))) goto exit;
+    if (FAILED(hr = (m_pPortablePdbWriter->GetEmitter() == NULL ? E_FAIL : S_OK))) goto exit;
+    if (FAILED(hr = m_pCeeFileGen->GetEntryPoint(m_pCeeFile, &entryPoint))) goto exit;
+    if (FAILED(hr = m_pPortablePdbWriter->BuildPdbStream(m_pEmitter, entryPoint))) goto exit;
+    if (FAILED(hr = m_pPortablePdbWriter->GetEmitter()->Save(m_wzPdbFileName, NULL))) goto exit;
+
 exit:
     return hr;
 }
-BOOL Assembler::IsPortablePdb()
-{
-    return (m_pdbFormat == PORTABLE) && (m_pPortablePdbWriter != NULL);
-}
 
 // This method is called after we have parsed the generic type parameters for either
 // a generic class or a generic method.  It calls CheckAddGenericParamConstraint on
index 8f87df6..e220a6c 100644 (file)
@@ -620,14 +620,6 @@ struct     EATEntry
 };
 typedef FIFO<EATEntry> EATList;
 
-struct DocWriter
-{
-    char* Name;
-    ISymUnmanagedDocumentWriter* pWriter;
-    DocWriter() { Name=NULL; pWriter=NULL; };
-    ~DocWriter() { delete [] Name; if(pWriter) pWriter->Release();};
-};
-typedef FIFO<DocWriter> DocWriterList;
 /**************************************************************************/
 /* The assembler object does all the code generation (dealing with meta-data)
    writing a PE file etc etc. But does NOT deal with syntax (that is what
@@ -642,7 +634,6 @@ struct Instr
     unsigned linenum_end;
        unsigned column_end;
     unsigned pc;
-    ISymUnmanagedDocumentWriter* pWriter;
     Document* pOwnerDocument;
 };
 #define INSTR_POOL_SIZE 16
@@ -736,12 +727,6 @@ struct Indx
     }
 };
 
-typedef enum {
-    CLASSIC,        // default - classic PDB format, currently not supported for CoreCLR
-    PORTABLE,
-    // EMBEDDED     // for future use
-} PdbFormat;
-
 class Assembler {
 public:
     Assembler();
@@ -852,7 +837,7 @@ public:
     void    AddToImplList(mdToken);
     void    ClearBoundList(void);
     //--------------------------------------------------------------------------------
-    BOOL Init(BOOL generatePdb, PdbFormat pdbFormat);
+    BOOL Init(BOOL generatePdb);
     void ProcessLabel(__in_z __in char *pszName);
     GlobalLabel *FindGlobalLabel(LPCUTF8 pszName);
     GlobalFixup *AddDeferredGlobalFixup(__in __nullterminated char *pszLabel, BYTE* reference);
@@ -1041,9 +1026,6 @@ public:
 
     // Debug metadata paraphernalia
 public:
-    ISymUnmanagedWriter* m_pSymWriter;
-    ISymUnmanagedDocumentWriter* m_pSymDocument;
-    DocWriterList m_DocWriterList;
     ULONG m_ulCurLine; // set by Parser
     ULONG m_ulCurColumn; // set by Parser
     ULONG m_ulLastDebugLine;
@@ -1061,7 +1043,6 @@ public:
 
     // Portable PDB paraphernalia
 public:
-    PdbFormat           m_pdbFormat;
     PortablePdbWriter* m_pPortablePdbWriter;
     char                m_szPdbFileName[MAX_FILENAME_LENGTH * 3 + 1];
     WCHAR               m_wzPdbFileName[MAX_FILENAME_LENGTH];
@@ -1070,8 +1051,6 @@ public:
     void SetPdbFileName(__in __nullterminated char* szName);
     // Saves the pdb file.
     HRESULT SavePdbFile();
-    // Checks whether pdb generation is portable
-    BOOL IsPortablePdb();
 
     // Security paraphernalia
 public:
@@ -1219,8 +1198,6 @@ public:
     void AddMethodImpl(mdToken tkImplementedTypeSpec, __in __nullterminated char* szImplementedName, BinStr* pImplementedSig,
                     mdToken tkImplementingTypeSpec, __in_opt __nullterminated char* szImplementingName, BinStr* pImplementingSig);
     BOOL EmitMethodImpls();
-    // lexical scope handling paraphernalia:
-    void EmitScope(Scope* pSCroot); // struct Scope - see Method.hpp
     // source file name paraphernalia
     BOOL m_fSourceFileSet;
     void SetSourceFileName(__in __nullterminated char* szName);
@@ -1247,7 +1224,7 @@ public:
     Clockwork* bClock;
     void SetClock(Clockwork* val) { bClock = val; };
     // ENC paraphernalia
-    HRESULT InitMetaDataForENC(__in __nullterminated WCHAR* wzOrigFileName, BOOL generatePdb, PdbFormat pdbFormat);
+    HRESULT InitMetaDataForENC(__in __nullterminated WCHAR* wzOrigFileName, BOOL generatePdb);
     BOOL EmitFieldsMethodsENC(Class* pClass);
     BOOL EmitEventsPropsENC(Class* pClass);
     HRESULT CreateDeltaFiles(__in __nullterminated WCHAR *pwzOutputFilename);
index 1fcb1bf..790df23 100644 (file)
@@ -279,7 +279,7 @@ Instr* SetupInstr(unsigned short opcode)
     if((pVal = PASM->GetInstr()))
     {
         pVal->opcode = opcode;
-        if((pVal->pWriter = PASM->m_pSymDocument)!=NULL || PASM->IsPortablePdb())
+        if(PASM->m_fGeneratePDB)
         {
             if(PENV->bExternSource)
             {
@@ -297,10 +297,10 @@ Instr* SetupInstr(unsigned short opcode)
                 // Portable PDB rule:
                 // - If Start Line is equal to End Line then End Column is greater than Start Column.
                 // To fulfill this condition the column_end is set to 2 instead of 0
-                pVal->column_end = PASM->IsPortablePdb() ? 2 : 0;
+                pVal->column_end = 2;
                 pVal->pc = PASM->m_CurPC;
             }
-            pVal->pOwnerDocument = PASM->IsPortablePdb() ? PASM->m_pPortablePdbWriter->GetCurrentDocument() : NULL;
+            pVal->pOwnerDocument = PASM->m_pPortablePdbWriter->GetCurrentDocument();
         }
     }
     return pVal;
index 82a93d7..f27e7af 100644 (file)
@@ -113,7 +113,6 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
     bool        bLogo = TRUE;
     bool        bReportProgress = TRUE;
     BOOL        bGeneratePdb = FALSE;
-    PdbFormat   pdbFormat = CLASSIC;
     WCHAR*      wzIncludePath = NULL;
     int exitcode = 0;
     unsigned    uCodePage;
@@ -166,8 +165,6 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
       printf("\n/DLL            Compile to .dll");
       printf("\n/EXE            Compile to .exe (default)");
       printf("\n/PDB            Create the PDB file without enabling debug info tracking");
-      printf("\n/PDBFMT=CLASSIC     Use classic PDB format for PDB file generation (default)");
-      printf("\n/PDBFMT=PORTABLE    Use portable PDB format for PDB file generation");
       printf("\n/APPCONTAINER   Create an AppContainer exe or dll");
       printf("\n/DEBUG          Disable JIT optimization, create PDB file, use sequence points from PDB");
       printf("\n/DEBUG=IMPL     Disable JIT optimization, create PDB file, use implicit sequence points");
@@ -279,42 +276,6 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
                     else if (!_stricmp(szOpt, "PDB"))
                     {
                         bGeneratePdb = TRUE;
-
-                        // check for /PDBFMT= command line option
-                        char szOpt2[3 + 1] = { 0 };
-                        WszWideCharToMultiByte(uCodePage, 0, &argv[i][4], 3, szOpt2, sizeof(szOpt2), NULL, NULL);
-                        if (!_stricmp(szOpt2, "FMT"))
-                        {
-                            WCHAR* pStr = EqualOrColon(argv[i]);
-                            if (pStr != NULL)
-                            {
-                                for (pStr++; *pStr == L' '; pStr++);        //skip the blanks        
-                                if (wcslen(pStr) == 0)
-                                {
-                                    goto InvalidOption;                     //if no suboption
-                                }
-                                else
-                                {
-                                    WCHAR wzSubOpt[8 + 1];
-                                    wcsncpy_s(wzSubOpt, 8 + 1, pStr, 8);
-                                    wzSubOpt[8] = 0;
-                                    if (0 == _wcsicmp(wzSubOpt, W("CLASSIC")))
-                                        pdbFormat = CLASSIC;
-                                    else if (0 == _wcsicmp(wzSubOpt, W("PORTABLE")))
-                                        pdbFormat = PORTABLE;
-                                    else
-                                        goto InvalidOption;                 // bad subooption
-                                }
-                            }
-                            else
-                            {
-                                goto InvalidOption;                         // bad subooption
-                            }
-                        }
-                        else if (*szOpt2)
-                        {
-                            goto InvalidOption; // bad subooption
-                        }
                     }
                     else if (!_stricmp(szOpt, "CLO"))
                     {
@@ -636,15 +597,7 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
                 delete pAsm;
                 goto ErrorExit;
             }
-            if (bGeneratePdb && CLASSIC == pdbFormat)
-            {
-                // Classic PDB format is not supported on CoreCLR
-                // https://github.com/dotnet/runtime/issues/5051
-
-                printf("WARNING: Classic PDB format is not supported on CoreCLR.\n");
-                printf("Use '/PDBFMT=PORTABLE' option in order to generate portable PDB format. \n");
-            }
-            if (!pAsm->Init(bGeneratePdb, pdbFormat))
+            if (!pAsm->Init(bGeneratePdb))
             {
                 fprintf(stderr,"Failed to initialize Assembler\n");
                 delete pAsm;
@@ -854,7 +807,7 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
                                             }
                                             else
 #endif
-                                            if (SUCCEEDED(pAsm->InitMetaDataForENC(wzNewOutputFilename, bGeneratePdb, pdbFormat)))
+                                            if (SUCCEEDED(pAsm->InitMetaDataForENC(wzNewOutputFilename, bGeneratePdb)))
                                             {
                                                 pAsm->SetSourceFileName(FullFileName(wzInputFilename,uCodePage)); // deletes the argument!
 
index c52a3a4..8dd5d91 100644 (file)
@@ -23,7 +23,6 @@ struct LinePC
     ULONG   LineEnd;
     ULONG   ColumnEnd;
     ULONG   PC;
-    ISymUnmanagedDocumentWriter* pWriter;
     Document* pOwnerDocument;
     BOOL    IsHidden;
 };
index 0bff54b..5f045f0 100644 (file)
@@ -52,7 +52,7 @@ HRESULT Assembler::InitMetaData()
     if(FAILED(hr = m_pEmitter->QueryInterface(IID_IMetaDataImport2, (void**)&m_pImporter)))
         goto exit;
 
-    if (m_pdbFormat == PdbFormat::PORTABLE)
+    if (m_fGeneratePDB)
     {
         m_pPortablePdbWriter = new PortablePdbWriter();
         if (FAILED(hr = m_pPortablePdbWriter->Init(m_pDisp))) goto exit;
@@ -209,7 +209,7 @@ HRESULT Assembler::CreateDebugDirectory()
     ULONG deOffset;
 
     // Only emit this if we're also emitting debug info.
-    if (!(m_fGeneratePDB && (m_pSymWriter || IsPortablePdb())))
+    if (!m_fGeneratePDB)
         return S_OK;
 
     IMAGE_DEBUG_DIRECTORY  debugDirIDD;
@@ -220,80 +220,42 @@ HRESULT Assembler::CreateDebugDirectory()
     } param;
     param.debugDirData = NULL;
 
-    if (m_pSymWriter)   // CLASSIC
-    {
-        // Get the debug info from the symbol writer.
-        if (FAILED(hr=m_pSymWriter->GetDebugInfo(NULL, 0, &param.debugDirDataSize, NULL)))
-            return hr;
-
-        // Will there even be any?
-        if (param.debugDirDataSize == 0)
-            return S_OK;
-
-        // Make some room for the data.
-        PAL_TRY(Param *, pParam, &param) {
-            pParam->debugDirData = new BYTE[pParam->debugDirDataSize];
-        } PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
-            hr = E_FAIL;
-        } PAL_ENDTRY
-
-        if(FAILED(hr)) return hr;
-        // Actually get the data now.
-        if (FAILED(hr = m_pSymWriter->GetDebugInfo(&debugDirIDD,
-                                                   param.debugDirDataSize,
-                                                   NULL,
-                                                   param.debugDirData)))
-            goto ErrExit;
-
-        // Grab the timestamp of the PE file.
-        DWORD fileTimeStamp;
-
-        if (FAILED(hr = m_pCeeFileGen->GetFileTimeStamp(m_pCeeFile,
-                                                        &fileTimeStamp)))
-            goto ErrExit;
-
-        // Fill in the directory entry.
-        debugDirIDD.TimeDateStamp = VAL32(fileTimeStamp);
-    }
-    else if (IsPortablePdb())   // PORTABLE
-    {
-        // get module ID
-        DWORD rsds = 0x53445352;
-        DWORD pdbAge = 0x1;
-        DWORD len = sizeof(rsds) + sizeof(GUID) + sizeof(pdbAge) + (DWORD)strlen(m_szPdbFileName) + 1;
-        BYTE* dbgDirData = new BYTE[len];
-
-        DWORD offset = 0;
-        memcpy_s(dbgDirData + offset, len, &rsds, sizeof(rsds));                            // RSDS
-        offset += sizeof(rsds);
-        memcpy_s(dbgDirData + offset, len, m_pPortablePdbWriter->GetGuid(), sizeof(GUID)); // PDB GUID
-        offset += sizeof(GUID);
-        memcpy_s(dbgDirData + offset, len, &pdbAge, sizeof(pdbAge));                        // PDB AGE
-        offset += sizeof(pdbAge);
-        memcpy_s(dbgDirData + offset, len, m_szPdbFileName, strlen(m_szPdbFileName) + 1);   // PDB PATH
-
-        debugDirIDD.Characteristics = 0;
-        debugDirIDD.TimeDateStamp = m_pPortablePdbWriter->GetTimestamp();
-        debugDirIDD.MajorVersion = 0x100;
-        debugDirIDD.MinorVersion = 0x504d;
-        debugDirIDD.Type = IMAGE_DEBUG_TYPE_CODEVIEW;
-        debugDirIDD.SizeOfData = len;
-        debugDirIDD.AddressOfRawData = 0; // will be updated bellow
-        debugDirIDD.PointerToRawData = 0; // will be updated bellow
-
-        param.debugDirDataSize = len;
-
-        // Make some room for the data.
-        PAL_TRY(Param*, pParam, &param) {
-            pParam->debugDirData = new BYTE[pParam->debugDirDataSize];
-        } PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
-            hr = E_FAIL;
-        } PAL_ENDTRY
+    // get module ID
+    DWORD rsds = 0x53445352;
+    DWORD pdbAge = 0x1;
+    DWORD len = sizeof(rsds) + sizeof(GUID) + sizeof(pdbAge) + (DWORD)strlen(m_szPdbFileName) + 1;
+    BYTE* dbgDirData = new BYTE[len];
+
+    DWORD offset = 0;
+    memcpy_s(dbgDirData + offset, len, &rsds, sizeof(rsds));                            // RSDS
+    offset += sizeof(rsds);
+    memcpy_s(dbgDirData + offset, len, m_pPortablePdbWriter->GetGuid(), sizeof(GUID)); // PDB GUID
+    offset += sizeof(GUID);
+    memcpy_s(dbgDirData + offset, len, &pdbAge, sizeof(pdbAge));                        // PDB AGE
+    offset += sizeof(pdbAge);
+    memcpy_s(dbgDirData + offset, len, m_szPdbFileName, strlen(m_szPdbFileName) + 1);   // PDB PATH
+
+    debugDirIDD.Characteristics = 0;
+    debugDirIDD.TimeDateStamp = m_pPortablePdbWriter->GetTimestamp();
+    debugDirIDD.MajorVersion = 0x100;
+    debugDirIDD.MinorVersion = 0x504d;
+    debugDirIDD.Type = IMAGE_DEBUG_TYPE_CODEVIEW;
+    debugDirIDD.SizeOfData = len;
+    debugDirIDD.AddressOfRawData = 0; // will be updated bellow
+    debugDirIDD.PointerToRawData = 0; // will be updated bellow
+
+    param.debugDirDataSize = len;
+
+    // Make some room for the data.
+    PAL_TRY(Param*, pParam, &param) {
+        pParam->debugDirData = new BYTE[pParam->debugDirDataSize];
+    } PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
+        hr = E_FAIL;
+    } PAL_ENDTRY
 
-        if (FAILED(hr)) return hr;
+    if (FAILED(hr)) return hr;
 
-        param.debugDirData = dbgDirData;
-    }
+    param.debugDirData = dbgDirData;
 
     // Grab memory in the section for our stuff.
     // Note that UpdateResource doesn't work correctly if the debug directory is
index 96a637b..d99b02b 100644 (file)
 int ist=0;
 #define REPT_STEP   //printf("Step %d\n",++ist);
 
-HRESULT Assembler::InitMetaDataForENC(__in __nullterminated WCHAR* wzOrigFileName, BOOL generatePdb, PdbFormat pdbFormat)
+HRESULT Assembler::InitMetaDataForENC(__in __nullterminated WCHAR* wzOrigFileName, BOOL generatePdb)
 {
     HRESULT             hr = E_FAIL;
 
     if((wzOrigFileName==NULL)||(*wzOrigFileName == 0)||(m_pDisp==NULL)) return hr;
-    if (m_pSymWriter != NULL)
-    {
-        m_pSymWriter->Close();
-        m_pSymWriter->Release();
-        m_pSymWriter = NULL;
-    }
     if (m_pImporter != NULL)
     {
         m_pImporter->Release();
@@ -68,7 +62,7 @@ HRESULT Assembler::InitMetaDataForENC(__in __nullterminated WCHAR* wzOrigFileNam
         goto exit;
 
     //WszSetEnvironmentVariable(L"COMP_ENC_EMIT", wzOrigFileName);
-    if(!Init(generatePdb, pdbFormat)) goto exit; // close and re-open CeeFileGen and CeeFile
+    if(!Init(generatePdb)) goto exit; // close and re-open CeeFileGen and CeeFile
     hr = S_OK;
 
 
@@ -434,12 +428,6 @@ REPT_STEP
 
 
     // release all interfaces
-    if (m_pSymWriter != NULL)
-    {
-        m_pSymWriter->Close();
-        m_pSymWriter->Release();
-        m_pSymWriter = NULL;
-    }
     if (m_pImporter != NULL)
     {
         m_pImporter->Release();