From: j-h.choi Date: Mon, 25 Jan 2021 04:28:22 +0000 (+0900) Subject: [Tizen] Add dotnet-stack tool X-Git-Tag: submit/tizen/20220302.040122~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be261e651e132c7f61af569704d84c407195ce3b;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git [Tizen] Add dotnet-stack tool --- diff --git a/documentation/design-docs/dotnet-tools.md b/documentation/design-docs/dotnet-tools.md index aea2c5efe..bb7487c62 100644 --- a/documentation/design-docs/dotnet-tools.md +++ b/documentation/design-docs/dotnet-tools.md @@ -419,7 +419,6 @@ COMMANDS REPORT dotnet-stack report -p|--process-id - -n|--name [-h|--help] Prints the managed stack from every thread in the target process diff --git a/packaging/coreclr-diagnostics.spec b/packaging/coreclr-diagnostics.spec index 2e8849ad8..1bb9221ae 100755 --- a/packaging/coreclr-diagnostics.spec +++ b/packaging/coreclr-diagnostics.spec @@ -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} diff --git a/src/Tools/dotnet-stack/ReportCommand.cs b/src/Tools/dotnet-stack/ReportCommand.cs index 1a1b4dcae..e786d19f4 100644 --- a/src/Tools/dotnet-stack/ReportCommand.cs +++ b/src/Tools/dotnet-stack/ReportCommand.cs @@ -24,7 +24,7 @@ namespace Microsoft.Diagnostics.Tools.Stack { internal static class ReportCommandHandler { - delegate Task ReportDelegate(CancellationToken ct, IConsole console, int processId, string name, TimeSpan duration); + delegate Task ReportDelegate(CancellationToken ct, IConsole console, int processId, TimeSpan duration); /// /// Reports a stack trace @@ -32,32 +32,16 @@ namespace Microsoft.Diagnostics.Tools.Stack /// The cancellation token /// /// The process to report the stack from. - /// The name of process to report the stack from. /// The output path for the collected trace data. /// The duration of to trace the target for. /// - private static async Task Report(CancellationToken ct, IConsole console, int processId, string name, TimeSpan duration) + private static async Task 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(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(name: "name") - }; } }