LoadSymbolsForModuleDelegate SymbolReader::loadSymbolsForModuleDelegate;
GetLocalVariableName SymbolReader::getLocalVariableNameDelegate;
GetLineByILOffsetDelegate SymbolReader::getLineByILOffsetDelegate;
+
#endif // !FEATURE_PAL
const char * const CorElementTypeName[ELEMENT_TYPE_MAX]=
}
return true;
}
-HRESULT SymbolReader::LoadCoreCLR()
+
+HRESULT SymbolReader::PrepareSymbolReader()
{
- HRESULT Status = S_OK;
+ static bool attemptedSymbolReaderPreparation = false;
+ if (attemptedSymbolReaderPreparation)
+ {
+ // If we already tried to set up the symbol reader, we won't try again.
+ return E_FAIL;
+ }
+
+ attemptedSymbolReaderPreparation = true;
std::string absolutePath;
std::string coreClrPath = g_ExtServices->GetCoreClrDirectory();
ExtErr("Error: fail to convert CLR files path to absolute path \n");
return E_FAIL;
}
+
coreClrPath.append("/");
coreClrPath.append(coreClrDll);
ExtErr("Error: Fail to load %s\n", coreClrPath.c_str());
return E_FAIL;
}
+
void *hostHandle;
unsigned int domainId;
coreclr_initialize_ptr initializeCoreCLR =
(coreclr_initialize_ptr)dlsym(coreclrLib, "coreclr_initialize");
- // FiXME: We should shutdown coreclr when it is not needed
+ // FixME: We should shutdown coreclr when it is not needed
coreclr_shutdown_ptr shutdownCoreCLR =
(coreclr_shutdown_ptr)dlsym(coreclrLib, "coreclr_shutdown");
std::string tpaList;
return E_FAIL;
}
- Status =
+ HRESULT Status =
initializeCoreCLR(entryPointExecutablePath.c_str(), "soscorerun",
sizeof(propertyKeys) / sizeof(propertyKeys[0]),
propertyKeys, propertyValues, &hostHandle, &domainId);
}
coreclr_create_delegate_ptr CreateDelegate =
- (coreclr_create_delegate_ptr)dlsym(coreclrLib,
- "coreclr_create_delegate");
+ (coreclr_create_delegate_ptr)dlsym(coreclrLib, "coreclr_create_delegate");
+
IfFailRet(CreateDelegate(hostHandle, domainId, SymbolReaderDllName,
SymbolReaderClassName, "ResolveSequencePoint",
(void **)&resolveSequencePointDelegate));
(void **)&getLineByILOffsetDelegate));
return Status;
}
- HRESULT SymbolReader::GetLineByILOffset(__in_z const char* szModuleName, mdMethodDef MethodToken,
+
+HRESULT SymbolReader::GetLineByILOffset(__in_z const char* szModuleName, mdMethodDef MethodToken,
ULONG64 IlOffset, ___out ULONG *pLinenum,
__out_ecount(cbFileName) LPSTR lpszFileName,
___in ULONG cbFileName)
if (getLineByILOffsetDelegate == nullptr)
{
- Status = SymbolReader::LoadCoreCLR();
+ Status = SymbolReader::PrepareSymbolReader();
}
if (Status != S_OK)
{
#else
if (loadSymbolsForModuleDelegate == nullptr)
{
- Status = LoadCoreCLR();
+ Status = PrepareSymbolReader();
}
if (Status != S_OK)
{
#ifdef FEATURE_PAL
if (getLocalVariableNameDelegate == nullptr)
{
- Status = LoadCoreCLR();
+ Status = PrepareSymbolReader();
}
if (Status != S_OK)
{
#else
if (loadSymbolsForModuleDelegate == nullptr)
{
- Status = LoadCoreCLR();
+ Status = PrepareSymbolReader();
}
if (Status != S_OK)
{