Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] mips: Fix "info registers" output
Date: Thu, 21 Jun 2001 09:44:00 -0000	[thread overview]
Message-ID: <20010621094418.A30641@nevyn.them.org> (raw)
In-Reply-To: <Pine.SUN.3.91.1010621192927.12321A-100000@is>

On Thu, Jun 21, 2001 at 07:31:15PM +0300, Eli Zaretskii wrote:
> 
> On Thu, 21 Jun 2001, Daniel Jacobowitz wrote:
> 
> >  - the decoding of double-precision arguments was completely broken. 
> > In addition to copying unallocated memory, and getting the byte order
> > wrong, we tried to decode two four-byte pointers to data instead of the
> > data itself.  Thus the doubles were generally 'nan'.
> > 
> >  - If the number of GPRs fit precisely on an integer number of rows,
> > blank space would be printed without even a trailing newline, and the
> > prompt would be mysteriously indented.
> 
> I cannot reproduce this on SGI Irix 6.5, which also uses mips-tdeps.c.  I 
> used a small throw-away FP program and all the FP registers printed 
> perfectly okay.  No NaNs at all.  info registers seems also okay.
> 
> Perhaps I didn't try exactly what you did.  Any further hints?

Really?  Hmm.  I looked over the code and it seemed that both branches
were wrong; however, I could be mistaken...

Aha!  Let me guess - Irix 6.5 is using the FP registers in 8 byte mode,
right?  There was indeed a bug on that path of the code, but it doesn't
actually affect the output.  We have this:

  raw_buffer[0] = (char *) alloca (REGISTER_RAW_SIZE (FP0_REGNUM));
  raw_buffer[1] = (char *) alloca (REGISTER_RAW_SIZE (FP0_REGNUM));
  dbl_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM));

  /* Get the data in raw format.  */
  if (read_relative_register_raw_bytes (regnum, raw_buffer[HI]))
    error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));

[snip]

      memcpy (dbl_buffer, raw_buffer[HI], 2 * REGISTER_RAW_SIZE (FP0_REGNUM));
      flt1 = unpack_double (builtin_type_float,
                            &raw_buffer[HI][offset], &inv1);
      doub = unpack_double (builtin_type_double, dbl_buffer, &inv3);

So we're copying 2 * 8 bytes out of an 8 byte buffer.  But float is
still 4 bytes and double still 8 bytes, so as long as we don't clobber
the stack we shouldn't see a real problem.


The real killer is on the other branch, size == 4:
      memcpy (dbl_buffer, raw_buffer, 2 * REGISTER_RAW_SIZE (FP0_REGNUM));

raw_buffer points to 8 bytes, sure enough - but they're both pointers
to four byte buffers before my patch.  That won't decode.


-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2001-06-21  9:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20010619225007.A10141@nevyn.them.org>
2001-06-20  7:19 ` Andrew Cagney
2001-06-21  0:45 ` Eli Zaretskii
2001-06-21  8:37   ` Daniel Jacobowitz
2001-06-21  9:29     ` Eli Zaretskii
2001-06-21  9:44       ` Daniel Jacobowitz [this message]
2001-06-21 12:00         ` Eli Zaretskii
2001-06-21 13:12           ` Daniel Jacobowitz
2001-06-21 14:22           ` Don Howard
2002-03-07 13:59 ` Daniel Jacobowitz
2002-03-09 18:05   ` Andrew Cagney
2002-03-09 22:58     ` Daniel Jacobowitz
2002-03-10  8:30       ` Andrew Cagney
2002-03-10  9:00         ` Daniel Jacobowitz
2002-03-10  9:46           ` Andrew Cagney
2002-03-10 11:30             ` Daniel Jacobowitz
2002-03-10 12:45               ` Andrew Cagney
2002-03-10 14:26                 ` Daniel Jacobowitz
2002-03-10 15:18                   ` Andrew Cagney

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=20010621094418.A30641@nevyn.them.org \
    --to=dmj+@andrew.cmu.edu \
    --cc=eliz@is.elta.co.il \
    --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