From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id CJ9zA2N7XGcG0RUAWB0awg (envelope-from ) for ; Fri, 13 Dec 2024 13:22:27 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cfqyf2YK; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0ABBA1E097; Fri, 13 Dec 2024 13:22:27 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS autolearn=unavailable autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A82941E091 for ; Fri, 13 Dec 2024 13:22:26 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 51BB43858C66 for ; Fri, 13 Dec 2024 18:22:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51BB43858C66 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cfqyf2YK Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 17B563858D21 for ; Fri, 13 Dec 2024 18:21:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17B563858D21 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 17B563858D21 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734114113; cv=none; b=twSISiYKEUkVprHo2ZKet1AF/JVuIkF/f1K/80stJYnlXT5IRAaq+L2R6eE6fZxWAL2pcgX/Uq/mL4oXolR7SxKEZNR/FfC1IMOF5Xo6Nj3u87gHHIeld5aglVAsL1YhlflQdswSlQmLG5uSky8IRvLIQHY9h4ftX+4EZtywOsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734114113; c=relaxed/simple; bh=YTB796iwSxKlegdnlDAah8phtCLwk11B5ym4w8ChKXA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=BFjXsjnMjzTrH2diyOdPLJrxldSksp0nensMK9LIGuCVIvq15YN8uED66sVSbAtQBhi6ctbZ5YNbBRw7PdHI77EPZzhz6RW5W221NwfiE6Cgs/wjkQIgqk32ozg6hulW1+AJt9Gaqx4GjbCzMozJodxFnnrwNvsCuMr7SVhKFwM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17B563858D21 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734114112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EW9Nkk62z+S3RnzIYj1kIVwB3c5tsrQPuBK8L//J8Ts=; b=cfqyf2YKIr16xV+tRlI6hl93wkra1kr1DoRFb+h3miutqAOJEtZU0zgJAHNuFbXTTXwMyv oISruZiZ4qUfiBWnfIWJ1thR4DPcu3KXz2DKHg1/qUGYJnCpUj9/6X+KVXHxnkD27rbf1x 1wj9/j5KO14X4bAO6zrkeJsSJTlo4pk= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-YJKIlEZCMTujgFdOUrICQA-1; Fri, 13 Dec 2024 13:21:51 -0500 X-MC-Unique: YJKIlEZCMTujgFdOUrICQA-1 X-Mimecast-MFC-AGG-ID: YJKIlEZCMTujgFdOUrICQA Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-725dab9fe44so1759920b3a.1 for ; Fri, 13 Dec 2024 10:21:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734114110; x=1734718910; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EW9Nkk62z+S3RnzIYj1kIVwB3c5tsrQPuBK8L//J8Ts=; b=l3Pw1NIDnoPW4jJreZPNISbl4yx1i+yPJzixrZdVyPQqngy/IkgxIkrYz5j1IEDxQZ Ov7roEaCUZ9sX7o+q2MbknAVAKBA0F/JxTvOMzury0FxsKlAZA98LFTJmrom8PX/N2SO qJeVFh1JUo4bS1gdG3H8y1P+bweKbMbrHNgsfOb9FhGhDk5zF/2JPKtdIe/lnyXMC2Bo V6bgx7TXoSCdC/wk4NLAfa/5BLdLPnYIZZd4EUaTrULwuEhK5PX6xXfD2Ze8Y8Svwl7C G6PtxCjNBUJUBK0KY9TvnXAa4URSWAfWjL8+1LCi1b/kLwPu7zvmSv+j5TyCMPEF7htX s5PA== X-Gm-Message-State: AOJu0Yyl3vP2vx/0o/Qy++XnPkdi2MvTdtsmpqygbrlKv5Q7n9/PLYLV Ul0+JC3T+z4CJYg6G0WgoF6UziNh0ILIIGp1j5Bj3Nu/rrnQTvGJ8czute0wI5FVOyYmqp0t08h tIUGyYE93vPzOX+Q6jHXMrjmKFUxblPyaZZ1GTsWtXQ5hMFqg9rgCC6ThsxFGq1n/DgM= X-Gm-Gg: ASbGncuekfqQaBULn/NAIEugQmL9ObUynmncADzDBmXFYT/Fz/+PQigM15aM3h4NTcd 4Lz/BRHsriutQfpnKkmNniCjxKzsp06wmvhXL49jUbON3nuRP/W0KtwngRrN8jrB4jym/QVQy1C Nwrl/oaz6ikgJHpv41cuKl3bDPm1JrRqEqFVi78f6R46yw7xJCGQaKNfyZs4WfWYC1smvvCypyR j5fAU0+fEv+mAfOy0HtUUkezpC1ndpuSsQTqU5IB7rHizoxfg4+JV/KPQPNwA== X-Received: by 2002:a05:6a00:8c15:b0:725:ce39:4516 with SMTP id d2e1a72fcca58-7290736054bmr5976276b3a.7.1734114110448; Fri, 13 Dec 2024 10:21:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCjKP1UfBjsoelgk7THqD0LxFMupUwxitoEdgk8K1aRrrBJzxhkJoPWeMSlYLUjGzVaMf3Ng== X-Received: by 2002:a05:6a00:8c15:b0:725:ce39:4516 with SMTP id d2e1a72fcca58-7290736054bmr5976245b3a.7.1734114109972; Fri, 13 Dec 2024 10:21:49 -0800 (PST) Received: from [150.1.200.127] ([172.56.107.48]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72918bcdac3sm71942b3a.192.2024.12.13.10.21.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Dec 2024 10:21:49 -0800 (PST) Message-ID: <14f847bb-624f-4f2b-aa37-04f864c724ea@redhat.com> Date: Fri, 13 Dec 2024 10:21:48 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] Add gstack script To: Eli Zaretskii Cc: gdb-patches@sourceware.org References: <08a19a3debe4a1e3c6072a807e79566277a7c0dc.1734022384.git.keiths@redhat.com> <86ttb8xce1.fsf@gnu.org> From: Keith Seitz In-Reply-To: <86ttb8xce1.fsf@gnu.org> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ZsF3cRF0BNa86gGhxd0YZ2kas1QkfTIBQi-WBetTVxU_1734114111 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Hi, On 12/12/24 11:36 PM, Eli Zaretskii wrote: >> --- a/gdb/NEWS >> +++ b/gdb/NEWS >> @@ -62,6 +62,9 @@ >> * Support for process record/replay and reverse debugging on loongarch*-linux* >> targets has been added. >> >> +* Newly installed $prefix/bin/gstack uses GDB to print stack traces of >> + running processes. > > This is okay, but please say that gstack is a Bash shell script. Sure. > Also, what did you want to say by the "newly installed" part? Simply to point out that this is a new script which is installed. How about: * New bash script gstack which uses GDB to print stack traces of running processes. >> +@node gstack man >> +@heading gstack >> + >> +@c man title gstack Print a stack trace of a running program >> + >> +@format >> +@c man begin SYNOPSIS gstack >> +gstack [-h | --help] [-v | --version] @var{pid} >> +@c man end >> +@end format >> + >> +@c man begin DESCRIPTION gstack >> +Print a stack trace of a running program with process ID @var{pid}. If the process >> +is multi-threaded, @command{gstack} outputs backtraces for every thread which exists >> +in the process. >> +@c man end >> + >> +@c man begin OPTIONS gstack >> +@table @env >> +@item --help >> +@itemx -h >> +List all options, with brief explanations. >> + >> +@item --version >> +@itemx -v >> +Print version information and then exit. >> +@end table >> +@c man end >> + >> +@c man begin SEEALSO gstack >> +@ifset man >> +The full documentation for @value{GDBN} is maintained as a Texinfo manual. >> +If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo >> +documentation are properly installed at your site, the command >> + >> +@smallexample >> +info gdb >> +@end smallexample >> + >> +@noindent >> +should give you access to the complete manual. >> + >> +@cite{Using GDB: A Guide to the GNU Source-Level Debugger}, >> +Richard M. Stallman and Roland H. Pesch, July 1991. >> +@end ifset >> +@c man end > > Is that all we want to tell in the manual about the script? Even for > a man page this is quite terse. Can we expand on this some more? At > the very least I think we should tell that the script invokes G|DB to > attach to the program and produce the backtraces, then detaches from > the program. Also, perhaps tell what happens if PID identifies a > non-existent process? You should see the manpage I rewrote. :-) Nonetheless, your point is taken. I will elaborate a little bit more. I've also dug into a few other GNU man pages and note that they commonly list any environment variables influencing the behavior of programs. I've completely forgotten to do that, so I will add those, too. >> +awk -- "$awk_script" > > What if the system has only gawk or nawk or mawk? Should the literal > "awk" be a variable? Oh, awk. This is definitely my bad. It was lost on me the difference between building/installing GDB on a single machine and doing the same on different machines. The environments are not exactly correct. Since I live in a distro-centric world, these two cases reduce for me. I've read through the documentation on AC_PROG_AWK, and I think it best to follow the advice there, including "Limitations of Usual Tools" bits on awk. I think there is one questionable construct in my awk script. I agree -- an AWK environment variable would be a valuable addition, including borrowing some bits from AC_PROG_AWK to make sure we get the preferred awk program. Thank you for your prompt review! I'll send a v3 after awaiting any additional feedback. Keith