Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] Add gstack script
Date: Fri, 13 Dec 2024 10:21:48 -0800	[thread overview]
Message-ID: <14f847bb-624f-4f2b-aa37-04f864c724ea@redhat.com> (raw)
In-Reply-To: <86ttb8xce1.fsf@gnu.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


  reply	other threads:[~2024-12-13 18:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 18:18 [PATCH] " Keith Seitz
2024-12-11 16:51 ` Andrew Burgess
2024-12-11 16:58   ` Keith Seitz
2024-12-12 21:07 ` [PATCH v2] " Keith Seitz
2024-12-13  7:36   ` Eli Zaretskii
2024-12-13 18:21     ` Keith Seitz [this message]
2024-12-13 19:04       ` Eli Zaretskii
2024-12-13 19:45   ` Tom Tromey
2024-12-13 19:57     ` Keith Seitz
2024-12-18 18:05 ` [PATCH v3] " Keith Seitz
2024-12-18 19:22   ` Eli Zaretskii
2024-12-18 21:47     ` Keith Seitz
2024-12-20 16:15   ` Tom Tromey
2024-12-20 18:18     ` Keith Seitz
2024-12-20 18:26       ` Tom Tromey
2024-12-20 20:47         ` Keith Seitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14f847bb-624f-4f2b-aa37-04f864c724ea@redhat.com \
    --to=keiths@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox