From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id PuvzAjFUK2VbHC4AWB0awg (envelope-from ) for ; Sat, 14 Oct 2023 22:53:37 -0400 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=UgF62y/u; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 00FEE1E0C1; Sat, 14 Oct 2023 22:53:36 -0400 (EDT) Received: from server2.sourceware.org (ip-8-43-85-97.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 C0B761E091 for ; Sat, 14 Oct 2023 22:53:34 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 14C933857728 for ; Sun, 15 Oct 2023 02:53:34 +0000 (GMT) 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 0ED023858C00 for ; Sun, 15 Oct 2023 02:53:22 +0000 (GMT) ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0ED023858C00 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=1697338403; cv=none; b=BrHhybzAmG3csaD0v+klvVVu5v7o2XRL2dFiwVvdiM2qJtcoHQ26GHFNxGL3YaJ+LSmpUUxrZi6XiQQQU8Hk695kP3lHwnMCYAQQ1d3M2zIBVuRkkdVJNfykHkCbEkIwOttLp97eZp+MbiDufwbDILToQ5aWP+e+q+HN6V5REzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697338403; c=relaxed/simple; bh=n5xQ0zzWOqEhb54ck1MN5bgOn8BMwTi29OaFTGQqaOk=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=YgksIHtvsbLHvkip78v+EQ1HKIrPJaBukV3wd7xIM3aajDWgPeSG3EvfgfMGNqrHb28kZ0t2Q45DeSxYLKpZJ/iS7PAJQrYlgX6bc9Wbq1vV35eEkiJJT2SUfYHH9HNCwUU6ap/Jx2rjcvc+Rh8MoWpZyzi14IRN18v1YQi4z8E= ARC-Authentication-Results: i=1; server2.sourceware.org DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0ED023858C00 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697338401; 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=3hQtxY3LBCYXrNMsdlRrKmTWLzG0eZ5UvOw103qONqI=; b=UgF62y/uYax5+fOOKHg4x7VuWJzdplmoUT6eqEPAEUqpp2/nzLl2Xy8YpIDtATtnx5afTK BXZUpP9gKn2Z11wmb4BT2sqUVVQAd9LS10+tYbDCh4POP1hNbX1vWq0ZUl49aOrl73QoP6 dPtQXhkbaTLKF2SpzswzNeXlb0Jq+9s= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-489-BCjjX9pYPFy9-pwpVC9E_Q-1; Sat, 14 Oct 2023 22:53:19 -0400 X-MC-Unique: BCjjX9pYPFy9-pwpVC9E_Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 035CC185A790; Sun, 15 Oct 2023 02:53:19 +0000 (UTC) Received: from f37-zws-nv (unknown [10.22.16.8]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B3467175B5; Sun, 15 Oct 2023 02:53:18 +0000 (UTC) Date: Sat, 14 Oct 2023 19:53:17 -0700 From: Kevin Buettner To: Shivam Saxena Cc: gdb-patches@sourceware.org Subject: Re: [RFC] [PATCH] [PR gdb/29796] Fix gdbserver delay before quitting in extended-remote Message-ID: <20231014195236.2b0241c9@f37-zws-nv> In-Reply-To: References: Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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 On Sat, 14 Oct 2023 02:01:42 +0000 Shivam Saxena wrote: > Investigating PR29796, where it was noticed that there was a delay when t= rying to quit the gdb session if connected to gdbserver via stdio. It was a= lso mentioned that using --once=E2=80=8B when launching gdbserver=E2=80=8B = would fix this problem and a recommendation was made to always apply --once= =E2=80=8B when launching gdbserver=E2=80=8B with stdio=E2=80=8B. >=20 > I've explicitly set the run_once=E2=80=8B flag when stdio=E2=80=8B is det= ected at launch of gdbserver. This does fix the problem as suggested in the= bug since the conditional at gdbserver/server.cc:3958=E2=80=8B is always t= riggered. > ``` > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (run_once || (!extended_protocol && = !target_running ())) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 throw_quit ("Quit"); > ``` > However, would it be better to create a new flag for this to facilitate q= uitting despite > extended_protocol=E2=80=8B instead of piggybacking on --once=E2=80=8B log= ic? I don't see a problem with using 'run_once' for this purpose. But if there= 's something I'm missing, please explain... >=20 > Tested on x86_64 Ubuntu 22.04 natively > Testsuite had no regressions. >=20 > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29796 > --- > ``` > diff --git a/gdbserver/server.cc b/gdbserver/server.cc > index e02cdb83b51..3c9e8bc3720 100644 > --- a/gdbserver/server.cc > +++ b/gdbserver/server.cc > @@ -3760,6 +3760,8 @@ captured_main (int argc, char *argv[]) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* "-" specifies a stdio connection an= d is a form of port > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0specification. =C2=A0*/ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 port =3D STDIO_CONNECTION_NAME; > + =C2=A0 =C2=A0 =C2=A0=C2=A0 /* auto-imply --once if invoked via stdio. *= / Comments are supposed to be sentence-like. So the first word is capitalized and it should end with a period (which it does here) followed by two spaces. (So... capitalize "auto" and add an extra space after the period.) Aside from this nit, your patch looks good to me. > + =C2=A0 =C2=A0 =C2=A0=C2=A0 run_once =3D true; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 next_arg++; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > ``` > --- >=20