PPC fix for stfiwx instruction (and additional stores with primary opcode of 31)

Message ID 5116f3b47acca6ccc1ebd781e2693cc28ff45cbe.camel@us.ibm.com
State New
Headers show
Series
  • PPC fix for stfiwx instruction (and additional stores with primary opcode of 31)
Related show

Commit Message

Tom Tromey via Gdb-patches Oct. 11, 2021, 7:04 p.m.
GDB maintainers:

The PPC function ppc_process_record_op31 to record store instructions
iss recording the address in the wrong variable for the stfiwx
instruction (Store Floating-Point as Integer Word Indexed, secondary
opcode 983).  The function input argument addr is being recorded for
the stfiwx instruction rather then the calculated effective address
(ea) for the store instruction.  As a result, execution in the reverse
direction is not restoring the original value in memory for the
instruction.  

The issue also affects a number of other store instructions that use
the same call to  record_full_arch_list_add_mem () to record their
store address.

The following patch fixes the issue of the store address not being
recorded correctly.  This fixes the reverse execution failures in
tests:

gdb.reverse/until-precsave.exp 
gdb.reverse/until-reverse.exp 

Please let me know if the patch is acceptable for committing to
mainline.   Thanks.

                     Carl 


-------------------------------------------------
PPC fix for stfiwx instruction (and additional stores with primary opcode of 31)

GDB record function was recording the variable addr that was passed in
rather than the calculated effective address (ea) by the
ppc_process_record_op31 function.
---
 gdb/rs6000-tdep.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.30.2

Comments

Tom Tromey via Gdb-patches Oct. 13, 2021, 1:12 p.m. | #1
"Carl Love" <cel@us.ibm.com> wrote on 11.10.2021 21:04:47:

> PPC fix for stfiwx instruction (and additional stores with primary

> opcode of 31)

>

> GDB record function was recording the variable addr that was passed in

> rather than the calculated effective address (ea) by the

> ppc_process_record_op31 function.


This is OK.

Thanks,
Ulrich

Patch

diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 826f0266ed8..9c2bfca3e9c 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -4993,20 +4993,20 @@  ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
       switch (ext)
 	{
 	case 167:	/* Store Vector Element Halfword Indexed */
-	  addr = addr & ~0x1ULL;
+	  ea = ea & ~0x1ULL;
 	  break;
 
 	case 199:	/* Store Vector Element Word Indexed */
-	  addr = addr & ~0x3ULL;
+	  ea = ea & ~0x3ULL;
 	  break;
 
 	case 231:	/* Store Vector Indexed */
 	case 487:	/* Store Vector Indexed LRU */
-	  addr = addr & ~0xfULL;
+	  ea = ea & ~0xfULL;
 	  break;
 	}
 
-      record_full_arch_list_add_mem (addr, size);
+      record_full_arch_list_add_mem (ea, size);
       return 0;
 
     case 397:		/* Store VSX Vector with Length */