summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Chen (CLR) <jochen@microsoft.com>2016-08-05 16:08:18 -0700
committerJohn Chen (CLR) <jochen@microsoft.com>2016-08-08 13:36:34 -0700
commit21df26e038c4039150a7978188ecd0b6a5f23d2b (patch)
tree9ff37042706b455e937751b2d27aff2a9ae9eba6
parentdeb00ad58acf627763b6c0a7833fa789e3bb1cd0 (diff)
downloadcoreclr-21df26e038c4039150a7978188ecd0b6a5f23d2b.tar.gz
coreclr-21df26e038c4039150a7978188ecd0b6a5f23d2b.tar.bz2
coreclr-21df26e038c4039150a7978188ecd0b6a5f23d2b.zip
Modify "crossgen -createpdb" to skip loading clrjit.dll (#6607)
The -JITPath option doesn't work properly when CrossGen is used to create a PDB file (issue #6607). Since clrjit.dll isn't really needed for creating PDB files, the issue is fixed by modifying CrossGen to skip loading clrjit.dll when -createpdb option is given. Also following suggestion from issue #6607, added a new switch -diasymreaderPath to CrossGen, to allow loading diasymreader.dll from an alternative path.
-rw-r--r--src/inc/corcompile.h2
-rw-r--r--src/inc/zapper.h9
-rw-r--r--src/tools/crossgen/crossgen.cpp39
-rw-r--r--src/vm/compile.cpp10
-rw-r--r--src/zap/zapper.cpp42
5 files changed, 91 insertions, 11 deletions
diff --git a/src/inc/corcompile.h b/src/inc/corcompile.h
index 223f0f5cd8..70db9f162b 100644
--- a/src/inc/corcompile.h
+++ b/src/inc/corcompile.h
@@ -1915,7 +1915,7 @@ extern "C" ICorCompileInfo * __stdcall GetCompileInfo();
extern "C" unsigned __stdcall PartialNGenStressPercentage();
// create a PDB dumping all functions in hAssembly into pdbPath
-extern "C" HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath);
+extern "C" HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath, LPCWSTR pDiasymreaderPath);
#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
extern bool g_fNGenMissingDependenciesOk;
diff --git a/src/inc/zapper.h b/src/inc/zapper.h
index 0f92e85e0e..2fa94373fa 100644
--- a/src/inc/zapper.h
+++ b/src/inc/zapper.h
@@ -126,7 +126,11 @@ class Zapper
#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
SString m_CLRJITPath;
+ bool m_fDontLoadJit;
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+ SString m_DiasymreaderPath;
+#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
bool m_fForceFullTrust;
SString m_outputFilename;
@@ -450,8 +454,13 @@ class Zapper
#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
void SetCLRJITPath(LPCWSTR pwszCLRJITPath);
+ void SetDontLoadJit();
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+ void SetDiasymreaderPath(LPCWSTR pwzDiasymreaderPath);
+#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+
void SetOutputFilename(LPCWSTR pwszOutputFilename);
SString GetOutputFileName();
diff --git a/src/tools/crossgen/crossgen.cpp b/src/tools/crossgen/crossgen.cpp
index 8330660ceb..960bcf51cd 100644
--- a/src/tools/crossgen/crossgen.cpp
+++ b/src/tools/crossgen/crossgen.cpp
@@ -33,7 +33,7 @@ enum ReturnValues
#define NumItems(s) (sizeof(s) / sizeof(s[0]))
-STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzAppNiPaths, LPCWSTR pwzPdbPath, BOOL fGeneratePDBLinesInfo, LPCWSTR pwzManagedPdbSearchPath, LPCWSTR pwzPlatformWinmdPaths);
+STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzAppNiPaths, LPCWSTR pwzPdbPath, BOOL fGeneratePDBLinesInfo, LPCWSTR pwzManagedPdbSearchPath, LPCWSTR pwzPlatformWinmdPaths, LPCWSTR pwzDiasymreaderPath);
STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzOutputFilename=NULL, LPCWSTR pwzPlatformWinmdPaths=NULL, ICorSvcLogger *pLogger = NULL, LPCWSTR pwszCLRJITPath = nullptr);
void SetSvcLogger(ICorSvcLogger *pCorSvcLogger);
#ifdef FEATURE_CORECLR
@@ -175,7 +175,11 @@ void PrintUsageHelper()
W(" Debugging Parameters\n")
W(" /CreatePDB <Dir to store PDB> [/lines [<search path for managed PDB>] ]\n")
W(" When specifying /CreatePDB, the native image should be created\n")
- W(" first, and <assembly name> should be the path to the NI.")
+ W(" first, and <assembly name> should be the path to the NI.\n")
+#ifdef FEATURE_CORECLR
+ W(" /DiasymreaderPath <Path to diasymreader.dll>\n")
+ W(" - Specifies the absolute file path to diasymreader.dll to be used.\n")
+#endif // FEATURE_CORECLR
#elif defined(FEATURE_PERFMAP)
W(" Debugging Parameters\n")
W(" /CreatePerfMap <Dir to store perf map>\n")
@@ -458,6 +462,8 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
LPCWSTR pwszCLRJITPath = nullptr;
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+ LPCWSTR pwzDiasymreaderPath = nullptr;
+
HRESULT hr;
#ifndef PLATFORM_UNIX
@@ -701,6 +707,16 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
argv--;
argc++;
}
+#ifdef FEATURE_CORECLR
+ else if (MatchParameter(*argv, W("DiasymreaderPath")) && (argc > 1))
+ {
+ pwzDiasymreaderPath = argv[1];
+
+ // skip diasymreader Path
+ argv++;
+ argc--;
+ }
+#endif // FEATURE_CORECLR
#endif // NO_NGENPDB
#ifdef FEATURE_PERFMAP
else if (MatchParameter(*argv, W("CreatePerfMap")) && (argc > 1))
@@ -799,6 +815,22 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
exit(FAILURE_RESULT);
}
+#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+ if (pwszCLRJITPath != nullptr && fCreatePDB)
+ {
+ Output(W("The /JITPath switch can not be used with the /CreatePDB switch.\n"));
+ exit(FAILURE_RESULT);
+ }
+#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+
+#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+ if (pwzDiasymreaderPath != nullptr && !fCreatePDB)
+ {
+ Output(W("The /DiasymreaderPath switch can only be used with the /CreatePDB switch.\n"));
+ exit(FAILURE_RESULT);
+ }
+#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+
#if defined(FEATURE_CORECLR)
if ((pwzTrustedPlatformAssemblies != nullptr) && (pwzPlatformAssembliesPaths != nullptr))
{
@@ -931,7 +963,8 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
wzDirectoryToStorePDB,
fGeneratePDBLinesInfo,
pwzSearchPathForManagedPDB,
- pwzPlatformWinmdPaths);
+ pwzPlatformWinmdPaths,
+ pwzDiasymreaderPath);
}
else
diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp
index b381b3f074..ee38e8b5bc 100644
--- a/src/vm/compile.cpp
+++ b/src/vm/compile.cpp
@@ -2920,13 +2920,13 @@ public:
LIMITED_METHOD_CONTRACT;
}
- HRESULT Load()
+ HRESULT Load(LPCWSTR wszDiasymreaderPath = nullptr)
{
STANDARD_VM_CONTRACT;
HRESULT hr = S_OK;
- m_hModule = WszLoadLibrary(W("diasymreader.dll"));
+ m_hModule = WszLoadLibrary(wszDiasymreaderPath != nullptr ? wszDiasymreaderPath : W("diasymreader.dll"));
if (m_hModule == NULL)
{
GetSvcLogger()->Printf(
@@ -4794,7 +4794,7 @@ BOOL NGenMethodLinesPdbWriter::FinalizeLinesFileBlock(
}
#endif // NO_NGENPDB
#if defined(FEATURE_PERFMAP) || !defined(NO_NGENPDB)
-HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath)
+HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath, LPCWSTR pDiasymreaderPath)
{
STANDARD_VM_CONTRACT;
@@ -4809,7 +4809,7 @@ HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImage
pPdbPath,
pdbLines ? kPDBLines : 0,
pManagedPdbSearchPath);
- IfFailThrow(pdbWriter.Load());
+ IfFailThrow(pdbWriter.Load(pDiasymreaderPath));
#elif defined(FEATURE_PERFMAP)
NativeImagePerfMap perfMap(pAssembly, pPdbPath);
#endif
@@ -4853,7 +4853,7 @@ HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImage
return S_OK;
}
#else
-HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath)
+HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath, LPCWSTR pDiasymreaderPath)
{
return E_NOTIMPL;
}
diff --git a/src/zap/zapper.cpp b/src/zap/zapper.cpp
index 0ad910865b..bcb1b0edca 100644
--- a/src/zap/zapper.cpp
+++ b/src/zap/zapper.cpp
@@ -240,7 +240,7 @@ STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembl
return hr;
}
-STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzAppNiPaths, LPCWSTR pwzPdbPath, BOOL fGeneratePDBLinesInfo, LPCWSTR pwzManagedPdbSearchPath, LPCWSTR pwzPlatformWinmdPaths)
+STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzAppNiPaths, LPCWSTR pwzPdbPath, BOOL fGeneratePDBLinesInfo, LPCWSTR pwzManagedPdbSearchPath, LPCWSTR pwzPlatformWinmdPaths, LPCWSTR pwzDiasymreaderPath)
{
HRESULT hr = S_OK;
@@ -255,6 +255,10 @@ STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPat
zap = Zapper::NewZapper(&ngo);
+#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+ zap->SetDontLoadJit();
+#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+
if (pwzPlatformAssembliesPaths != nullptr)
zap->SetPlatformAssembliesPaths(pwzPlatformAssembliesPaths);
@@ -273,6 +277,11 @@ STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPat
if (pwzPlatformWinmdPaths != nullptr)
zap->SetPlatformWinmdPaths(pwzPlatformWinmdPaths);
+#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+ if (pwzDiasymreaderPath != nullptr)
+ zap->SetDiasymreaderPath(pwzDiasymreaderPath);
+#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+
// Avoid unnecessary security failures, since permissions are irrelevant when
// generating NGEN PDBs
zap->SetForceFullTrust(true);
@@ -676,6 +685,10 @@ void Zapper::Init(ZapperOptions *pOptions, bool fFreeZapperOptions)
_ASSERTE(SUCCEEDED(hr));
#endif
+#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+ m_fDontLoadJit = false;
+#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+
m_fForceFullTrust = false;
}
@@ -707,6 +720,11 @@ void Zapper::LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJi
extern HINSTANCE g_hThisInst;
#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+ if (m_fDontLoadJit)
+ {
+ return;
+ }
+
if (m_CLRJITPath.GetCount() > 0)
{
// If we have been asked to load a specific JIT binary, load it.
@@ -2215,7 +2233,15 @@ void Zapper::CreatePdbInCurrentDomain(BSTR pAssemblyPathOrName, BSTR pNativeImag
tkFile, &hModule));
}
- IfFailThrow(::CreatePdb(hAssembly, pNativeImagePath, pPdbPath, pdbLines, pManagedPdbSearchPath));
+ LPCWSTR pDiasymreaderPath = nullptr;
+#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+ if (m_DiasymreaderPath.GetCount() > 0)
+ {
+ pDiasymreaderPath = m_DiasymreaderPath.GetUnicode();
+ }
+#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+
+ IfFailThrow(::CreatePdb(hAssembly, pNativeImagePath, pPdbPath, pdbLines, pManagedPdbSearchPath, pDiasymreaderPath));
}
EX_CATCH
{
@@ -4037,8 +4063,20 @@ void Zapper::SetCLRJITPath(LPCWSTR pwszCLRJITPath)
{
m_CLRJITPath.Set(pwszCLRJITPath);
}
+
+void Zapper::SetDontLoadJit()
+{
+ m_fDontLoadJit = true;
+}
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+void Zapper::SetDiasymreaderPath(LPCWSTR pwzDiasymreaderPath)
+{
+ m_DiasymreaderPath.Set(pwzDiasymreaderPath);
+}
+#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+
#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
void Zapper::SetPlatformAssembliesPaths(LPCWSTR pwzPlatformAssembliesPaths)