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 06F723858D32 for ; Fri, 17 Nov 2023 11:18:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 06F723858D32 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 06F723858D32 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=1700219927; cv=none; b=d+PtBVJYn4R16jPtAX//GN2HR0AnfWiQpmkCD1aEnLN3A3AomNNzf6hKX5FYvbCUgg3Ws+XILYtr4Kzh4P78sAJxMGW5v6DltMRe9py1cH+jjtlNoXG77d7YNqWFRbR2iBMERArZf8BhI2MA4OnhbvJhYRKj8VWkSxaN4IXvBxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700219927; c=relaxed/simple; bh=euHsiYg9u4VmpX0yxp6JWBu2guygqSXpz5OfvBtKuK0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=EUkHJIAt8GeijqaU1TBnFbF9TPMX5PxdGoxzHZVloGawZYUyi6LdTcvsSB9MxeQh0BPxp4ofuYnM8HgCharsZx5SNcTXjZ7SW+hq22Dyvby1eapBbjwZR5mOYRnM4omv28YNartgHCLBnJbJdqv4Ub3vidKM4WbzPuOQpJqs4YI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700219925; 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; bh=/doeyAcw8jFJV61ZusTz/31s9fjvs7QQg3btQ+P9grw=; b=O9JzpTna8xNjlHJ2x3hCSQQWkCJJfy3zVcm4LhBuh839jZPuiLEG77G1d8d86qokKrTS8G LCQ7rmV6JAcX7XxpKoeeIz8pFv5v72L9t7Ll9qi0n//XH/R7DiNpgH+Blzj/JhKOh47WQh hnVTxwf8N6gTrP+seLmAHrpedc/2TJM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-397-ljzTC5JnPs-00W0_-vuOLw-1; Fri, 17 Nov 2023 06:18:44 -0500 X-MC-Unique: ljzTC5JnPs-00W0_-vuOLw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0CF30811E7B for ; Fri, 17 Nov 2023 11:18:44 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.242.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B5612026D4C; Fri, 17 Nov 2023 11:18:42 +0000 (UTC) From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= To: gdb-patches@sourceware.org Cc: ahajkova@redhat.com Subject: [PATCH 0/6] Add vDefaultInferiorFd feature Date: Fri, 17 Nov 2023 12:18:34 +0100 Message-ID: <20231117111840.2040709-1-ahajkova@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,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 List-Id: 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ájková (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