From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: thomas@codesourcery.com
Cc: gdb-patches@sourceware.org, yao@codesourcery.com,
uweigand@de.ibm.com, kevinb@redhat.com,
Stephane.Carrez@gmail.com
Subject: Re: Memory corruption for host double format different from target double format
Date: Fri, 07 Sep 2012 09:16:00 -0000 [thread overview]
Message-ID: <201209070915.q879Ffik026505@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <87a9x29rd2.fsf@schwinge.name> (message from Thomas Schwinge on Fri, 7 Sep 2012 10:20:09 +0200)
> From: Thomas Schwinge <thomas@codesourcery.com>
> Date: Fri, 7 Sep 2012 10:20:09 +0200
>
> Hi!
>
> Ping.
Looks correct to me. Guess enough time has passed to give people an
opportunity to object. So go ahead with this.
> On Thu, 30 Aug 2012 17:37:45 +0200, I wrote:
> > On Wed, 29 Aug 2012 17:36:54 +0200, I wrote:
> > > On Fri, 10 Aug 2012 16:31:47 +0200, Mark Kettenis <mark.kettenis@xs4all=
> .nl> wrote:
> > > > > Date: Fri, 10 Aug 2012 14:56:46 +0200 (CEST)
> > > > > From: "Ulrich Weigand" <uweigand@de.ibm.com>
> > > > >=20
> > > > > Yao Qi wrote:
> > > > > > On Friday, August 10, 2012 11:32:53 AM Thomas Schwinge wrote:
> > > > > > > That is, if set_gdbarch_double_format has not been called, it w=
> ill
> > > > > > > default to floatformats_ieee_double -- even though set_gdbarch_=
> double_bit
> > > > > > > may have been called setting it unequal to the 64-bit double fo=
> rmat.
> > > > > > > Hmm, and gdbarch.c:verify_gdbarch has the following comment on =
> top of it:
> > > > > > > Ensure that all values in a GDBARCH are reasonable. ;-)
> > > > > >=20
> > > > > > Looks like some checking like this is missing?
> > > > > >=20
> > > > > > gdbarch->float_format->totalsize <=3D gdbarch->float_bit
> > > > > > gdbarch->double_format->totalsize <=3D gdbarch->double_bit
> > > > >=20
> > > > > In fact, I'd prefer to make gdbarch_double_format etc. *mandatory*
> > > > > and gdbarch_double_bit etc. optional, defaulting to the format size.
> > > > > (Currently, _bit is mandatory and _format is optional.)
> > > > >=20
> > > > > This would mean that nearly all calls to set_gdbarch_double_bit
> > > > > could go away, with the exception of special cases like "long doubl=
> e"
> > > > > on i386 ...
> > > >=20
> > > > Initializing _bit based on _format by default makes sense, but I don't
> > > > think this is easy to implement given the way how the gdbarch.c code
> > > > is generated.
> > > >=20
> > > > Making _format mandatory doesn't make sense to me though. I'd say
> > > > that ieee_single and ieee_double are perfectly reasonable defaults for
> > > > float_format and double_format.
> > >=20
> > > Is there a reasonable way for at least detecting the mismatch that I
> > > happened to observe for SH?
> > >=20
> > >=20
> > > Other than that, OK to check in the following? I have only tested the =
> SH
> > > bits; no maintainer listed for h8300, Stephane CCed for m68hc11.
> >=20
> > Stephane Carrez' email address <stcarrez@nerim.fr> (as listed in
> > gdb/MAINTAINERS) bounces saying =C2=BBunknown user=C2=AB, but I found ano=
> ther one
> > in the GCC context -- Stephane, is this you? If yes, please update the
> > three occurences of your old email address in gdb/MAINTAINERS (and
> > possibly other files, too).
> >=20
> > Kevin, I'm also adding you to the CC list, as you've been helpful with SH
> > issues before -- should you be listed as a maintainer for SH?
> >=20
> > And what about the h8300 bits?
> >=20
> > > gdb/
> > > * h8300-tdep.c (h8300_gdbarch_init): Invoke
> > > set_gdbarch_double_format and set_gdbarch_long_double_format.
> > > * m68hc11-tdep.c (m68hc11_gdbarch_init): Invoke
> > > set_gdbarch_double_format.
> > > * sh-tdep.c (sh_gdbarch_init): Likewise.
> > >=20
> > > diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
> > > index 7fc4daa..bcb769e 100644
> > > --- a/gdb/h8300-tdep.c
> > > +++ b/gdb/h8300-tdep.c
> > > @@ -1351,7 +1351,9 @@ h8300_gdbarch_init (struct gdbarch_info info, str=
> uct gdbarch_list *arches)
> > > set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> > > set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
> > > set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> > > + set_gdbarch_double_format (gdbarch, floatformats_ieee_single);
> > > set_gdbarch_long_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> > > + set_gdbarch_long_double_format (gdbarch, floatformats_ieee_single);
> > >=20=20
> > > set_gdbarch_believe_pcc_promotion (gdbarch, 1);
> > >=20=20
> > > diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
> > > index 79629ef..cd32459 100644
> > > --- a/gdb/m68hc11-tdep.c
> > > +++ b/gdb/m68hc11-tdep.c
> > > @@ -1498,7 +1498,16 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
> > > set_gdbarch_short_bit (gdbarch, 16);
> > > set_gdbarch_int_bit (gdbarch, elf_flags & E_M68HC11_I32 ? 32 : 16);
> > > set_gdbarch_float_bit (gdbarch, 32);
> > > - set_gdbarch_double_bit (gdbarch, elf_flags & E_M68HC11_F64 ? 64 : 32=
> );
> > > + if (elf_flags & E_M68HC11_F64)
> > > + {
> > > + set_gdbarch_double_bit (gdbarch, 64);
> > > + set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
> > > + }
> > > + else
> > > + {
> > > + set_gdbarch_double_bit (gdbarch, 32);
> > > + set_gdbarch_double_format (gdbarch, floatformats_ieee_single);
> > > + }
> > > set_gdbarch_long_double_bit (gdbarch, 64);
> > > set_gdbarch_long_bit (gdbarch, 32);
> > > set_gdbarch_ptr_bit (gdbarch, 16);
> > > diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
> > > index 1ede13a..caf940d 100644
> > > --- a/gdb/sh-tdep.c
> > > +++ b/gdb/sh-tdep.c
> > > @@ -2299,6 +2299,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct=
> gdbarch_list *arches)
> > > case bfd_mach_sh2e:
> > > /* doubles on sh2e and sh3e are actually 4 byte. */
> > > set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> > > + set_gdbarch_double_format (gdbarch, floatformats_ieee_single);
> > >=20=20
> > > set_gdbarch_register_name (gdbarch, sh_sh2e_register_name);
> > > set_gdbarch_register_type (gdbarch, sh_sh3e_register_type);
> > > @@ -2344,6 +2345,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct=
> gdbarch_list *arches)
> > > case bfd_mach_sh2a_or_sh3e:
> > > /* doubles on sh2e and sh3e are actually 4 byte. */
> > > set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> > > + set_gdbarch_double_format (gdbarch, floatformats_ieee_single);
> > >=20=20
> > > set_gdbarch_register_name (gdbarch, sh_sh3e_register_name);
> > > set_gdbarch_register_type (gdbarch, sh_sh3e_register_type);
>
>
> Gr=C3=BC=C3=9Fe,
> Thomas
>
> --=-=-=
> Content-Type: application/pgp-signature
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
>
> iQEcBAEBAgAGBQJQSa45AAoJENuKOtuXzphJFvkH/jXx0W5f7wdvu5NXfCWxnwTD
> 8BypvAD0GYXry13yQNLWPCvlEvADa2lW3cS1hbTVw30VLZXtonGrQxQMz7J1lRHE
> 4vzamt9Rl5oDKySXDG87LYuXKPyEM07cq6hvRlrS/6Q0LpvT+JjLFnxysYnsHZUv
> guNLfXi6kC5G7hTq9Iklb9zh2wGjA592+UReiDmrWykRgi3ynDxeWk0drw1Drfx3
> ksr0kIk+8IzVAtLruRE+hOi3aMlyWiGoOR/2+MqnBiwketpx+oHpDvRjJnXEpvdt
> 00m/LuPbmahq1BTr3eBopeklT+DrcooKTmOwK/tZnjiaUD/YOqEZS7s04GcHybM=
> =Xqnz
> -----END PGP SIGNATURE-----
> --=-=-=--
>
prev parent reply other threads:[~2012-09-07 9:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87r4rgrkss.fsf@schwinge.name>
2012-08-10 9:33 ` Thomas Schwinge
2012-08-10 10:37 ` Yao Qi
2012-08-10 12:57 ` Ulrich Weigand
2012-08-10 14:32 ` Mark Kettenis
2012-08-29 15:37 ` Thomas Schwinge
2012-08-30 15:38 ` Thomas Schwinge
2012-09-07 8:20 ` Thomas Schwinge
2012-09-07 9:16 ` Mark Kettenis [this message]
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=201209070915.q879Ffik026505@glazunov.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=Stephane.Carrez@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
--cc=thomas@codesourcery.com \
--cc=uweigand@de.ibm.com \
--cc=yao@codesourcery.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