Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Elizabeth Chastain <chastain@cygnus.com>
To: ac131313@redhat.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfa/i387] Eliminate HOST_*_FORMAT from i387-tdep.c
Date: Fri, 06 Jul 2001 05:52:00 -0000	[thread overview]
Message-ID: <200107061252.FAA21069@stanley.cygnus.com> (raw)

Jump back, this new code has a pointer glitch.  I think it needs
this patch.

I tested this on native Red Hat Linux 7 with gcc 3.0 with the test
script gdb.base/default.exp.  Without the patch, gdb crashes on
an "info float" command.

OK to apply?

MichaelC

===

Index: i387-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i387-tdep.c,v
retrieving revision 1.11
diff -c -1 -0 -p -r1.11 i387-tdep.c
*** gdb/i387-tdep.c	2001/07/04 21:14:05	1.11
--- gdb/i387-tdep.c	2001/07/06 12:47:00
*************** print_i387_value (char *raw)
*** 163,184 ****
    DOUBLEST value;
    int len = TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT;
    char *tmp = alloca (len);
  
    /* This code only works on targets where ... */
    gdb_assert (TARGET_LONG_DOUBLE_FORMAT == &floatformat_i387_ext);
  
    /* Take care of the padding.  FP reg is 80 bits.  The same value in
       memory is 96 bits.  */
    gdb_assert (FPU_REG_RAW_SIZE < len);
!   memcpy (&tmp, raw, FPU_REG_RAW_SIZE);
!   memset (&tmp + FPU_REG_RAW_SIZE, 0, len - FPU_REG_RAW_SIZE);
    
    /* Extract the value as a DOUBLEST.  */
    /* Use extract_floating() rather than floatformat_to_doublest().
       The latter is lossy in nature.  Once GDB gets a host/target
       independent and non-lossy FP it will become possible to bypass
       extract_floating() and call floatformat*() directly.  Note also
       the assumptions about TARGET_LONG_DOUBLE above.  */
    value = extract_floating (tmp, len);
  
    /* We try to print 19 digits.  The last digit may or may not contain
--- 163,184 ----
    DOUBLEST value;
    int len = TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT;
    char *tmp = alloca (len);
  
    /* This code only works on targets where ... */
    gdb_assert (TARGET_LONG_DOUBLE_FORMAT == &floatformat_i387_ext);
  
    /* Take care of the padding.  FP reg is 80 bits.  The same value in
       memory is 96 bits.  */
    gdb_assert (FPU_REG_RAW_SIZE < len);
!   memcpy (tmp, raw, FPU_REG_RAW_SIZE);
!   memset (tmp + FPU_REG_RAW_SIZE, 0, len - FPU_REG_RAW_SIZE);
    
    /* Extract the value as a DOUBLEST.  */
    /* Use extract_floating() rather than floatformat_to_doublest().
       The latter is lossy in nature.  Once GDB gets a host/target
       independent and non-lossy FP it will become possible to bypass
       extract_floating() and call floatformat*() directly.  Note also
       the assumptions about TARGET_LONG_DOUBLE above.  */
    value = extract_floating (tmp, len);
  
    /* We try to print 19 digits.  The last digit may or may not contain


             reply	other threads:[~2001-07-06  5:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-06  5:52 Michael Elizabeth Chastain [this message]
2001-07-06  6:16 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2001-06-29  9:53 Andrew Cagney
2001-07-01  5:56 ` Mark Kettenis
2001-07-02  8:55   ` Jim Blandy
2001-07-03 12:26     ` Russ Allbery
2001-07-04 12:18   ` Andrew Cagney
2001-07-04 14:13     ` Mark Kettenis

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=200107061252.FAA21069@stanley.cygnus.com \
    --to=chastain@cygnus.com \
    --cc=ac131313@redhat.com \
    --cc=gdb-patches@sources.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