From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id DC9D43858C39 for ; Wed, 24 Nov 2021 15:16:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DC9D43858C39 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-359-Kk2CJuK7Mt6Dzrdhf1FCvQ-1; Wed, 24 Nov 2021 10:16:08 -0500 X-MC-Unique: Kk2CJuK7Mt6Dzrdhf1FCvQ-1 Received: by mail-wr1-f71.google.com with SMTP id h13-20020adfa4cd000000b001883fd029e8so578625wrb.11 for ; Wed, 24 Nov 2021 07:16:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=uM9RRgt6FltohvuzVl9RDqFkji2xeVoeyqNTMWH5wIE=; b=4sfI0NCFegzpw3ho1wQuigGq9a8DHoltUfzZge5P/HDUZdMhZxUIEq0qfKx/QJ7iJD zXVsx71mqQnWKU68x14b1X6ZnUuh+9XjrccbrZ2NslB4hp6JFd3l0twjUTEneEAe43fQ PX0m54CtlAHHlV9QY8irLgOMpz0zeahVdxYmBzYLRNoBlLLgAKIhH8E3NNLGD6MHvvIF RN0/FzOy7FFUS9tVr+5MG4WhSqxdXj4iBTZwXZJYHpsIC8H1Z6zIPgiPSJnYXeSSyTd7 S5tE6tGHwh4Pz4QW3dT5ZQTFfJR4ZErcL03xhkCI1rDkjKeo/ISb/7ZG35I6HD6nIsLK bKrA== X-Gm-Message-State: AOAM533aM9v+tnOgvIwQHib+m6B561d+m1JL/7L1NkOEWmCeEVKnnj/Y W/sgajYjln6pYhBf5RI9oJln1b4fhf/8FmJSPa3VhRB4TTjcQksS2ClMI6nmP+VM7yq6bx39gZ+ afxd/MPFmlSXX2YfuTjnqtQ== X-Received: by 2002:a05:600c:202:: with SMTP id 2mr15873851wmi.167.1637766967072; Wed, 24 Nov 2021 07:16:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbn7sz8vVNlFQ3RPz8KFL9rVhQiOScxxT0UHb4EQj4NpKm8dOntsHXby96qGUZJSBwrX2epA== X-Received: by 2002:a05:600c:202:: with SMTP id 2mr15873810wmi.167.1637766966831; Wed, 24 Nov 2021 07:16:06 -0800 (PST) Received: from localhost (host86-166-129-255.range86-166.btcentralplus.com. [86.166.129.255]) by smtp.gmail.com with ESMTPSA id r17sm5912832wmq.5.2021.11.24.07.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 07:16:06 -0800 (PST) Date: Wed, 24 Nov 2021 15:16:05 +0000 From: Andrew Burgess To: John Baldwin Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 12/13] Enable async mode in the target in attach_cmd. Message-ID: <20211124151605.GL2662946@redhat.com> References: <20210803185000.22171-1-jhb@FreeBSD.org> <20210803185000.22171-13-jhb@FreeBSD.org> MIME-Version: 1.0 In-Reply-To: <20210803185000.22171-13-jhb@FreeBSD.org> X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 15:13:58 up 5 days, 4:12, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2021 15:16:12 -0000 * John Baldwin [2021-08-03 11:49:59 -0700]: > If the attach target supports async mode, enable it after the > attach target's ::attach method returns. This makes sense to me. I did have one comment. > --- > gdb/fbsd-nat.c | 13 ------------- > gdb/fbsd-nat.h | 2 -- > gdb/infcmd.c | 4 ++++ > gdb/linux-nat.c | 3 --- > gdb/remote.c | 1 - > 5 files changed, 4 insertions(+), 19 deletions(-) > > diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c > index 1c27b698cce..34713151cbe 100644 > --- a/gdb/fbsd-nat.c > +++ b/gdb/fbsd-nat.c > @@ -1028,19 +1028,6 @@ fbsd_nat_target::close () > inf_ptrace_target::close (); > } > > -/* Implement the "attach" target method. */ > - > -void > -fbsd_nat_target::attach (const char *args, int from_tty) > -{ > - inf_ptrace_target::attach (args, from_tty); > - > - /* Curiously, the core does not do this automatically. */ > - if (target_can_async_p ()) > - target_async (1); > -} > - > - > #ifdef TDP_RFPPWAIT > /* > To catch fork events, PT_FOLLOW_FORK is set on every traced process > diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h > index 9dd9017c1c3..ad7f76bca40 100644 > --- a/gdb/fbsd-nat.h > +++ b/gdb/fbsd-nat.h > @@ -77,8 +77,6 @@ class fbsd_nat_target : public inf_ptrace_target > thread_control_capabilities get_thread_control_capabilities () override > { return tc_schedlock; } > > - void attach (const char *, int) override; > - > void create_inferior (const char *, const std::string &, > char **, int) override; > > diff --git a/gdb/infcmd.c b/gdb/infcmd.c > index c183b60e81a..d4e678643a0 100644 > --- a/gdb/infcmd.c > +++ b/gdb/infcmd.c > @@ -2541,6 +2541,10 @@ attach_command (const char *args, int from_tty) > shouldn't refer to attach_target again. */ > attach_target = NULL; > > + /* Enable async mode if it is supported by the target. */ > + if (target_can_async_p ()) > + target_async (1); > + > /* Set up the "saved terminal modes" of the inferior > based on what modes we are starting it with. */ > target_terminal::init (); > diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c > index 3a6d48f08e6..b80fa25c902 100644 > --- a/gdb/linux-nat.c > +++ b/gdb/linux-nat.c > @@ -1214,9 +1214,6 @@ linux_nat_target::attach (const char *args, int from_tty) > threads and associate pthread info with each LWP. */ > linux_proc_attach_tgid_threads (lp->ptid.pid (), > attach_proc_task_lwp_callback); > - > - if (target_can_async_p ()) > - target_async (1); > } > > /* Get pending signal of THREAD as a host signal number, for detaching > diff --git a/gdb/remote.c b/gdb/remote.c > index 552481fc551..2fb95c1e93b 100644 > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -6095,7 +6095,6 @@ extended_remote_target::attach (const char *args, int from_tty) > gdb_assert (wait_status == NULL); > > gdb_assert (target_can_async_p ()); > - target_async (1); > } I think there's a second call to target_async that can be deleted a few lines earlier, when the condition '!target_is_non_stop_p ()' and then 'target_can_async_p ()' is true. I'd be tempted to replace that earlier occurrence with 'gdb_assert (target_can_async_p ());' though. Thanks, Andrew