diff options
author | Sergey Andreenko <seandree@microsoft.com> | 2021-06-03 04:04:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 04:04:39 +0300 |
commit | eb094c9bc491ce3c8e7e8b0409a2d69aa8269f06 (patch) | |
tree | 7cd1e8a8e0e89a069e097130663c09cd32b29abc /src/coreclr/ToolBox | |
parent | d11fa450decd0b8aec284a31115674942903c9eb (diff) |
Fix SuperPMI dumping for replay. (#53649)
* Fix `SetShimDebugVariables` for counter and simple.
* fix dumps for replays
Diffstat (limited to 'src/coreclr/ToolBox')
6 files changed, 38 insertions, 29 deletions
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 28c8d3f1612..52739c2f854 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -18,9 +18,6 @@ #define sparseMC // Support filling in details where guesses are okay and will still generate good code. (i.e. helper // function addresses) -bool g_debugRec = false; -bool g_debugRep = false; - // static variable initialization Hash MethodContext::m_hash; @@ -7124,3 +7121,30 @@ void MethodContext::InitReadyToRunFlag(const CORJIT_FLAGS* jitFlags) } } + + +bool g_debugRec = false; +bool g_debugRep = false; + +void SetDebugDumpVariables() +{ + static WCHAR* g_debugRecStr = nullptr; + static WCHAR* g_debugRepStr = nullptr; + if (g_debugRecStr == nullptr) + { + g_debugRecStr = GetEnvironmentVariableWithDefaultW(W("SuperPMIShimDebugRec"), W("0")); + } + if (g_debugRepStr == nullptr) + { + g_debugRepStr = GetEnvironmentVariableWithDefaultW(W("SuperPMIShimDebugRep"), W("0")); + } + + if (0 == wcscmp(g_debugRecStr, W("1"))) + { + g_debugRec = true; + } + if (0 == wcscmp(g_debugRepStr, W("1"))) + { + g_debugRep = true; + } +} diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h index 6970b163cde..97194bf0099 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -1102,4 +1102,6 @@ enum mcPackets PacketCR_CrSigInstHandleMap = 185, }; -#endif +void SetDebugDumpVariables(); + +#endif // _MethodContext diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp index 1731ecf3d4d..f1f61fcc672 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp @@ -25,8 +25,6 @@ char* g_logFilePath = nullptr; // We *don't* leak this, hooray! WCHAR* g_HomeDirectory = nullptr; WCHAR* g_DefaultRealJitPath = nullptr; MethodContext* g_globalContext = nullptr; -WCHAR* g_debugRecStr = nullptr; -WCHAR* g_debugRepStr = nullptr; bool g_initialized = false; void SetDefaultPaths() @@ -82,27 +80,6 @@ void SetLogFilePath() } } -void SetDebugVariables() -{ - if (g_debugRecStr == nullptr) - { - g_debugRecStr = GetEnvironmentVariableWithDefaultW(W("SuperPMIShimDebugRec"), W("0")); - } - if (g_debugRepStr == nullptr) - { - g_debugRepStr = GetEnvironmentVariableWithDefaultW(W("SuperPMIShimDebugRep"), W("0")); - } - - if (0 == wcscmp(g_debugRecStr, W("1"))) - { - g_debugRec = true; - } - if (0 == wcscmp(g_debugRepStr, W("1"))) - { - g_debugRep = true; - } -} - void InitializeShim() { if (g_initialized) @@ -160,7 +137,7 @@ extern "C" DLLEXPORT void __stdcall jitStartup(ICorJitHost* host) SetDefaultPaths(); SetLibName(); - SetDebugVariables(); + SetDebugDumpVariables(); if (!LoadRealJitLib(g_hRealJit, g_realJitPath)) { @@ -191,7 +168,7 @@ extern "C" DLLEXPORT ICorJitCompiler* __stdcall getJit() SetLibName(); SetLogPath(); SetLogPathName(); - SetDebugVariables(); + SetDebugDumpVariables(); if (!LoadRealJitLib(g_hRealJit, g_realJitPath)) { diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp index ba909993c68..af0ceac75d2 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp @@ -112,6 +112,7 @@ extern "C" DLLEXPORT void __stdcall jitStartup(ICorJitHost* host) { SetDefaultPaths(); SetLibName(); + SetDebugDumpVariables(); if (!LoadRealJitLib(g_hRealJit, g_realJitPath)) { @@ -149,6 +150,7 @@ extern "C" DLLEXPORT ICorJitCompiler* __stdcall getJit() SetDefaultPaths(); SetLibName(); + SetDebugDumpVariables(); if (!LoadRealJitLib(g_hRealJit, g_realJitPath)) { diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp index 1b0a6ca7581..ac720a16983 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp @@ -97,6 +97,7 @@ extern "C" DLLEXPORT void __stdcall jitStartup(ICorJitHost* host) { SetDefaultPaths(); SetLibName(); + SetDebugDumpVariables(); if (!LoadRealJitLib(g_hRealJit, g_realJitPath)) { @@ -125,6 +126,7 @@ extern "C" DLLEXPORT ICorJitCompiler* __stdcall getJit() SetDefaultPaths(); SetLibName(); + SetDebugDumpVariables(); if (!LoadRealJitLib(g_hRealJit, g_realJitPath)) { diff --git a/src/coreclr/ToolBox/superpmi/superpmi/superpmi.cpp b/src/coreclr/ToolBox/superpmi/superpmi/superpmi.cpp index c552bd91de9..31b519b6ee9 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi/superpmi.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi/superpmi.cpp @@ -230,6 +230,8 @@ int __cdecl main(int argc, char* argv[]) diffMCL.InitializeMCL(o.diffMCLFilename); } + SetDebugDumpVariables(); + // The method context reader handles skipping any unrequested method contexts // Used in conjunction with an MCI file, it does a lot less work... MethodContextReader* reader = |