-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add environment variable (COMPlus_EnableDiagnostics) to disable debugging and profiling #15878
Conversation
These functions get the data from the VM (the actual information is managed by code manager), re-encoded it a little bit and pass it along. They should not depend on anything from the debugger stack. It should not be hard to factor them out.
What are these obscure cases? It sounds like a left over from Silverlight that can deleted. (Unless we want to make the |
Noah and I looked at factoring the IL mapping code and it would take me a week or so and risk stability and maybe even perf of the lookup. This approach is simpler and the transport resources like the named pipes/semaphores and the debugger threads are not created but the IL mapping code is available without any changes.
The obscure case (I probably shouldn’t have said cases) is when Watson isn’t enabled (IsWatsonEnabled()) and the Telesto debug package isn’t installed (IsTelestoDebugPackInstalled()).
|
I think it would be the opposite. To get the IL->native mapping e.g. to print a stacktrace, we need to create |
Our concern was in the case where you repeatedly get the same stack similar to this: |
// RegCloseKey called by holder | ||
return debugPackInstalled; | ||
} | ||
|
||
#define StartupNotifyEventNamePrefix W("TelestoStartupEvent_") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is odd that this event has Telesto in the name. Does the VS debugger still depend on this event? If yes, comment maybe useful. If not, delete it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it is still used by dbgshim.dll which VS in turn uses.
https://github.com/dotnet/coreclr/blob/master/src/dlls/dbgshim/dbgshim.cpp#L724
src/inc/clrconfigvalues.h
Outdated
@@ -190,7 +190,8 @@ CONFIG_DWORD_INFO_EX(INTERNAL_D__FCE, W("D::FCE"), 0, "allows an assert when cra | |||
// | |||
// Debugger | |||
// | |||
CONFIG_DWORD_INFO_EX(INTERNAL_DbgBreakIfLocksUnavailable, W("DbgBreakIfLocksUnavailable"), 0, "allows an assert when the debugger can't take a lock ", CLRConfig::REGUTIL_default) | |||
RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_EnableDiagnostics, W("EnableDiagnostics"), 1, "allows the debugger and profiler diagnostics to be disabled", CLRConfig::REGUTIL_default) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the naming guidelines this should be EXTERNAL_EnableDiagnostics
src/vm/dwbucketmanager.hpp
Outdated
} | ||
|
||
if (m_pFaultingMD) | ||
if (g_pDebugInterface != NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment that you aren't aware of any current scenario where g_pDebugInterface is NULL, but that we might do so in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think there should be an assert that g_pDebugInterface != NULL, or simply revert the code. As-is this feels like a partial implementation. Anyone who enables g_pDebugInterface = NULL in the future needs to explicitly reconsider this code. Without more changes all the IL mappings will have been needlessly lost and that probably isn't what the future implementer will want to occur.
src/vm/eventtrace.cpp
Outdated
@@ -5247,13 +5247,12 @@ VOID ETW::MethodLog::MethodJitted(MethodDesc *pMethodDesc, SString *namespaceOrC | |||
{ | |||
// The call to SendMethodILToNativeMapEvent assumes that the debugger's lazy | |||
// data has already been initialized. | |||
if (g_pDebugInterface != NULL) | |||
{ | |||
g_pDebugInterface->InitializeLazyDataIfNecessary(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, a future implementor should be forced to explicitly consider what happens if they set g_pDebugInterface = NULL. Losing the ILToNative events implicitly seems bad.
src/vm/eventtrace.cpp
Outdated
@@ -6680,16 +6679,15 @@ VOID ETW::MethodLog::SendMethodILToNativeMapEvent(MethodDesc * pMethodDesc, DWOR | |||
// of 64K | |||
const USHORT kMapEntriesMax = 7000; | |||
|
|||
if (g_pDebugInterface == NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(same thing as above, this deserves an assert or a revert to prevent accidental loss of functionality. I'll stop calling it out)
src/debug/ee/debugger.cpp
Outdated
if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_EnableDiagnostics) == 0) | ||
{ | ||
return S_OK; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the jit attach cases already plumbed up to handle a missing transport? I didn't notice any changes in those code paths.
Looks like I forgot about that case. Working on the change.
|
…ging and profiling. To disable the named pipes and semaphores created on linux execute "export COMPlus_EnableDiagnostics=0" before start the .NET Core program. On Windows execute "set COMPlus_EnableDiagnostics=0" and on Linux execute "export "COMPlus_EnableDiagnostics=0" Removed the "Telesto" registry entry (old unnecessary Silverlight code) and Watson (always true) checks. For issues #11769 and #8844.
…le debugging and profiling. (dotnet#15878)" This reverts commit 5bcfde4.
To disable the named pipes and semaphores created on linux execute "export COMPlus_EnableDiagnostics=0" before start the .NET Core program.
On Windows execute "set COMPlus_EnableDiagnostics=0". On Linux/OS X "export COMPlus_EnableDiagnostics=0".
The approach is to still create the DebugInterface so g_pDebugInterface != NULL but the debugger transport (g_pDbgTransport == NULL) and RC thread (m_pRCThread == NULL) are not created. This approach was used instead of not creating the DebugInterface because some of the function is used to get line number/source file info for stack traces when not debugging.
There are also some changes where g_pDebugInterface wasn't being checked for NULL that are included in the PR left over from a initial implementation. I included them to be complete because there are still some obscure cases that g_pDebugInterface == NULL like when the "debug package" isn't installed on Windows.
For issues #11769 and #8844.