Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/coreclr/inc/clrconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class CLRConfig
// The configuration should be parsed using a 10 radix as opposed to the
// default of 16.
ParseIntegerAsBase10 = 0x4,

// The configuration value is valid for the DAC.
ValidForDacBuild = 0x8,
};

// Struct used to store information about where/how to find a Config DWORD.
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ CONFIG_DWORD_INFO(INTERNAL_DbgBreakOnRawInt3, W("DbgBreakOnRawInt3"), 0, "Allows
CONFIG_DWORD_INFO(INTERNAL_DbgBreakOnSendBreakpoint, W("DbgBreakOnSendBreakpoint"), 0, "Allows an assert when sending a breakpoint to the right side")
CONFIG_DWORD_INFO(INTERNAL_DbgBreakOnSetIP, W("DbgBreakOnSetIP"), 0, "Allows an assert when setting the IP")
CONFIG_DWORD_INFO(INTERNAL_DbgCheckInt3, W("DbgCheckInt3"), 0, "Asserts if the debugger explicitly writes int3 instead of calling SetUnmanagedBreakpoint")
CONFIG_DWORD_INFO(INTERNAL_DbgDACAssertOnMismatch, W("DbgDACAssertOnMismatch"), 0, "Allows an assert when the mscordacwks and mscorwks dll versions don't match")
CONFIG_DWORD_INFO(INTERNAL_DbgDACEnableAssert, W("DbgDACEnableAssert"), 0, "Enables extra validity checking in DAC - assumes target isn't corrupt")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_DbgDACSkipVerifyDlls, W("DbgDACSkipVerifyDlls"), 0, "Allows disabling the check to ensure mscordacwks and mscorwks dll versions match")
#ifdef DACCESS_COMPILE
CONFIG_DWORD_INFO_EX(INTERNAL_DbgDACEnableAssert, W("DbgDACEnableAssert"), 0, "Enables extra validity checking in DAC - assumes target isn't corrupt", CLRConfig::LookupOptions::ValidForDacBuild)
#endif // DACCESS_COMPILE
CONFIG_DWORD_INFO(INTERNAL_DbgDelayHelper, W("DbgDelayHelper"), 0, "Varies the wait in the helper thread startup for testing race between threads")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_DbgDisableDynamicSymsCompat, W("DbgDisableDynamicSymsCompat"), 0, "")
CONFIG_DWORD_INFO(INTERNAL_DbgDisableTargetConsistencyAsserts, W("DbgDisableTargetConsistencyAsserts"), 0, "Allows explicitly testing with corrupt targets")
Expand Down Expand Up @@ -224,8 +224,8 @@ CONFIG_DWORD_INFO(INTERNAL_DbgAssertOnDebuggeeDebugBreak, W("DbgAssertOnDebuggee
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_DbgDontResumeThreadsOnUnhandledException, W("UNSUPPORTED_DbgDontResumeThreadsOnUnhandledException"), 0, "If non-zero, then don't try to unsuspend threads after continuing a 2nd-chance native exception")
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_DbgSkipStackCheck, W("DbgSkipStackCheck"), 0, "Skip the stack pointer check during stackwalking")
#ifdef DACCESS_COMPILE
CONFIG_DWORD_INFO(INTERNAL_DumpGeneration_IntentionallyCorruptDataFromTarget, W("IntentionallyCorruptDataFromTarget"), 0, "Intentionally fakes bad data retrieved from target to try and break dump generation.")
#endif
CONFIG_DWORD_INFO_EX(INTERNAL_DumpGeneration_IntentionallyCorruptDataFromTarget, W("IntentionallyCorruptDataFromTarget"), 0, "Intentionally fakes bad data retrieved from target to try and break dump generation.", CLRConfig::LookupOptions::ValidForDacBuild)
#endif // DACCESS_COMPILE
// Note that Debugging_RequiredVersion is sometimes an 'INTERNAL' knob and sometimes an 'UNSUPPORTED' knob, but we don't change it's name.
CONFIG_DWORD_INFO(UNSUPPORTED_Debugging_RequiredVersion, W("UNSUPPORTED_Debugging_RequiredVersion"), 0, "The lowest ICorDebug version we should attempt to emulate, or 0 for default policy. Use 2 for CLRv2, 4 for CLRv4, etc.")

Expand Down
63 changes: 11 additions & 52 deletions src/coreclr/inc/utilcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -2941,18 +2941,14 @@ class MethodNamesList : public MethodNamesListBase
/* simple wrappers around the CLRConfig and MethodNameList routines that make
the lookup lazy */

/* to be used as static variable - no constructor/destructor, assumes zero
initialized memory */

class ConfigDWORD
class ConfigDWORD final
{
public:
inline DWORD val(const CLRConfig::ConfigDWORDInfo & info)
ConfigDWORD() : m_value{ 0 }, m_inited{ false } { WRAPPER_NO_CONTRACT; }

DWORD val(const CLRConfig::ConfigDWORDInfo & info)
{
WRAPPER_NO_CONTRACT;
// make sure that the memory was zero initialized
_ASSERTE(m_inited == 0 || m_inited == 1);

if (!m_inited) init(info);
return m_value;
}
Expand All @@ -2962,71 +2958,34 @@ class ConfigDWORD

private:
DWORD m_value;
BYTE m_inited;
bool m_inited;
};

/**************************************************************************/
class ConfigString
class ConfigString final
{
public:
inline LPWSTR val(const CLRConfig::ConfigStringInfo & info)
ConfigString() : m_value{ NULL }, m_inited{ false } { WRAPPER_NO_CONTRACT; }

LPWSTR val(const CLRConfig::ConfigStringInfo & info)
{
WRAPPER_NO_CONTRACT;
// make sure that the memory was zero initialized
_ASSERTE(m_inited == 0 || m_inited == 1);

if (!m_inited) init(info);
return m_value;
}

bool isInitialized()
{
WRAPPER_NO_CONTRACT;

// make sure that the memory was zero initialized
_ASSERTE(m_inited == 0 || m_inited == 1);

return m_inited == 1;
return m_inited;
}

private:
void init(const CLRConfig::ConfigStringInfo & info);

private:
LPWSTR m_value;
BYTE m_inited;
};

/**************************************************************************/
class ConfigMethodSet
{
public:
bool isEmpty()
{
WRAPPER_NO_CONTRACT;
_ASSERTE(m_inited == 1);
return m_list.IsEmpty();
}

bool contains(LPCUTF8 methodName, LPCUTF8 className, int argCount = -1);
bool contains(LPCUTF8 methodName, LPCUTF8 className, CORINFO_SIG_INFO* pSigInfo);

inline void ensureInit(const CLRConfig::ConfigStringInfo & info)
{
WRAPPER_NO_CONTRACT;
// make sure that the memory was zero initialized
_ASSERTE(m_inited == 0 || m_inited == 1);

if (!m_inited) init(info);
}

private:
void init(const CLRConfig::ConfigStringInfo & info);

private:
MethodNamesListBase m_list;

BYTE m_inited;
bool m_inited;
};

//*****************************************************************************
Expand Down
17 changes: 16 additions & 1 deletion src/coreclr/utilcode/clrconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,14 @@ namespace
}
CONTRACTL_END;

SUPPORTS_DAC_HOST_ONLY;
#ifdef DACCESS_COMPILE
if (!CheckLookupOption(options, LookupOptions::ValidForDacBuild))
{
LOG((LF_CORDB, LL_ALWAYS, "ConfigDWORD, '%s', is not valid for DAC. Mark it with LookupOptions::ValidForDacBuild to enable.\n", name));
*result = defValue;
return S_OK;
}
#endif // DACCESS_COMPILE

FAULT_NOT_FATAL(); // We don't report OOM errors here, we return a default value.

Expand Down Expand Up @@ -278,6 +285,14 @@ namespace
}
CONTRACTL_END;

#ifdef DACCESS_COMPILE
if (!CheckLookupOption(options, LookupOptions::ValidForDacBuild))
{
LOG((LF_CORDB, LL_ALWAYS, "ConfigString, '%s', is not valid for DAC. Mark it with LookupOptions::ValidForDacBuild to enable.\n", name));
return NULL;
}
#endif // DACCESS_COMPILE

NewArrayHolder<WCHAR> ret(NULL);

FAULT_NOT_FATAL(); // We don't report OOM errors here, we return a default value.
Expand Down
70 changes: 0 additions & 70 deletions src/coreclr/utilcode/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,76 +1144,6 @@ uint32_t GetOsPageSize()

/**************************************************************************/

/**************************************************************************/
void ConfigMethodSet::init(const CLRConfig::ConfigStringInfo & info)
{
CONTRACTL
{
THROWS;
}
CONTRACTL_END;

// make sure that the memory was zero initialized
_ASSERTE(m_inited == 0 || m_inited == 1);

LPWSTR str = CLRConfig::GetConfigValue(info);
if (str)
{
m_list.Insert(str);
delete[] str;
}
m_inited = 1;
}

/**************************************************************************/
bool ConfigMethodSet::contains(LPCUTF8 methodName, LPCUTF8 className, int argCount)
{
CONTRACTL
{
NOTHROW;
}
CONTRACTL_END;

_ASSERTE(m_inited == 1);

if (m_list.IsEmpty())
return false;
return(m_list.IsInList(methodName, className, argCount));
}

/**************************************************************************/
bool ConfigMethodSet::contains(LPCUTF8 methodName, LPCUTF8 className, CORINFO_SIG_INFO* pSigInfo)
{
CONTRACTL
{
NOTHROW;
}
CONTRACTL_END;

_ASSERTE(m_inited == 1);

if (m_list.IsEmpty())
return false;
return(m_list.IsInList(methodName, className, pSigInfo));
}

/**************************************************************************/
void ConfigString::init(const CLRConfig::ConfigStringInfo & info)
{
CONTRACTL
{
NOTHROW;
}
CONTRACTL_END;

// make sure that the memory was zero initialized
_ASSERTE(m_inited == 0 || m_inited == 1);

// Note: m_value will be leaking
m_value = CLRConfig::GetConfigValue(info);
m_inited = 1;
}

//=============================================================================
// AssemblyNamesList
//=============================================================================
Expand Down
17 changes: 14 additions & 3 deletions src/coreclr/utilcode/util_nodependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,11 +650,22 @@ void ConfigDWORD::init(const CLRConfig::ConfigDWORDInfo & info)
}
CONTRACTL_END;

// make sure that the memory was zero initialized
_ASSERTE(m_inited == 0 || m_inited == 1);
m_value = CLRConfig::GetConfigValue(info);
m_inited = true;
}

/**************************************************************************/
void ConfigString::init(const CLRConfig::ConfigStringInfo & info)
{
CONTRACTL
{
NOTHROW;
}
CONTRACTL_END;

// Note: m_value will be leaking
m_value = CLRConfig::GetConfigValue(info);
m_inited = 1;
m_inited = true;
}

//---------------------------------------------------------------------------------------
Expand Down
Loading