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

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