[Tizen] Add dotnet-stack tool
authorj-h.choi <j-h.choi@samsung.com>
Mon, 25 Jan 2021 04:28:22 +0000 (13:28 +0900)
committerolekarev <o.lekarev@samsung.com>
Fri, 11 Feb 2022 15:07:27 +0000 (18:07 +0300)
documentation/design-docs/dotnet-tools.md
packaging/coreclr-diagnostics.spec
src/Tools/dotnet-stack/ReportCommand.cs

index aea2c5efe4715588205493abc32088584c4a5cdb..bb7487c627060153248604fd1d7bad23b26f8d7a 100644 (file)
@@ -419,7 +419,6 @@ COMMANDS
 REPORT
 
     dotnet-stack report -p|--process-id <pid>
-                        -n|--name <process-name>
                         [-h|--help]
 
     Prints the managed stack from every thread in the target process
index 2e8849ad8efcbf9dd4469b912b8cd8bff1f475f7..1bb9221ae42b91a5a749efdd1b06a639f0764188 100755 (executable)
@@ -190,7 +190,7 @@ cp -f %{_artifacts}/dotnet-sos/%{_buildtype}/netcoreapp*/publish/*/sosdocsunix.t
 # Tools
 mkdir -p %{buildroot}%{toolsdir}/%{rid}
 cp %{_artifacts}/Linux.%{_barch}.%{_buildtype}/*.so %{buildroot}%{toolsdir}/%{rid}
-for name in counters dump gcdump trace; do
+for name in counters dump gcdump stack trace; do
   cp -f %{_artifacts}/dotnet-${name}/%{_buildtype}/netcoreapp*/publish/*.dll %{buildroot}%{toolsdir}
 done
 cp -f %{_artifacts}/dotnet-dump/%{_buildtype}/netcoreapp*/publish/*/sosdocsunix.txt %{buildroot}%{toolsdir}
index 1a1b4dcae8e5dc0a763f412003b2607e1c8adf54..e786d19f4cd31bb9d60142ba2f8371fdeb3c0362 100644 (file)
@@ -24,7 +24,7 @@ namespace Microsoft.Diagnostics.Tools.Stack
 {
     internal static class ReportCommandHandler
     {
-        delegate Task<int> ReportDelegate(CancellationToken ct, IConsole console, int processId, string name, TimeSpan duration);
+        delegate Task<int> ReportDelegate(CancellationToken ct, IConsole console, int processId, TimeSpan duration);
 
         /// <summary>
         /// Reports a stack trace
@@ -32,32 +32,16 @@ namespace Microsoft.Diagnostics.Tools.Stack
         /// <param name="ct">The cancellation token</param>
         /// <param name="console"></param>
         /// <param name="processId">The process to report the stack from.</param>
-        /// <param name="name">The name of process to report the stack from.</param>
         /// <param name="output">The output path for the collected trace data.</param>
         /// <param name="duration">The duration of to trace the target for. </param>
         /// <returns></returns>
-        private static async Task<int> Report(CancellationToken ct, IConsole console, int processId, string name, TimeSpan duration)
+        private static async Task<int> Report(CancellationToken ct, IConsole console, int processId, TimeSpan duration)
         {
-            string tempNetTraceFilename = Path.GetRandomFileName() + ".nettrace";
+            string tempNetTraceFilename = "/tmp/" + Path.GetRandomFileName() + ".nettrace";
             string tempEtlxFilename = "";
 
             try
             {
-                // Either processName or processId has to be specified.
-                if (!string.IsNullOrEmpty(name))
-                {
-                    if (processId != 0)
-                    {
-                        Console.WriteLine("Can only specify either --name or --process-id option.");
-                        return -1;
-                    }
-                    processId = CommandUtils.FindProcessIdWithName(name);
-                    if (processId < 0)
-                    {
-                        return -1;
-                    }
-                }
-
                 if (processId < 0)
                 {
                     console.Error.WriteLine("Process ID should not be negative.");
@@ -183,7 +167,6 @@ namespace Microsoft.Diagnostics.Tools.Stack
                 HandlerDescriptor.FromDelegate((ReportDelegate)Report).GetCommandHandler(),
                 // Options
                 ProcessIdOption(),
-                NameOption(),
                 DurationOption()
             };
 
@@ -203,13 +186,5 @@ namespace Microsoft.Diagnostics.Tools.Stack
             {
                 Argument = new Argument<int>(name: "pid")
             };
-
-        public static Option NameOption() =>
-            new Option(
-                aliases: new[] { "-n", "--name" },
-                description: "The name of the process to collect the trace.")
-            {
-                Argument = new Argument<string>(name: "name")
-            };
     }
 }