From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id D+JXBgVpZGXaohAAWB0awg (envelope-from ) for ; Mon, 27 Nov 2023 05:01:41 -0500 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=a9H+InRS; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0E6F91E0D2; Mon, 27 Nov 2023 05:01:41 -0500 (EST) Received: from server2.sourceware.org (server2.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 DAFDF1E00F for ; Mon, 27 Nov 2023 05:01:38 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D647B3857710 for ; Mon, 27 Nov 2023 10:01:37 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A36373858CD1 for ; Mon, 27 Nov 2023 10:01:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A36373858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A36373858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701079287; cv=none; b=lsrOhfu20FhtF/Z/Qr16HSLQQswXSD1ttlAEd/CDGzUb8wl27OwkGzTd3K8ZzyiPgZt3mLkmAEmCLGFSsZFYpkh2k7mJ+Xq1zTlyN0BK6CGIfxKRpnUJp14bW6J5Gxb1R4PgAutki8YrDT5zvUmmWV16mFMv4hSf1MbiDVEqF84= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701079287; c=relaxed/simple; bh=C0nCc9GnpLQrqVhL3CCoFyxMML2qAQFGeUcBNrHlz3M=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=E5xOgvX4LDBjc9N7nc5qm7ihry1OL95NZBjqG1CruY507HYhAC9nTf9h42Xo+KPpTvYESkh9BpAQ8Dp2oFs3GnO5KByK0jHzACvBsuLS/qbyNImXzqebGNXG926XsDVueKxLN0HPU+xs9u3advmSUym77ATnD5UGU94xWpbvc0s= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701079285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iGyws7VwNG6Q6+USrjlC9pqm1203xpazNDPiRpjInJE=; b=a9H+InRS+WQe6w6/p8g681UIwK8ctfnGHuusB2kdERCnuWiE2vZ6z08tiMP+PyniXRCr11 6LNA1VVl63tVfJr+ly8fjizklJSUKz3VadmDQpt1puUxcuQ/TjYQ2DBheaH+kSSOWYEt+m VFMuwbdXgXSDQLaAxyaz/6awSz8G7ak= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-614-0zS8K8d1MXOqjgayDfrbMw-1; Mon, 27 Nov 2023 05:01:23 -0500 X-MC-Unique: 0zS8K8d1MXOqjgayDfrbMw-1 Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-2859d83dfafso2627206a91.3 for ; Mon, 27 Nov 2023 02:01:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701079282; x=1701684082; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iGyws7VwNG6Q6+USrjlC9pqm1203xpazNDPiRpjInJE=; b=DA+U2cZ7Bhny2av5RqnJ8PqqIPoXA7UBYGjb/X/F1rnl/9fB8n3HE22j80X04wDge8 FAJMgZ4LcF13ykezA+P2z2Dx9nl7n5DUpxUHLDFKNnOLzbBSzry6U9i1TZX78FCko5P2 W5k8v+IOWP7JtCLpxaFU/bSRIjELxFDkGRUp7QOCM5hX9cok+u2/67PkmXKvswdyUb+O dU86zmFnKBS/PPeKRqjcEWQ8ZzMRFWQswrJHRIxRQh6yeSUsBoqZsh4qZ+WKkcVrNUeH u+rCM6tv5Fwu+FvX/M108SzkgnjPYkJXwx5s0urSEl4rmnHlYoBoCEFe5kLbY3eIDjYN 3mwQ== X-Gm-Message-State: AOJu0YyIha7oHRaytRwcBlz6xqlDvMMMt5w/oWTQIoxgtDEbCQc0LG7p sEP3ekA5TaEJnXn+qO7Lc0JK1wFUhNZzNoTBaItN7KK9LSe8x1N8xJUqCLkdUhHDrdyI7i9YHEg YUCenv1/YIIzTaCWx3G+QiLKIWsPZaQ5FIFx4LS7CXeTEwQ== X-Received: by 2002:a17:90b:4c09:b0:285:7b91:7fe4 with SMTP id na9-20020a17090b4c0900b002857b917fe4mr9726890pjb.4.1701079282044; Mon, 27 Nov 2023 02:01:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGcQCArdJ6QR/vf5tOx+quRVYkHOw0JFRjvPRtM5uRVGm/+zVQDhGiRT4fYNHvK/CuOoxS7A4Gppzc19tg3wLI= X-Received: by 2002:a17:90b:4c09:b0:285:7b91:7fe4 with SMTP id na9-20020a17090b4c0900b002857b917fe4mr9726871pjb.4.1701079281783; Mon, 27 Nov 2023 02:01:21 -0800 (PST) MIME-Version: 1.0 References: <20231117111840.2040709-1-ahajkova@redhat.com> In-Reply-To: <20231117111840.2040709-1-ahajkova@redhat.com> From: Alexandra Petlanova Hajkova Date: Mon, 27 Nov 2023 11:01:10 +0100 Message-ID: Subject: Re: [PATCH 0/6] Add vDefaultInferiorFd feature To: gdb-patches@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000536df0060b1f6215" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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 --000000000000536df0060b1f6215 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ping On Fri, Nov 17, 2023 at 12:18=E2=80=AFPM Alexandra H=C3=A1jkov=C3=A1 wrote: > Currently, when GDBserver is run locally using stdio, the inferior > is unable to read from STDIN so we can't give it any input. > The main motivation to address this issue is to use GDB together > with Valgrind, using vgdb --multi feature which allows to run > Valgrind from inside GDB. Valgrind then acts as a locally run > GDBserver that uses stdio. > > Add a new DefaultInferiorFd feature and the corresponding packet. > This feature allows GDB to send, to GDBserver, the file descriptor > numbers of the terminal to which GDB is connected. The inferior is > then started connected to the same terminal as GDB. This allows the > inferior run by local GDBserver to read from GDB's STDIN and write > its output to GDB's STOUT/ERR the same way as native target. > > > > Alexandra H=C3=A1jkov=C3=A1 (6): > gdb.server/non-existing-program.exp: Use gdbserver_start. > gdb/ser-pipe.c: Duplicate the file descriptors > Add new vDefaultInferiorFd packet > gdbserver/linux-low.cc: Connect the inferior to the terminal > remote.c: Add terminal handling functions > Add defaultinf.exp test to the testsuite > > gdb/doc/gdb.texinfo | 32 +++++ > gdb/remote.c | 83 +++++++++++ > gdb/ser-pipe.c | 25 ++++ > gdb/serial.c | 4 + > gdb/serial.h | 4 + > gdb/testsuite/gdb.server/defaultinf.c | 39 ++++++ > gdb/testsuite/gdb.server/defaultinf.exp | 59 ++++++++ > .../gdb.server/non-existing-program.exp | 54 ++----- > gdb/testsuite/lib/gdbserver-support.exp | 62 +++++--- > gdbserver/linux-low.cc | 32 ++++- > gdbserver/server.cc | 132 +++++++++++++++++- > gdbserver/server.h | 12 ++ > 12 files changed, 476 insertions(+), 62 deletions(-) > create mode 100644 gdb/testsuite/gdb.server/defaultinf.c > create mode 100644 gdb/testsuite/gdb.server/defaultinf.exp > > -- > 2.41.0 > > --000000000000536df0060b1f6215 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ping

On Fri, Nov 17, 2023 at 12:18=E2=80=AFPM Alexandra= H=C3=A1jkov=C3=A1 <ahajkova@redh= at.com> wrote:
Currently, when GDBserver is run locally using stdio, the inferior is unable to read from STDIN so we can't give it any input.
The main motivation to address this issue is to use GDB together
with Valgrind, using vgdb --multi feature which allows to run
Valgrind from inside GDB. Valgrind then acts as a locally run
GDBserver that uses stdio.

Add a new DefaultInferiorFd feature and the corresponding packet.
This feature allows GDB to send, to GDBserver, the file descriptor
numbers of the terminal to which GDB is connected. The inferior is
then started connected to the same terminal as GDB. This allows the
inferior run by local GDBserver to read from GDB's STDIN and write
its output to GDB's STOUT/ERR the same way as native target.



Alexandra H=C3=A1jkov=C3=A1 (6):
=C2=A0 gdb.server/non-existing-program.exp: Use gdbserver_start.
=C2=A0 gdb/ser-pipe.c: Duplicate the file descriptors
=C2=A0 Add new vDefaultInferiorFd packet
=C2=A0 gdbserver/linux-low.cc: Connect the inferior to the terminal
=C2=A0 remote.c: Add terminal handling functions
=C2=A0 Add defaultinf.exp test to the testsuite

=C2=A0gdb/doc/gdb.texinfo=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 32 +++++
=C2=A0gdb/remote.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 83 += ++++++++++
=C2=A0gdb/ser-pipe.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 25 ++++ =C2=A0gdb/serial.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A04 +
=C2=A0gdb/serial.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A04 +
=C2=A0gdb/testsuite/gdb.server/defaultinf.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0|=C2=A0 39 ++++++
=C2=A0gdb/testsuite/gdb.server/defaultinf.exp=C2=A0 =C2=A0 =C2=A0 =C2=A0|= =C2=A0 59 ++++++++
=C2=A0.../gdb.server/non-existing-program.exp=C2=A0 =C2=A0 =C2=A0 =C2=A0|= =C2=A0 54 ++-----
=C2=A0gdb/testsuite/lib/gdbserver-support.exp=C2=A0 =C2=A0 =C2=A0 =C2=A0|= =C2=A0 62 +++++---
=C2=A0gdbserver/linux-low.cc=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 32 ++++-
=C2=A0gdbserver/server.cc=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 132 +++++++++++++++++- =C2=A0gdbserver/server.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 12 ++
=C2=A012 files changed, 476 insertions(+), 62 deletions(-)
=C2=A0create mode 100644 gdb/testsuite/gdb.server/defaultinf.c
=C2=A0create mode 100644 gdb/testsuite/gdb.server/defaultinf.exp

--
2.41.0

--000000000000536df0060b1f6215--