public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [commit, s390] Fix displaced stepping of LARL
@ 2011-11-30  8:35 Ulrich Weigand
  0 siblings, 0 replies; only message in thread
From: Ulrich Weigand @ 2011-11-30  8:35 UTC (permalink / raw)
  To: gdb-patches

Hello,

some non-stop tests were failing on s390 due to bugs in displaced
stepping fixup of the LARL instruction.  Fixed by the patch below.

Tested on s390x-ibm-linux, committed to mainline.

Bye,
Ulrich


ChangeLog:

	* s390-tdep.c (s390_displaced_step_fixup): Fix processing of LARL
	instruction.  Add more diagnostic output.


Index: gdb-head/gdb/s390-tdep.c
===================================================================
--- gdb-head.orig/gdb/s390-tdep.c
+++ gdb-head/gdb/s390-tdep.c
@@ -1370,9 +1370,9 @@ s390_displaced_step_fixup (struct gdbarc
 
   if (debug_displaced)
     fprintf_unfiltered (gdb_stdlog,
-			"displaced: (s390) fixup (%s, %s) pc %s amode 0x%x\n",
+			"displaced: (s390) fixup (%s, %s) pc %s len %d amode 0x%x\n",
 			paddress (gdbarch, from), paddress (gdbarch, to),
-			paddress (gdbarch, pc), (int) amode);
+			paddress (gdbarch, pc), insnlen, (int) amode);
 
   /* Handle absolute branch and save instructions.  */
   if (is_rr (insn, op_basr, &r1, &r2)
@@ -1428,9 +1428,11 @@ s390_displaced_step_fixup (struct gdbarc
   /* Handle LOAD ADDRESS RELATIVE LONG.  */
   else if (is_ril (insn, op1_larl, op2_larl, &r1, &i2))
     {
+      /* Update PC.  */
+      regcache_write_pc (regs, from + insnlen);
       /* Recompute output address in R1.  */ 
       regcache_cooked_write_unsigned (regs, S390_R0_REGNUM + r1,
-				      amode | (from + insnlen + i2*2));
+				      amode | (from + i2 * 2));
     }
 
   /* If we executed a breakpoint instruction, point PC right back at it.  */
@@ -1440,6 +1442,11 @@ s390_displaced_step_fixup (struct gdbarc
   /* For any other insn, PC points right after the original instruction.  */
   else
     regcache_write_pc (regs, from + insnlen);
+
+  if (debug_displaced)
+    fprintf_unfiltered (gdb_stdlog,
+			"displaced: (s390) pc is now %s\n",
+			paddress (gdbarch, regcache_read_pc (regs)));
 }
 
 /* Normal stack frames.  */
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-30  8:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-30  8:35 [commit, s390] Fix displaced stepping of LARL Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).