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

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