From patchwork Tue Feb 11 13:48:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 37965 Received: (qmail 6130 invoked by alias); 11 Feb 2020 13:48:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 6104 invoked by uid 89); 11 Feb 2020 13:48:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*f:sk:171a314, H*f:sk:874kwk8, H*f:sk:01b4b5c, H*f:sk:87blqfn X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Feb 2020 13:48:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581428921; 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=MGh9upMnaQ+BgRI3ikGpNsupleCWZ+4HWJaLFrupJMM=; b=A+8rhqnbaq+5HsU/6jbPSH/h6PiExrCpnbIMzc2PUcGgm/9IIpi4qaSJtVqpzYlrkWoJA0 /puNZskKlS3y1fWbQQVWczMAry8XlIjc2Y9spZW5bZcMXAvX17+bprChrtKtFmoFooc6gB xBRbIPSepzkeM5ACXl2cOaBlhD4yV+E= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-8Fcfty21NMSJQwfyOC780g-1; Tue, 11 Feb 2020 08:48:37 -0500 Received: by mail-wm1-f69.google.com with SMTP id t17so1365969wmi.7 for ; Tue, 11 Feb 2020 05:48:37 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f909:7b00:56ee:75ff:fe8d:232b? ([2001:8a0:f909:7b00:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id o15sm5333481wra.83.2020.02.11.05.48.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Feb 2020 05:48:35 -0800 (PST) Subject: [PATCH] Disable gdbserver on host != target configurations (Re: [PATCH] Move gdbserver to top level) To: Andreas Schwab References: <87d0bf45up.fsf@tromey.com> <7ceebbb7-b2f7-3d4a-1d8a-f31310badbe8@redhat.com> <874kwk8nz9.fsf@tromey.com> <171a3144-af37-1c29-a2a4-c4cd7eaa14c0@redhat.com> <87r1zm6x8s.fsf@tromey.com> <01b4b5ca-a802-54b5-3135-428b7c9faa84@redhat.com> <87o8uo4mj0.fsf@tromey.com> <87blqfn0d6.fsf@tromey.com> Cc: Tom Tromey , gdb-patches@sourceware.org From: Pedro Alves Message-ID: <304aa527-cc62-14ab-b607-4a7019b3083e@redhat.com> Date: Tue, 11 Feb 2020 13:48:34 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com On 2/10/20 1:15 PM, Andreas Schwab wrote: > On Feb 10 2020, Pedro Alves wrote: > >> On 2/10/20 9:52 AM, Andreas Schwab wrote: >>> Should gdbserver be disabled automatically when building with a cross >>> compiler? >> >> I'm confused. Why would we want to do that? > > Actually what I mean is, when building a cross toolchain, host != > target. Ah, yes. In that case gdbserver is not going to be useful to debug the target. This patch below works for me. From 0299b2ba691937a69b1d0b69b830794584f894ff Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 11 Feb 2020 13:47:28 +0000 Subject: [PATCH] Disable gdbserver on host != target configurations If we're building a cross toolchain, hosted on $host targetting $target, it's useless to build gdbserver, since it runs on $host and debugs $host programs, not $target programs. We used to have, gdb/configure.ac: # We only build gdbserver automatically in a native configuration, and # only if the user did not explicitly disable its build. if test "$gdb_native" = "yes" -a "$enable_gdbserver" != "no"; then ^^^^^^^^^^^^^^^^^^^^^^^^^^ and gdb_native is set like this in gdb/configure.ac: if test "${target}" = "${host}"; then gdb_native=yes else gdb_native=no fi But that was lost in the top-level move. This patch restores the old behavior of not building gdbserver in the non-native case. gdbserver/ChangeLog: yyyy-mm-dd Pedro Alves * configure.srv: Set UNSUPPORTED if $target != $host. --- gdbserver/configure.srv | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) base-commit: c675ec1e76bc6cbf47031cd89dda9d9a3ce4993c diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv index 2e83cbdc07f..3bdddaabb20 100644 --- a/gdbserver/configure.srv +++ b/gdbserver/configure.srv @@ -33,7 +33,13 @@ ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-vsx32l- # these files over and over again. srv_linux_obj="linux-low.o nat/linux-osdata.o nat/linux-procfs.o nat/linux-ptrace.o nat/linux-waitpid.o nat/linux-personality.o nat/linux-namespaces.o fork-child.o nat/fork-inferior.o" -# Input is taken from the "${host}" variable. +# Input is taken from the "${host}" and "${target}" variables. + +# GDBserver can only debug native programs. +if test "${target}" != "${host}"; then + UNSUPPORTED=1 + exit 0 +fi case "${host}" in aarch64*-*-linux*) srv_tgtobj="linux-aarch64-low.o"