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.133.124]) by sourceware.org (Postfix) with ESMTPS id 41B6B3858C53 for ; Fri, 25 Aug 2023 15:34:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 41B6B3858C53 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=1692977689; 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=G4K/s+P8uwdIrckNzhpjxJPeT11+OM52RYujPcB0QME=; b=LM2wZZly83x/p3vt2ZyKQN80WIPr6YmMspEgLUt4ToN9Fx2AtYFONB0TzrM/8DmUsXjoW+ GA6RJpeZlJDGUVjQVGeMTAtVyCHamgjvU8+bTw0aWzXguusjJr/IlNiyumNKk3+suNYsSN 3NZWWITCllp+rHiaS9a0rf19OAmud4Q= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-362-W5U8TL22MmyrPr6RmU_K-Q-1; Fri, 25 Aug 2023 11:34:48 -0400 X-MC-Unique: W5U8TL22MmyrPr6RmU_K-Q-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4011b587b23so8142015e9.3 for ; Fri, 25 Aug 2023 08:34:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977686; x=1693582486; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G4K/s+P8uwdIrckNzhpjxJPeT11+OM52RYujPcB0QME=; b=ki6ELE5bo4t7Vjjfg0ZnMTLcz9qnEA2zB4dEgULlPVEOAJOTHt/KdfZnRPHekwWchl UhD98Qf8BBNILh2EVQie+SlvpVYUH8B37H+eKXEn1yi6MHUVAvgvV+kGYQLFkMpngphO /wretXbliKtfKM6k5V4H/eN3j8M9fxiqTJ1BHmZysGOephLdGTGsyYA8VzP2OHiCZ0ay 9ryJl02do/YfTzO7AD8edfl1Xa8euL7awiaPQcxs9357df0ctSykG4J8pSEVO6+SjvNu qgxESxHhp+WIEdnM70g61M4CHuHMfuI3QMcbOzqc9HofgFHQ1PfsUJ2tB/33DZXipTgd 8aVA== X-Gm-Message-State: AOJu0YxTux6gXmHG2B/YPhHMfVM3AeYQwMGAnAQ4QbgbtGN09eh/E9mC psKiA1f+YYqtI2Xq955yJe7SSbVh5AEM8bNPTs3guUflrDSCHU+Rt+lvCJDrl4Ion+/OxNShnOm gvHAG7cdcjZupKSrZQOq1eoBgUD4CI0+CqWJJVei8onRc6gPqImmEvvEIzpL9kGdzpCjEcM21rG Pu2CoUZw== X-Received: by 2002:a5d:604d:0:b0:319:7c0f:d920 with SMTP id j13-20020a5d604d000000b003197c0fd920mr15352077wrt.57.1692977686596; Fri, 25 Aug 2023 08:34:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHC9lilxiDFfwiLkT0OOVTqei8+0GzlamIJsUmL9SWVBybzYBqZ1DGzSGEcwYAQehYhDSM8CQ== X-Received: by 2002:a5d:604d:0:b0:319:7c0f:d920 with SMTP id j13-20020a5d604d000000b003197c0fd920mr15352060wrt.57.1692977686234; Fri, 25 Aug 2023 08:34:46 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id s10-20020a5d510a000000b0031c71693449sm2542985wrt.1.2023.08.25.08.34.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:34:45 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 00/10] Improve GDB/gdbserver experience when using a local gdbserver Date: Fri, 25 Aug 2023 16:34:33 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-5.9 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 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: The goal of this series is to improve the user experience when using a local (running on the same machine as GDB) gdbserver. Outside of testing, there are still plenty of occasions when a user can end up running gdbserver on the same machine as GDB, tools like valgrind communicate via the remote protocol, as do many simulators (other than those built into GDB). This series includes the following improvements: 1. Better handling of gdbserver's default executable and arguments. This applies to remote gdbservers and local gdbservers, 2. Allow sysroot 'target:' prefix to be ignored when gdbserver is running locally to GDB, and 3. Allow the user to skip setting 'remote exec-file' if gdbserver is running locally to GDB. Changes since V1: - I've added a new 'namespaces' key to the qMachineId reply (in patch #7), this will catch the case where the remote debug server is running inside a container. At least, that's my hope. For my limited testing it does seem to do what I want. - However, I don't think this is the full solution. The current linux_nat_target::filesystem_is_local implementation is more dynamic, checking on each request if the inferior is in the same namespace, which I guess allows for some inferiors being within a different namespace, while others are not. When all accesses are through gdbserver this is all handled correctly, but with the new "local" access strategy we're going to loose this. I plan to come back and address this in a V3 of this series, but this isn't going to happen until some time in September now, so I wanted to share what I currently have. --- Andrew Burgess (10): gdb: have remote_target::extended_remote_run take the exec filename gdb: improve how 'remote exec-file' is stored and accessed gdb: improve show text and help text for 'remote exec-file' gdb/gdbserver: add new qDefaultExecAndArgs packet gdb: detect when gdbserver has no default executable set gdb: make use of is_target_filename gdb: add qMachineId packet gdb: remote filesystem can be local to GDB in some cases gdb: use exec_file with remote targets when possible gdb: remove the get_remote_exec_file function gdb/Makefile.in | 3 + gdb/NEWS | 45 ++ gdb/build-id.c | 2 +- gdb/configure.nat | 2 +- gdb/doc/gdb.texinfo | 186 +++++ gdb/gdb_bfd.h | 8 + gdb/linux-nat.c | 42 ++ gdb/nat/linux-machine-id.c | 85 +++ gdb/nat/linux-machine-id.h | 75 ++ gdb/nat/linux-namespaces.c | 13 + gdb/nat/linux-namespaces.h | 14 + gdb/remote-machine-id.c | 69 ++ gdb/remote-machine-id.h | 108 +++ gdb/remote.c | 683 +++++++++++++++--- gdb/testsuite/gdb.base/remote-exec-file.exp | 7 +- gdb/testsuite/gdb.multi/gdb-settings.exp | 13 + gdb/testsuite/gdb.server/ext-run.exp | 131 +++- .../gdb.server/fetch-exec-and-args.c | 34 + .../gdb.server/fetch-exec-and-args.exp | 253 +++++++ gdb/testsuite/gdb.server/server-local-fs.c | 22 + gdb/testsuite/gdb.server/server-local-fs.exp | 138 ++++ gdb/testsuite/gdb.server/sysroot.exp | 90 +-- gdbserver/Makefile.in | 1 + gdbserver/configure.srv | 2 +- gdbserver/linux-low.cc | 24 + gdbserver/linux-low.h | 2 + gdbserver/server.cc | 45 ++ gdbserver/target.cc | 8 + gdbserver/target.h | 9 + 29 files changed, 1954 insertions(+), 160 deletions(-) create mode 100644 gdb/nat/linux-machine-id.c create mode 100644 gdb/nat/linux-machine-id.h create mode 100644 gdb/remote-machine-id.c create mode 100644 gdb/remote-machine-id.h create mode 100644 gdb/testsuite/gdb.server/fetch-exec-and-args.c create mode 100644 gdb/testsuite/gdb.server/fetch-exec-and-args.exp create mode 100644 gdb/testsuite/gdb.server/server-local-fs.c create mode 100644 gdb/testsuite/gdb.server/server-local-fs.exp base-commit: cdb090c88b4ebf6f728a000d1ee73d9bdee9ebb3 -- 2.25.4