summaryrefslogtreecommitdiff
path: root/src/vm/compile.cpp
diff options
context:
space:
mode:
authorVance Morrison <vancem@microsoft.com>2016-09-19 16:18:38 -0700
committerVance Morrison <vancem@microsoft.com>2016-09-19 16:18:38 -0700
commitf67a32fbcaf47b9072acbe1638beb8d61842b5dd (patch)
tree40e35118cbc76b70bd8b231a247541254bff6f1f /src/vm/compile.cpp
parent32f0f9721afb584b4a14d69135bea7ddc129f755 (diff)
downloadcoreclr-f67a32fbcaf47b9072acbe1638beb8d61842b5dd.tar.gz
coreclr-f67a32fbcaf47b9072acbe1638beb8d61842b5dd.tar.bz2
coreclr-f67a32fbcaf47b9072acbe1638beb8d61842b5dd.zip
FixBadReadyToRunPdb.9-19-16
Diffstat (limited to 'src/vm/compile.cpp')
-rw-r--r--src/vm/compile.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp
index ee38e8b5bc..4e39909735 100644
--- a/src/vm/compile.cpp
+++ b/src/vm/compile.cpp
@@ -3060,6 +3060,13 @@ private:
DWORD m_dwExtraData;
LPCWSTR m_wszManagedPDBSearchPath;
+ // Currently The DiasymWriter does not use the correct PDB signature for NGEN PDBS unless
+ // the NGEN DLL whose symbols are being generated end in .ni.dll. Thus we copy
+ // to this name if it does not follow this covention (as is true with readyToRun
+ // dlls). This variable remembers this temp file path so we can delete it after
+ // Pdb generation. If DiaSymWriter is fixed, we can remove this.
+ SString m_tempSourceDllName;
+
// Interfaces for reading IL PDB info
ReleaseHolder<ISymUnmanagedBinder> m_pBinder;
ReleaseHolder<ISymUnmanagedReader> m_pReader;
@@ -3107,6 +3114,8 @@ public:
ZeroMemory(m_wszPDBFilePath, sizeof(m_wszPDBFilePath));
}
+
+ ~NGenModulePdbWriter();
HRESULT WritePDBData();
@@ -3407,6 +3416,13 @@ HRESULT NGenModulePdbWriter::InitILPdbData()
return S_OK;
}
+NGenModulePdbWriter::~NGenModulePdbWriter()
+{
+ // Delete any temporary files we created.
+ if (m_tempSourceDllName.GetCount() != 0)
+ DeleteFileW(m_tempSourceDllName);
+ m_tempSourceDllName.Clear();
+}
//---------------------------------------------------------------------------------------
//
@@ -3441,8 +3457,32 @@ HRESULT NGenModulePdbWriter::WritePDBData()
PEImageLayout * pLoadedLayout = m_pModule->GetFile()->GetLoaded();
+ // Currently DiaSymReader does not work properly generating NGEN PDBS unless
+ // the DLL whose PDB is being generated ends in .ni.*. Unfortunately, readyToRun
+ // images do not follow this convention and end up producing bad PDBS. To fix
+ // this (without changing diasymreader.dll which ships indepdendently of .Net Core)
+ // we copy the file to somethign with this convention before generating the PDB
+ // and delete it when we are done.
+ SString dllPath = pLoadedLayout->GetPath();
+ if (!dllPath.EndsWithCaseInsensitive(L".ni.dll") && !dllPath.EndsWithCaseInsensitive(L".ni.exe"))
+ {
+ SString::Iterator fileNameStart = dllPath.Begin();
+ dllPath.FindBack(fileNameStart, '\\');
+
+ SString::Iterator ext = dllPath.End();
+ dllPath.FindBack(ext, '.');
+
+ // m_tempSourceDllName = Convertion of INPUT.dll to INPUT.ni.dll where the PDB lives.
+ m_tempSourceDllName = m_wszPdbPath;
+ m_tempSourceDllName += SString(dllPath, fileNameStart, ext - fileNameStart);
+ m_tempSourceDllName += L".ni";
+ m_tempSourceDllName += SString(dllPath, ext, dllPath.End() - ext);
+ CopyFileW(dllPath, m_tempSourceDllName, false);
+ dllPath = m_tempSourceDllName;
+ }
+
ReleaseHolder<ISymNGenWriter> pWriter1;
- hr = m_Create(pLoadedLayout->GetPath(), m_wszPdbPath, &pWriter1);
+ hr = m_Create(dllPath, m_wszPdbPath, &pWriter1);
if (FAILED(hr))
return hr;