public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH v3 3/7] gdbserver: suppress "Detaching from process" message
Date: Fri, 3 Dec 2021 23:42:39 +0000	[thread overview]
Message-ID: <98618a36-90ca-c43e-fba6-2d1258153726@palves.net> (raw)
In-Reply-To: <20211201144500.627736-4-simon.marchi@polymtl.ca>

On 2021-12-01 14:44, Simon Marchi via Gdb-patches wrote:
> From: Simon Marchi <simon.marchi@efficios.com>
> 
> The motivation behind this patch is that a following patch in the series
> adds a test that constantly spawns forks.  This makes GDBserver flood
> its stdout with "Detaching from process" messages.  Because the
> testsuite infrastructure does not consume GDBserver's stdout, the pipe
> fills up quickly, and GDBserver eventually blocks on a write to stdout
> forever.
> 
> I first tried to make the testsuite consume GDBserver's stdout, but that
> wasn't very pretty.  We would need to do it at various random points,

Did you try doing it from within gdb_test_multiple?  Like, adding something
like '-i $server_spawnid" "." { exp_continue }' to the built-in matches?
I guess that might require an option to suppress that match.

Hmm, maybe instead, use expect_after/expect_before ?

> and it could easily break depending on the particular timing.  Note that
> it could still be useful to have the testsuite consume GDBserver's
> output from time to time, so that we could see any GDBserver output in
> the logs, but it would not be a reliable way of handling this particular
> case, where GDBserver outputs so much.

OOC, WDYM, by "not be a reliable way"?

> 
> I'm wondering if we could simply remove that message, if anybody would
> miss it.  Personally, I don't think it's particularly useful.  The user
> already gets notifications in GDB, if that's what they want.
> 
> An alternative would be to add an option to control whether we print
> this or that message.  But I'd like to avoid adding options and increase
> the complexity if that's not really necessary.

A "This or that" option, I agree, that'd be too much.  Maybe --verbose
would make sense.  Not sure.  See below.

> 
> I thought about starting GDBserver with its stdout redirected to
> /dev/null, since we don't consume it anyway, but that wouldn't work: we
> actually consume the output a little bit in the beginning to see if
> GDBserver was started successfully, or if the specified port was already
> taken.
> 
> Change-Id: Ib371a4bcaeb6dfb5c03077e816019c8473d4d198

The thing to me is that this looks like an arbitrary change in
isolation.

I mean, GDBserver prints this on attach:

  fprintf (stderr, "Attached; pid = %d\n", pid);

and this on kill / 'k':

  fprintf (stderr, "Killing all inferiors\n");

and likely other messages in other cases, including warnings.  Do we want a
policy that gdbserver never prints anything after startup?  Maybe we do.
Maybe add a "from_tty" argument to some functions, and only print if
we get there due to a command line option?  So traffic from GDB would not
cause extra prints.  I'd think you'd want to do something about those
messages mentioned above too and perhaps others, all at the same time.

Maybe it makes sense to have a --verbose mode that isn't full-blown
debug output, and put messages under it.  Not sure.  Maybe we don't and
instead move the messages under --debug.

Let's discuss the policy.  I'm fine with incremental progress toward it,
but we need to know where we're going.

  reply	other threads:[~2021-12-03 23:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 14:44 [PATCH v3 0/7] Fix handling of pending fork events Simon Marchi
2021-12-01 14:44 ` [PATCH v3 1/7] gdbserver: hide fork child threads from GDB Simon Marchi
2021-12-03 23:30   ` Pedro Alves
2021-12-01 14:44 ` [PATCH v3 2/7] gdb/linux-nat: factor ptrace-detach code to new detach_one_pid function Simon Marchi
2021-12-03 23:30   ` Pedro Alves
2021-12-01 14:44 ` [PATCH v3 3/7] gdbserver: suppress "Detaching from process" message Simon Marchi
2021-12-03 23:42   ` Pedro Alves [this message]
2021-12-04  2:57     ` Simon Marchi
2021-12-01 14:44 ` [PATCH v3 4/7] gdb/remote.c: move some things up Simon Marchi
2021-12-03 23:42   ` Pedro Alves
2021-12-01 14:44 ` [PATCH v3 5/7] gdb/remote.c: refactor pending fork status functions Simon Marchi
2021-12-03 23:43   ` Pedro Alves
2021-12-04  3:03     ` Simon Marchi
2021-12-01 14:44 ` [PATCH v3 6/7] gdb: move clearing of tp->pending_follow to follow_fork_inferior Simon Marchi
2021-12-03 23:43   ` Pedro Alves
2021-12-01 14:45 ` [PATCH v3 7/7] gdb, gdbserver: detach fork child when detaching from fork parent Simon Marchi
2021-12-03 23:44   ` Pedro Alves
2021-12-04  3:36     ` Simon Marchi
2021-12-07 23:25       ` Pedro Alves
2021-12-08 19:54         ` Simon Marchi

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=98618a36-90ca-c43e-fba6-2d1258153726@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    --cc=simon.marchi@polymtl.ca \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).