Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Andreas Schwab <schwab@suse.de>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: [PATCH] Disable gdbserver on host != target configurations (Re: [PATCH] Move gdbserver to top level)
Date: Tue, 11 Feb 2020 13:48:00 -0000	[thread overview]
Message-ID: <304aa527-cc62-14ab-b607-4a7019b3083e@redhat.com> (raw)
In-Reply-To: <mvma75qeg7m.fsf@suse.de>

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 <palves@redhat.com>
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  <palves@redhat.com>

	* configure.srv: Set UNSUPPORTED if $target != $host.
---
 gdbserver/configure.srv | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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"

base-commit: c675ec1e76bc6cbf47031cd89dda9d9a3ce4993c
-- 
2.14.5


  reply	other threads:[~2020-02-11 13:48 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-19 20:07 [PATCH] Move gdbserver to top level Tom Tromey
2020-01-21  5:34 ` Simon Marchi
2020-01-23 22:03   ` Tom Tromey
2020-01-24 14:29     ` Hannes Domani via gdb-patches
2020-01-24 15:12       ` Tom Tromey
2020-01-24 15:57         ` Tom Tromey
2020-01-24 16:02           ` Hannes Domani via gdb-patches
2020-01-24 16:28             ` Tom Tromey
2020-01-24 16:35               ` Hannes Domani via gdb-patches
2020-01-24 19:03                 ` Hannes Domani via gdb-patches
2020-01-24 15:23 ` Pedro Alves
2020-01-25  0:07   ` Tom Tromey
2020-01-25 16:55     ` Pedro Alves
2020-01-26 16:01       ` Tom Tromey
2020-01-27 18:13         ` Pedro Alves
2020-01-28  0:37           ` Tom Tromey
2020-02-03 21:34             ` Tom Tromey
2020-02-07 16:06               ` Simon Marchi
2020-02-09 13:59               ` Tom de Vries
2020-02-09 14:17                 ` Tom de Vries
2020-02-10 10:01                   ` Tom de Vries
2020-02-10 15:54                     ` Sergio Durigan Junior
2020-02-12  0:55                       ` Tom Tromey
2020-02-12 16:47                         ` Sergio Durigan Junior
2020-02-14  3:54                         ` Sergio Durigan Junior
2020-02-14 18:43                           ` Tom Tromey
2020-02-14 21:14                             ` Tom Tromey
2020-02-17 13:58                               ` Luis Machado
2020-02-17 14:21                                 ` Maciej W. Rozycki
2020-02-17 14:29                                   ` Luis Machado
2020-02-17 16:57                                 ` Luis Machado
2020-02-17 17:01                                 ` Tom Tromey
2020-02-17 17:28                                   ` Aktemur, Tankut Baris
2020-02-17 18:46                                     ` Tom Tromey
2020-02-10 10:59                   ` [PATCH][gdb/testsuite] Skip multi-target.exp without gdbserver Tom de Vries
2020-02-10 12:20                     ` Pedro Alves
2020-02-09 23:05               ` [PATCH] Move gdbserver to top level Alan Modra
2020-02-10 12:02                 ` Pedro Alves
2020-02-10  9:52               ` Andreas Schwab
2020-02-10 12:13                 ` Pedro Alves
2020-02-10 13:04                   ` Andreas Schwab
2020-02-10 13:15                   ` Andreas Schwab
2020-02-11 13:48                     ` Pedro Alves [this message]
2020-02-11 15:29                       ` [PATCH] Disable gdbserver on host != target configurations (Re: [PATCH] Move gdbserver to top level) Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=304aa527-cc62-14ab-b607-4a7019b3083e@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=schwab@suse.de \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox