From: Eli Zaretskii <eliz@gnu.org>
To: Cleber Rosa <crosa@redhat.com>
Cc: gdb-patches@sourceware.org, crosa@redhat.com, areis@redhat.com
Subject: Re: [PATCH 3/4] GDBServer: introduce --server-stderr command line option
Date: Sat, 21 Mar 2015 08:26:00 -0000 [thread overview]
Message-ID: <83384yvjr0.fsf@gnu.org> (raw)
In-Reply-To: <1426905265-8495-4-git-send-email-crosa@redhat.com>
> From: Cleber Rosa <crosa@redhat.com>
> Cc: crosa@redhat.com, areis@redhat.com
> Date: Fri, 20 Mar 2015 23:34:24 -0300
>
> This command line option will redirect all of the gdbserver's own
> output (always sent to stderr) to a separate file. This feature
> makes it possible to distinguish between the inferior process stderr
> and gdbserver's own stderr.
> [...]
> +@cindex @option{--server-stderr}, @code{gdbserver} option
> +The @option{--server-stderr} option tells @code{gdbserver} that any content
> +that it would normally generate itself to its own @code{stderr} should be
> +redirected to another file. This is useful if you want to keep the
> +inferior @code{stderr} separate from the one generated by @code{gdbserver}.
Note how the text description of the rationale for the change you
posted to explain it to us is much more useful than the technical
description in the manual. Why not say in the manual what you told
us?
From the user POV, the fact that gdbserver uses stderr for its own
output is an implementation detail that is almost unimportant. (It
could be important for redirection purposes, but the command-line
option you introduce eliminates the need to redirect in most cases,
right?) What _is_ important is that gdbserver's own output will be
redirected to that file, and that important information gets lost in
the confusing "it would normally generate itself to its own 'stderr'",
which leaves unanswered the question what part of gdbserver's output
is "normally" excluded from that.
For this reason, I suggest to name the option "--server-output".
And I think we want a NEWS entry for this change.
> +@item --server-stderr
> +Instruct @code{gdbserver} to redirect its own @code{stderr} to another
> +file.
The option requires an argument, so the argument should be mentioned
with the option and referenced in the text that describes it.
> +static int
> +set_server_stderr (char *path)
> +{
> + FILE *tmp;
> +
> + tmp = fopen (path, "w");
> + if (tmp == NULL)
> + {
> + fprintf (stderr,
> + "Could not open server stderr file '%s': %s\n",
> + path, strerror(errno));
> + return -1;
> + }
> + server_stderr = tmp;
> + return 0;
> +}
> +
> void
> monitor_show_help (void)
> {
> @@ -3017,6 +3036,7 @@ gdbserver_usage (FILE *stream)
> " none\n"
> " timestamp\n"
> " --remote-debug Enable remote protocol debugging output.\n"
> + " --server-stderr=PATH Redirect server's STDERR to file at PATH.\n"
> " --version Display version information and exit.\n"
> " --wrapper WRAPPER -- Run WRAPPER to start new programs.\n"
> " --once Exit after the first connection has "
> @@ -3186,7 +3206,13 @@ captured_main (int argc, char *argv[])
>
> while (*next_arg != NULL && **next_arg == '-')
> {
> - if (strcmp (*next_arg, "--version") == 0)
> + if (strncmp (*next_arg, "--server-stderr=",
> + sizeof ("--server-stderr=") - 1) == 0)
> + {
> + char *path = *next_arg + (sizeof ("--server-stderr=") - 1);
> + set_server_stderr (path);
> + }
> + else if (strcmp (*next_arg, "--version") == 0)
AFAIK, GNU Coding Standards frown on using "path" for anything that is
not PATH-style list of directories. So please use "file" or "file
name" here.
Thanks.
next prev parent reply other threads:[~2015-03-21 8:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-21 2:35 [PATCH 0/4] GDBServer: introduce a dedicated stderr stream Cleber Rosa
2015-03-21 2:35 ` [PATCH 4/4] GDBServer: add 'monitor set server-stderr' command Cleber Rosa
2015-03-21 8:29 ` Eli Zaretskii
2015-03-23 20:09 ` Cleber Rosa
2015-03-21 2:35 ` [PATCH 1/4] GDBServer: introduce a stderr stream dedicated to the server Cleber Rosa
2015-03-21 2:35 ` [PATCH 2/4] GDBServer: give more complete usage information Cleber Rosa
2015-03-21 17:05 ` Pedro Alves
2015-03-24 14:15 ` Cleber Rosa
2015-03-31 14:44 ` Cleber Rosa
2015-04-01 10:10 ` Pedro Alves
2015-03-21 2:35 ` [PATCH 3/4] GDBServer: introduce --server-stderr command line option Cleber Rosa
2015-03-21 8:26 ` Eli Zaretskii [this message]
2015-03-23 18:51 ` Cleber Rosa
2015-03-23 19:12 ` Eli Zaretskii
2015-03-23 20:35 ` Cleber Rosa
2015-03-23 20:43 ` Eli Zaretskii
2015-03-21 15:05 ` [PATCH 0/4] GDBServer: introduce a dedicated stderr stream Pedro Alves
2015-03-24 17:07 ` Cleber Rosa
2015-04-01 11:17 ` Pedro Alves
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=83384yvjr0.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=areis@redhat.com \
--cc=crosa@redhat.com \
--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