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

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