Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Tom Tromey <tromey@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [patch 2/2+rfc+doc] Install gcore by default (+new man page)
Date: Wed, 10 Apr 2013 19:49:00 -0000	[thread overview]
Message-ID: <51654DF0.3090101@redhat.com> (raw)
In-Reply-To: <20130409165525.GA29570@host2.jankratochvil.net>

On 04/09/2013 05:55 PM, Jan Kratochvil wrote:
> On Tue, 09 Apr 2013 16:26:06 +0200, Pedro Alves wrote:
>> - Should we install it on hosts/builds that don't support gcore
>>   with the native target?
> 
> I did not consider it worth the work... but here it is.
> 
> I have found these files support the legacy to_find_memory_regions way
> 	amd64fbsd-nat gnu-nat i386fbsd-nat ppcfbsd-nat procfs sparc64fbsd-nat
> 
> so I have enabled fcore for any *.mh files using one of those.
> 
> The new set_gdbarch_find_memory_regions way uses only linux-tdep so I have put
> that in configure.ac, otherwise there would be a new variable in each
> configure.tgt rule using linux-tdep (23 cases) which would be IMO more prone
> to a future mistake.

Right, but adds the complication of having two ways of doing things.
It made the patch surprisingly harder to read to me than I was expecting, for
instance  (e.g., I had to try it to convince myself that
"--host=x86_64-unknown-linux-gnu --target=arm-linux-gnu" or
"--host=x86_64-unknown-linux-gnu --target=arm-linux-gnu --enable-targest=x86_64-unknown-linux-gnu"
do the right thing).

'grep "^supply_gregset " *' gives a good approximation (if not exact) of
targets that do cores.  I wonder whether instead adding a HAVE_NATIVE_GCORE(_HOST)
to each .mh corresponding to each of those wouldn't be easier on the long run.
It's very similar to what we used to do before:

commit c1180e35dc58a8ce9bb076eaeff249c83423f1bf
Author: Hui Zhu <teawater@gmail.com>
Date:   Mon Oct 26 18:30:39 2009 +0000

    2009-10-26  Michael Snyder  <msnyder@vmware.com>
            Hui Zhu  <teawater@gmail.com>

        * Makefile.in (SFILES): Add gcore.c.
        (COMMON_OBS): Add gcore.o.
        * config/alpha/alpha-linux.mh (NATDEPFILES): Delete gcore.o.
        * config/alpha/fbsd.mh (NATDEPFILES): Ditto.
        * config/arm/linux.mh (NATDEPFILES): Ditto.
        * config/i386/fbsd.mh (NATDEPFILES): Ditto.
        * config/i386/fbsd64.mh (NATDEPFILES): Ditto.
        * config/i386/i386sol2.mh (NATDEPFILES): Ditto.
        * config/i386/linux.mh (NATDEPFILES): Ditto.
        * config/i386/linux64.mh (NATDEPFILES): Ditto.
        * config/i386/sol2-64.mh (NATDEPFILES): Ditto.
        * config/ia64/linux.mh (NATDEPFILES): Ditto.
        * config/m32r/linux.mh (NATDEPFILES): Ditto.
        * config/m68k/linux.mh (NATDEPFILES): Ditto.
        * config/mips/linux.mh (NATDEPFILES): Ditto.
        * config/pa/linux.mh (NATDEPFILES): Ditto.
        * config/powerpc/linux.mh (NATDEPFILES): Ditto.
        * config/powerpc/ppc64-linux.mh (NATDEPFILES): Ditto.
        * config/s390/s390.mh (NATDEPFILES): Ditto.
        * config/sparc/fbsd.mh (NATDEPFILES): Ditto.
        * config/sparc/linux.mh (NATDEPFILES): Ditto.
        * config/sparc/linux64.mh (NATDEPFILES): Ditto.
        * config/sparc/sol2.mh (NATDEPFILES): Ditto.
        * config/xtensa/linux.mh (NATDEPFILES): Ditto.
        * target.c (dummy_find_memory_regions): Change output.
        (dummy_make_corefile_notes): Ditto.

Except we'd set a flag, instead of adding gcore.o to NATDEPFILES.

> Contrary to my recent regression mishaps I have tested various make install
> cases this time (not out-of-src-tree but that is not applicable for this
> change).

With --enable-targets=all, I got:

$ make DESTDIR=/tmp/foo/ install
...
/usr/bin/install: cannot stat `gcore': No such file or directory

But I'm not sure that's related to the issue pointed out
above, or whether I hasn't applied the patch properly.

> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -203,6 +203,7 @@ fi
>  
>  TARGET_OBS=
>  all_targets=
> +HAVE_NATIVE_GCORE_TARGET=
>  
>  for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
>  do
> @@ -236,6 +237,14 @@ do
>      if test x${want64} = xfalse; then
>        . ${srcdir}/../bfd/config.bfd
>      fi
> +
> +    # Check whether this target is native and supports gcore.
> +    # Such target has to call set_gdbarch_find_memory_regions.
> +    if test $gdb_native = yes -a "$targ_alias" = "$target_alias"; then
> +        case " ${gdb_target_obs} " in
> +        *" linux-tdep.o "*) HAVE_NATIVE_GCORE_TARGET=1 ;;

It's still better to push this into configure.tgt.  E.g., keep the
if test line here, but have configure.tgt set $gdb_have_gcore, and
set HAVE_NATIVE_GCORE_TARGET accordingly.  We can still do that

       case " ${gdb_target_obs} " in
             *" linux-tdep.o "*)

bit in configure.tgt instead of touching every target switch case.
The main difference is that #1 the linux-tdep.o knowledge
is localized, and #2, changes to configure.tgt don't
require configure regeneration (thinking of future changes
to that bit for other targets).

-- 
Pedro Alves


  reply	other threads:[~2013-04-10 11:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08 14:15 Jan Kratochvil
2013-04-08 19:41 ` Eli Zaretskii
2013-04-09  2:10   ` Jan Kratochvil
2013-04-09  8:53     ` Tom Tromey
2013-04-09  9:01       ` Jan Kratochvil
2013-04-09 14:26         ` Jan Kratochvil
2013-04-09 18:53           ` Eli Zaretskii
2013-04-09 15:29       ` Pedro Alves
2013-04-09 19:59         ` Jan Kratochvil
2013-04-10 19:49           ` Pedro Alves [this message]
2013-04-11  2:43             ` Jan Kratochvil
2013-04-11  7:40               ` Jan Kratochvil
2013-04-11 17:52                 ` auto-generated parts in posted patches (Re: [patch 2/2+rfc+doc] Install gcore by default (+new man page)) Pedro Alves
2013-04-12 18:16                   ` Tom Tromey
2013-04-11 17:49               ` [patch 2/2+rfc+doc] Install gcore by default (+new man page) Pedro Alves
2013-04-11 22:59                 ` [commit] " Jan Kratochvil
2013-04-11 23:00                   ` Pedro Alves

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=51654DF0.3090101@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=tromey@redhat.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