Rename COMPlus_ to DOTNET_ (#3712)
authorAdeel Mujahid <3840695+am11@users.noreply.github.com>
Mon, 6 Mar 2023 22:23:10 +0000 (00:23 +0200)
committerGitHub <noreply@github.com>
Mon, 6 Mar 2023 22:23:10 +0000 (14:23 -0800)
* Rename COMPlus_ to DOTNET_

* Add WithRuntimeConfiguration

* Add a comment

* Update documentation/FAQ.md

13 files changed:
documentation/FAQ.md
documentation/tutorial/app_running_slow_highcpu.md
src/Microsoft.Diagnostics.TestHelpers/ProcessRunner.cs
src/SOS/SOS.UnitTests/SOS.cs
src/SOS/SOS.UnitTests/SOSRunner.cs
src/SOS/Strike/sosdocs.txt
src/SOS/Strike/sosdocsunix.txt
src/SOS/lldbplugin.tests/testsos.sh
src/Tools/dotnet-dsrouter/DiagnosticsServerRouterCommands.cs
src/shared/inc/switches.h
src/shared/pal/src/include/pal/dbgmsg.h
src/shared/pal/src/map/virtual.cpp
src/tests/EventPipeStress/Orchestrator/Program.cs

index 589dc107ae7bf007836199fe8ad88f3e01cabe84..499e34a30e290b260e8ae3fabcc89aadc50ae466 100644 (file)
@@ -31,7 +31,7 @@ Frequently Asked Questions
 
     If that doesn't work, try using the `setclrpath <directory>` command with a directory that contains the matching version of the DAC module. This is useful for private runtimes or debug builds that haven't been published to our symbol servers.
 
-    If this is a dump, the problem could also be that the dump is missing some memory required by SOS. Try generating a "full" dump (the default with `dotnet-dump collect` without a `--type` option) or add setting the crash dump generation (createdump) environment variable `COMPlus_DbgMiniDumpType=4`. For more details on crash dump generation see [here](https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dumps#collecting-dumps-on-crash).
+    If this is a dump, the problem could also be that the dump is missing some memory required by SOS. Try generating a "full" dump (the default with `dotnet-dump collect` without a `--type` option) or add setting the crash dump generation (createdump) environment variable `DOTNET_DbgMiniDumpType=4` (.NET 6 and below require `COMPlus_` prefix instead of `DOTNET_`). For more details on crash dump generation see [here](https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dumps#collecting-dumps-on-crash).
 
 * If you receive this error message executing a SOS command:
     ```
index 482b00de0d88fbded2c30547e6004f2abb4409f5..aa56ea3558087d83514a0dc98350df3988a62e4d 100644 (file)
@@ -64,7 +64,7 @@ Reproduce the problem and when done, hit CTRL-C to exit the perfcollect tool. Yo
 If you  are more familiar with existing performance tools on Linux, .net core is also instrumented to allow you to make use of those tools. Here, we will illustrate how you can use the 'perf' tool to generate traces that can be used on Linux to diagnose performance problems. Exit the previous instance of the webapi and set the following in the terminal:
 
 > ```bash
-> export COMPlus_PerfMapEnabled=1
+> export DOTNET_PerfMapEnabled=1
 > ```
 
 Next, re-launch the webapi. This step is required to get more legible frames in the traces. 
index 9bee89c895fb533015f097833cd44d3088bdf991..5113f4cff3e0362aec2f9d2655ec211a58d7b1af 100644 (file)
@@ -124,6 +124,11 @@ namespace Microsoft.Diagnostics.TestHelpers
             return this;
         }
 
+        // Remove COMPlus_ fallback once minimum supported runtime is .NET 8
+        public ProcessRunner WithRuntimeConfiguration(string key, string value) =>
+            WithEnvironmentVariable($"DOTNET_{key}", value)
+            .WithEnvironmentVariable($"COMPlus_{key}", value);
+
         public ProcessRunner WithEnvironmentVariable(string key, string value)
         {
             lock (_lock)
index a0ec5a83aa3880fb0dd14961464f7364c9c027ec..f800eecac166983f8c53843a7bc603f2a634273e 100644 (file)
@@ -445,10 +445,10 @@ public class SOS
                 WithExpectedExitCode(0).
                 WithWorkingDirectory(scriptDir).
                 // Turn on stress logging so the dumplog and histinit commands pass
-                WithEnvironmentVariable("COMPlus_LogFacility", "0xffffffbf").
-                WithEnvironmentVariable("COMPlus_LogLevel", "6").
-                WithEnvironmentVariable("COMPlus_StressLog", "1").
-                WithEnvironmentVariable("COMPlus_StressLogSize", "65536");
+                WithEnvironmentVariable("DOTNET_LogFacility", "0xffffffbf").
+                WithEnvironmentVariable("DOTNET_LogLevel", "6").
+                WithEnvironmentVariable("DOTNET_StressLog", "1").
+                WithEnvironmentVariable("DOTNET_StressLogSize", "65536");
 
             // Start the process runner
             processRunner.Start();
index 64638124687fbfe85364f171142f715ddf5af946..025eeada339ee886dbc45c39c5b9ae1eb121d645 100644 (file)
@@ -318,7 +318,7 @@ public class SOSRunner : IDisposable
                 ProcessRunner processRunner = new ProcessRunner(exePath, ReplaceVariables(variables, arguments.ToString())).
                     WithEnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0").
                     WithEnvironmentVariable("DOTNET_ROOT", config.DotNetRoot).
-                    WithEnvironmentVariable("COMPlus_DbgEnableElfDumpOnMacOS", "1").
+                    WithRuntimeConfiguration("DbgEnableElfDumpOnMacOS", "1").
                     WithLog(new TestRunner.TestLogger(outputHelper.IndentedOutput)).
                     WithTimeout(TimeSpan.FromMinutes(10));
 
@@ -326,16 +326,16 @@ public class SOSRunner : IDisposable
                 {
                     // Run the debuggee with the createdump environment variables set to generate a coredump on unhandled exception
                     processRunner.
-                        WithEnvironmentVariable("COMPlus_DbgEnableMiniDump", "1").
-                        WithEnvironmentVariable("COMPlus_DbgMiniDumpName", dumpName);
+                        WithRuntimeConfiguration("DbgEnableMiniDump", "1").
+                        WithRuntimeConfiguration("DbgMiniDumpName", dumpName);
 
                     if (information.DumpDiagnostics)
                     {
-                        processRunner.WithEnvironmentVariable("COMPlus_CreateDumpDiagnostics", "1");
+                        processRunner.WithRuntimeConfiguration("CreateDumpDiagnostics", "1");
                     }
                     if (information.TestCrashReport)
                     {
-                        processRunner.WithEnvironmentVariable("COMPlus_EnableCrashReport", "1");
+                        processRunner.WithRuntimeConfiguration("EnableCrashReport", "1");
                     }
                     // Windows createdump's triage MiniDumpWriteDump flags for .NET 5.0 are broken
                     // Disable testing triage dumps on 6.0 until the DAC signing issue is resolved - issue https://github.com/dotnet/diagnostics/issues/2542
@@ -348,13 +348,13 @@ public class SOSRunner : IDisposable
                     switch (dumpType)
                     {
                         case DumpType.Heap:
-                            processRunner.WithEnvironmentVariable("COMPlus_DbgMiniDumpType", "2");
+                            processRunner.WithRuntimeConfiguration("DbgMiniDumpType", "2");
                             break;
                         case DumpType.Triage:
-                            processRunner.WithEnvironmentVariable("COMPlus_DbgMiniDumpType", "3");
+                            processRunner.WithRuntimeConfiguration("DbgMiniDumpType", "3");
                             break;
                         case DumpType.Full:
-                            processRunner.WithEnvironmentVariable("COMPlus_DbgMiniDumpType", "4");
+                            processRunner.WithRuntimeConfiguration("DbgMiniDumpType", "4");
                             break;
                     }
                 }
@@ -684,7 +684,7 @@ public class SOSRunner : IDisposable
 
             // Disable W^E so that the bpmd command and the tests pass
             // Issue: https://github.com/dotnet/diagnostics/issues/3126
-            processRunner.WithEnvironmentVariable("COMPlus_EnableWriteXorExecute", "0");
+            processRunner.WithRuntimeConfiguration("EnableWriteXorExecute", "0");
 
             DumpType? dumpType = null;
             if (action == DebuggerAction.LoadDump || action == DebuggerAction.LoadDumpWithDotNetDump)
index ceb9967f950bc2273ba0bc2d84e3417acc596263..fa470d2eabfdfbe59cf7f231f660ff1a25733d41 100644 (file)
@@ -2171,16 +2171,16 @@ default one.
 To turn on the stress log, set the following environment variables before
 starting the .NET Core app:
 
-set COMPlus_StressLog = 1
-set COMPlus_LogFacility = 0xffffffbf (this is a bit mask, almost all logging is on.
-                                      This is also the default value if the key 
-                                      isn't specified)
-set COMPlus_StressLogSize = 65536 (this is the default value if the key isn't
-                                   specified)
-set COMPlus_LogLevel = 6          (this is the default value if the key isn't
-                                   specified.  The higher the number the more
-                                   detailed logs are generated.  The maximum 
-                                   value is decimal 10)
+set DOTNET_StressLog = 1
+set DOTNET_LogFacility = 0xffffffbf (This is a bit mask, almost all logging is on.
+                                     This is also the default value if the key
+                                     isn't specified)
+set DOTNET_StressLogSize = 65536 (This is the default value if the key isn't
+                                  specified)
+set DOTNET_LogLevel = 6 (This is the default value if the key isn't
+                         specified. The higher the number the more
+                         detailed logs are generated. The maximum
+                         value is decimal 10)
 
 StressLogSize is the size in bytes of the in-memory log allocated for each 
 thread in the process. In the case above, each thread gets a 64K log. You 
index 0a4b955bc68124533657c94e2ddce30f4321e0f6..3310726ca9b29b3a7ea4ebe888d0f7b3b9c52af7 100644 (file)
@@ -1934,16 +1934,16 @@ default one.
 To turn on the stress log, set the following environment variables before
 starting the .NET Core app:
 
-export COMPlus_StressLog = 1
-export COMPlus_LogFacility = 0xffffffbf (this is a bit mask, almost all logging is on.
-                                         This is also the default value if the key 
-                                         isn't specified)
-export COMPlus_StressLogSize = 65536 (this is the default value if the key isn't
-                                      specified)
-export COMPlus_LogLevel = 6          (this is the default value if the key isn't
-                                      specified.  The higher the number the more
-                                      detailed logs are generated.  The maximum 
-                                      value is decimal 10)
+export DOTNET_StressLog = 1
+export DOTNET_LogFacility = 0xffffffbf (This is a bit mask, almost all logging is on.
+                                        This is also the default value if the key
+                                        isn't specified)
+export DOTNET_StressLogSize = 65536 (This is the default value if the key isn't
+                                     specified)
+export DOTNET_LogLevel = 6 (This is the default value if the key isn't
+                            specified. The higher the number the more
+                            detailed logs are generated. The maximum
+                            value is decimal 10)
 
 StressLogSize is the size in bytes of the in-memory log allocated for each 
 thread in the process. In the case above, each thread gets a 64K log. You 
index 9aa83c1c70d2d3b0821c9a5241a75c96b82469b2..38fd76b690afff0742693ffc19bb15579a47a3c6 100755 (executable)
@@ -13,10 +13,10 @@ fi
 host="$project_root/.dotnet/dotnet --fx-version $host_version"
 
 # Turn on stress logging so the dumplog and histinit commands pass
-export COMPlus_LogFacility=0xffffffbf
-export COMPlus_LogLevel=6
-export COMPlus_StressLog=1
-export COMPlus_StressLogSize=65536
+export DOTNET_LogFacility=0xffffffbf
+export DOTNET_LogLevel=6
+export DOTNET_StressLog=1
+export DOTNET_StressLogSize=65536
 
 if [[ ! -x "$LLDB_PATH" ]]; then
     echo "LLDB_PATH doesn't exist or not executable"
@@ -29,4 +29,3 @@ mkdir -p $log_dir
 cd $project_root/src/SOS/lldbplugin.tests/
 rm -f StressLog.txt
 python $project_root/src/SOS/lldbplugin.tests/test_libsosplugin.py --lldb $LLDB_PATH --host "$host" --plugin $plugin --logfiledir $log_dir --assembly $test_program
-
index e723464c05d7a40b687b340bdb3cca0d983203ae..0bb3ba056fdfa0922cdd50d5f84a02a46d439045 100644 (file)
@@ -337,7 +337,7 @@ namespace Microsoft.Diagnostics.Tools.DiagnosticsServerRouter
                 var path = Path.Combine(PidIpcEndpoint.IpcRootPath, $"dotnet-diagnostic-{processId}");
                 if (File.Exists(path))
                 {
-                    logger?.LogWarning($"Default IPC server path, {path}, already in use. To disable default diagnostics for dotnet-dsrouter, set COMPlus_EnableDiagnostics=0 and re-run.");
+                    logger?.LogWarning($"Default IPC server path, {path}, already in use. To disable default diagnostics for dotnet-dsrouter, set DOTNET_EnableDiagnostics=0 and re-run.");
 
                     path = Path.Combine(PidIpcEndpoint.IpcRootPath, $"dotnet-dsrouter-{processId}");
                     logger?.LogWarning($"Fallback using none default IPC server path, {path}.");
@@ -358,7 +358,7 @@ namespace Microsoft.Diagnostics.Tools.DiagnosticsServerRouter
                 var path = Path.Combine(PidIpcEndpoint.IpcRootPath, $"dotnet-diagnostic-{processId}-{(long)diff.TotalSeconds}-socket");
                 if (Directory.GetFiles(PidIpcEndpoint.IpcRootPath, $"dotnet-diagnostic-{processId}-*-socket").Length != 0)
                 {
-                    logger?.LogWarning($"Default IPC server path, {Path.Combine(PidIpcEndpoint.IpcRootPath, $"dotnet-diagnostic-{processId}-*-socket")}, already in use. To disable default diagnostics for dotnet-dsrouter, set COMPlus_EnableDiagnostics=0 and re-run.");
+                    logger?.LogWarning($"Default IPC server path, {Path.Combine(PidIpcEndpoint.IpcRootPath, $"dotnet-diagnostic-{processId}-*-socket")}, already in use. To disable default diagnostics for dotnet-dsrouter, set DOTNET_EnableDiagnostics=0 and re-run.");
 
                     path = Path.Combine(PidIpcEndpoint.IpcRootPath, $"dotnet-dsrouter-{processId}-{(long)diff.TotalSeconds}-socket");
                     logger?.LogWarning($"Fallback using none default IPC server path, {path}.");
index 063ffe2470c4e949188cd15393efd0f4f3f59dec..072d37d69b831d9704f42540f82c3d06747ee73b 100644 (file)
@@ -51,8 +51,8 @@
 #define JIT_IS_ALIGNED
 #endif
 
-// ALLOW_SXS_JIT enables AltJit support for JIT-ing, via COMPlus_AltJit / COMPlus_AltJitName.
-// ALLOW_SXS_JIT_NGEN enables AltJit support for NGEN, via COMPlus_AltJitNgen / COMPlus_AltJitName.
+// ALLOW_SXS_JIT enables AltJit support for JIT-ing, via DOTNET_AltJit / DOTNET_AltJitName.
+// ALLOW_SXS_JIT_NGEN enables AltJit support for NGEN, via DOTNET_AltJitNgen / DOTNET_AltJitName.
 // Note that if ALLOW_SXS_JIT_NGEN is defined, then ALLOW_SXS_JIT must be defined.
 #define ALLOW_SXS_JIT
 #define ALLOW_SXS_JIT_NGEN
 #define FEATURE_JIT_TIMER
 
 // This feature in RyuJIT supersedes the FEATURE_JIT_TIMER. In addition to supporting the time log file, this
-// feature also supports using COMPlus_JitTimeLogCsv=a.csv, which will dump method-level and phase-level timing
+// feature also supports using DOTNET_JitTimeLogCsv=a.csv, which will dump method-level and phase-level timing
 // statistics. Also see comments on FEATURE_JIT_TIMER.
 #define FEATURE_JIT_METHOD_PERF
 
 #endif
 
 // Enables a mode in which GC is completely conservative in stacks and registers: all stack slots and registers
-// are treated as potential pinned interior pointers. When enabled, the runtime flag COMPLUS_GCCONSERVATIVE
+// are treated as potential pinned interior pointers. When enabled, the runtime flag DOTNET_GCCONSERVATIVE
 // determines dynamically whether GC is conservative. Note that appdomain unload, LCG and unloadable assemblies
 // do not work reliably with conservative GC.
 #define FEATURE_CONSERVATIVE_GC 1
index 712d99e4b3751e69a4aba72dccadcb7628f9c876..e5694a7f59b64fc0cee5deb875fa2e82450dcdb3 100644 (file)
@@ -500,7 +500,7 @@ Function :
     PAL_DisplayDialog
 
     Display a simple modal dialog with an alert icon and a single OK button. Caller supplies the title of the
-    dialog and the main text. The dialog is displayed only if the COMPlus_EnableAssertDialog environment
+    dialog and the main text. The dialog is displayed only if the DOTNET_EnableAssertDialog environment
     variable is set to the value "1".
 
 --*/
index 43b18324bc170dc7d0f4732371d2a520c45522d5..b030f640d082ec4cc27e1c29a8f53d50f4b0bbd1 100644 (file)
@@ -2154,7 +2154,7 @@ void ExecutableMemoryAllocator::TryReserveInitialMemory()
         //     table. This satisfies the vast majority of practical cases where the total amount of loaded native image memory
         //     does not exceed approximately 2 GB.
         //   - The code heap allocator for the JIT can allocate from this address space. Beyond this reservation, one can use
-        //     the COMPlus_CodeHeapReserveForJumpStubs environment variable to reserve space for jump stubs.
+        //     the DOTNET_CodeHeapReserveForJumpStubs environment variable to reserve space for jump stubs.
         sizeOfAllocation = MaxExecutableMemorySize;
         m_startAddress = ReserveVirtualMemory(pthrCurrent, nullptr, sizeOfAllocation, MEM_RESERVE_EXECUTABLE);
         if (m_startAddress == nullptr)
index c8da1b00e6ccc0b652dc05caa262f4e6e5eaae32..50c20606f0a68dee04d0e8458f5c2f7abdcdf83f 100644 (file)
@@ -252,10 +252,10 @@ namespace Orchestrator
                 eventWritingProc.StartInfo.Arguments = $"--threads {(threads == -1 ? cores.ToString() : threads.ToString())} --event-count {eventCount} --event-size {eventSize} --event-rate {eventRate} --burst-pattern {burstPattern} --duration {(int)durationTimeSpan.TotalSeconds}";
                 eventWritingProc.StartInfo.UseShellExecute = false;
                 eventWritingProc.StartInfo.RedirectStandardInput = true;
-                eventWritingProc.StartInfo.Environment["COMPlus_StressLog"] = "1";
-                eventWritingProc.StartInfo.Environment["COMPlus_LogFacility"] = "2000";
-                eventWritingProc.StartInfo.Environment["COMPlus_LogLevel"] = "8";
-                eventWritingProc.StartInfo.Environment["COMPlus_StressLogSize"] = "0x1000000";
+                eventWritingProc.StartInfo.Environment["DOTNET_StressLog"] = "1";
+                eventWritingProc.StartInfo.Environment["DOTNET_LogFacility"] = "2000";
+                eventWritingProc.StartInfo.Environment["DOTNET_LogLevel"] = "8";
+                eventWritingProc.StartInfo.Environment["DOTNET_StressLogSize"] = "0x1000000";
                 eventWritingProc.Start();
 
                 Console.WriteLine($"Executing: {eventWritingProc.StartInfo.FileName} {eventWritingProc.StartInfo.Arguments}");