Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Question: Checking register value in buffer
@ 2005-05-19  2:49 Joel Brobecker
  2005-05-19  3:03 ` Richard Henderson
  2005-05-19 16:41 ` Andrew Cagney
  0 siblings, 2 replies; 9+ messages in thread
From: Joel Brobecker @ 2005-05-19  2:49 UTC (permalink / raw)
  To: gdb-patches

Hello,

I'm wondering if there is a usual way for what I'm trying to do.
Basically, I have fetched a 64bit floating point register on alpha
using:

      regcache_cooked_read (current_regcache, (insn >> 21) & 0x1f, reg);

where reg is a ``char reg[8]''.

Now, I'd like to perform the following tests:

  zero          (reg & 0x7fff_ffff_ffff_ffff) == 0
  sign          (reg & 0x8000_0000_0000_0000) != 0

Right now, I'm juggling with each byte of the buffer, and doing checks
like this:

    fp_register_zero_p (char *buf)
    {
      return ((buf[1] & 0x0f) == 0 && buf[2] == 0 && buf[3] == 0
              && buf[4] == 0 && buf[5] == 0 && buf[6] == 0 && buf[7] == 0);

I thought about something like:

        LONGEST rav = extract_signed_integer (buf, 8)

and then do the test using integer arithmetics. But then I'm not guarantied
that LONGEST is at least 64bit long, am I.

How are these sort of checks usually done in GDB?

Thanks,
-- 
Joel


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-05-19 14:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-19  2:49 Question: Checking register value in buffer Joel Brobecker
2005-05-19  3:03 ` Richard Henderson
2005-05-19  3:07   ` Joel Brobecker
2005-05-19  3:23     ` Richard Henderson
2005-05-19  3:33       ` Joel Brobecker
2005-05-19  4:52         ` Richard Henderson
2005-05-19  5:37         ` Daniel Jacobowitz
2005-05-19  3:26   ` Daniel Jacobowitz
2005-05-19 16:41 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox