# 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}
{
internal static class ReportCommandHandler
{
- private delegate Task<int> ReportDelegate(CancellationToken ct, IConsole console, int processId, string name, TimeSpan duration);
+ private delegate Task<int> ReportDelegate(CancellationToken ct, IConsole console, int processId, TimeSpan duration);
/// <summary>
/// Reports a stack trace
/// <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="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.Join(Path.GetTempPath(), 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.");
HandlerDescriptor.FromDelegate((ReportDelegate)Report).GetCommandHandler(),
// Options
ProcessIdOption(),
- NameOption(),
DurationOption()
};
{
Argument = new Argument<int>(name: "pid")
};
-
- public static Option NameOption() =>
- new(
- aliases: new[] { "-n", "--name" },
- description: "The name of the process to report the stack.")
- {
- Argument = new Argument<string>(name: "name")
- };
}
}