Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/alpha] Use correct register for FP branches in alpha_next_pc()
@ 2005-05-26 15:08 Joel Brobecker
  2005-05-28 18:54 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2005-05-26 15:08 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 891 bytes --]

Blush... Obvious mistake ... 

I looked at the 18 failures I currently have when running the following
testcase (not yet approved):

        http://sources.redhat.com/ml/gdb-patches/2005-05/msg00546.html

It turns out it was an obvious confusion between the register number
embedded in the instruction, and hte register number as GDB knows it.
Say for instance we have a conditional branch instruction on f16, right
now we read register number 16, which is register a0, not f16! The fix
I just committed seemed to be improving things, but only by chance :-/.
With the attached patch, all tests now PASS.

2005-05-26  Joel Brobecker  <brobecker@adacore.com>

        * alpha-tdep.c (alpha_next_pc): Use correct register number
        for floating-point branch instructions.

Tested on alpha-tru64 5.1a. No regression, fixes all 18 failures
observed in alpha-step.exp.

OK to apply?
-- 
Joel

[-- Attachment #2: alpha-tdep.c.diff --]
[-- Type: text/plain, Size: 1147 bytes --]

Index: alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.149
diff -u -p -r1.149 alpha-tdep.c
--- alpha-tdep.c	20 May 2005 06:56:00 -0000	1.149
+++ alpha-tdep.c	26 May 2005 05:36:41 -0000
@@ -1372,6 +1372,7 @@ alpha_next_pc (CORE_ADDR pc)
 {
   unsigned int insn;
   unsigned int op;
+  int regno;
   int offset;
   LONGEST rav;
   char reg[8];
@@ -1404,7 +1405,19 @@ alpha_next_pc (CORE_ADDR pc)
 	}
 
       /* Need to determine if branch is taken; read RA.  */
-      regcache_cooked_read (current_regcache, (insn >> 21) & 0x1f, reg);
+      regno = (insn >> 21) & 0x1f;
+      switch (op)
+        {
+          case 0x31:              /* FBEQ */
+          case 0x36:              /* FBGE */
+          case 0x37:              /* FBGT */
+          case 0x33:              /* FBLE */
+          case 0x32:              /* FBLT */
+          case 0x35:              /* FBNE */
+            regno += FP0_REGNUM;
+	}
+      
+      regcache_cooked_read (current_regcache, regno, reg);
       rav = extract_signed_integer (reg, 8);
 
       switch (op)

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

* Re: [RFA/alpha] Use correct register for FP branches in alpha_next_pc()
  2005-05-26 15:08 [RFA/alpha] Use correct register for FP branches in alpha_next_pc() Joel Brobecker
@ 2005-05-28 18:54 ` Daniel Jacobowitz
  2005-05-29  2:11   ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2005-05-28 18:54 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On Thu, May 26, 2005 at 04:37:35PM +1000, Joel Brobecker wrote:
> Blush... Obvious mistake ... 
> 
> I looked at the 18 failures I currently have when running the following
> testcase (not yet approved):
> 
>         http://sources.redhat.com/ml/gdb-patches/2005-05/msg00546.html
> 
> It turns out it was an obvious confusion between the register number
> embedded in the instruction, and hte register number as GDB knows it.
> Say for instance we have a conditional branch instruction on f16, right
> now we read register number 16, which is register a0, not f16! The fix
> I just committed seemed to be improving things, but only by chance :-/.
> With the attached patch, all tests now PASS.
> 
> 2005-05-26  Joel Brobecker  <brobecker@adacore.com>
> 
>         * alpha-tdep.c (alpha_next_pc): Use correct register number
>         for floating-point branch instructions.
> 
> Tested on alpha-tru64 5.1a. No regression, fixes all 18 failures
> observed in alpha-step.exp.
> 
> OK to apply?

This is OK.


-- 
Daniel Jacobowitz
CodeSourcery, LLC


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

* Re: [RFA/alpha] Use correct register for FP branches in alpha_next_pc()
  2005-05-28 18:54 ` Daniel Jacobowitz
@ 2005-05-29  2:11   ` Joel Brobecker
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2005-05-29  2:11 UTC (permalink / raw)
  To: gdb-patches

> > 2005-05-26  Joel Brobecker  <brobecker@adacore.com>
> > 
> >         * alpha-tdep.c (alpha_next_pc): Use correct register number
> >         for floating-point branch instructions.
> > 
> > Tested on alpha-tru64 5.1a. No regression, fixes all 18 failures
> > observed in alpha-step.exp.
> > 
> > OK to apply?
> 
> This is OK.

Thank you. Checked in.

-- 
Joel


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

end of thread, other threads:[~2005-05-29  1:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-26 15:08 [RFA/alpha] Use correct register for FP branches in alpha_next_pc() Joel Brobecker
2005-05-28 18:54 ` Daniel Jacobowitz
2005-05-29  2:11   ` Joel Brobecker

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