Blame SOURCES/gdb-rhbz1903375-s390x-store-on-condition.patch

405ea9
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
405ea9
From: Andreas Arnez <arnez@linux.ibm.com>
405ea9
Date: Thu, 19 Nov 2020 19:10:58 +0100
405ea9
Subject: gdb-rhbz1903375-s390x-store-on-condition.patch
405ea9
405ea9
;; Backport of "Correct recording of 'store on condition' insns"
405ea9
;; Andreas Arnaz (RH BZ 1903374)
405ea9
405ea9
gdb/s390: Correct recording of "store on condition" insns
405ea9
405ea9
The "store on condition" instructions STOC, STOCG, and STOCFH are recorded
405ea9
as if their instruction formats resembled that of STG.  This is wrong,
405ea9
usually resulting in "failed to record execution log" errors when trying
405ea9
to record code with any of these instructions.
405ea9
405ea9
This patch fixes the recording of these instructions.
405ea9
405ea9
gdb/ChangeLog:
405ea9
405ea9
	PR tdep/26916
405ea9
	* s390-tdep.c (s390_process_record): Fix recording of STOC, STOCG,
405ea9
	and STOCFH.
405ea9
405ea9
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
405ea9
--- a/gdb/s390-tdep.c
405ea9
+++ b/gdb/s390-tdep.c
405ea9
@@ -5382,7 +5382,6 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
405ea9
 	case 0xe325: /* NTSTG - nontransactional store */
405ea9
 	case 0xe326: /* CVDY - convert to decimal */
405ea9
 	case 0xe32f: /* STRVG - store reversed */
405ea9
-	case 0xebe3: /* STOCG - store on condition */
405ea9
 	case 0xed67: /* STDY - store */
405ea9
 	  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
405ea9
 	  if (record_full_arch_list_add_mem (oaddr, 8))
405ea9
@@ -5411,8 +5410,6 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
405ea9
 	case 0xe33e: /* STRV - store reversed */
405ea9
 	case 0xe350: /* STY - store */
405ea9
 	case 0xe3cb: /* STFH - store high */
405ea9
-	case 0xebe1: /* STOCFH - store high on condition */
405ea9
-	case 0xebf3: /* STOC - store on condition */
405ea9
 	case 0xed66: /* STEY - store */
405ea9
 	  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
405ea9
 	  if (record_full_arch_list_add_mem (oaddr, 4))
405ea9
@@ -6125,6 +6122,20 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
405ea9
 
405ea9
 	/* 0xeb9c-0xebbf undefined */
405ea9
 	/* 0xebc1-0xebdb undefined */
405ea9
+
405ea9
+	case 0xebe1: /* STOCFH - store high on condition */
405ea9
+	case 0xebf3: /* STOC - store on condition */
405ea9
+	  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
405ea9
+	  if (record_full_arch_list_add_mem (oaddr, 4))
405ea9
+	    return -1;
405ea9
+	  break;
405ea9
+
405ea9
+	case 0xebe3: /* STOCG - store on condition */
405ea9
+	  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
405ea9
+	  if (record_full_arch_list_add_mem (oaddr, 8))
405ea9
+	    return -1;
405ea9
+	  break;
405ea9
+
405ea9
 	/* 0xebe5 undefined */
405ea9
 	/* 0xebe9 undefined */
405ea9
 	/* 0xebeb-0xebf1 undefined */