This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit, arm] Fix single-step failures in Thumb mode


Hello,

I ran into problems single-stepping though the Thumb version of __divsf3,
because thumb_get_next_pc_raw neglected to handle the Thumb-16 encoding
of a "mov pc, REG" instruction.

Fixed by the patch below, which also fixes the corresponding place in
thumb_instruction_changes_pc.

Tested on armv7l-linux-gnueabi.  Fixes the following regressions where
libc debuginfo is unavailable:

FAIL: gdb.base/gdb1555.exp: Step into shared lib function (the program exited)
FAIL: gdb.base/gdb1555.exp: Next while in a shared lib function (the program is no longer running)
FAIL: gdb.base/step-test.exp: large struct by value (the program exited)
FAIL: gdb.base/step-test.exp: continue until exit at step-test.exp (the program is no longer running)

Committed to mainline as obvious.

Bye,
Ulrich


ChangeLog:

	* arm-tdep.c (thumb_get_next_pc_raw): Handle Thumb-16 encoding
	for "mov pc, REG" as well.
	(thumb_instruction_changes_pc): Likewise.

Index: gdb/arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.310
diff -u -p -r1.310 arm-tdep.c
--- gdb/arm-tdep.c	12 Oct 2010 08:46:15 -0000	1.310
+++ gdb/arm-tdep.c	19 Oct 2010 17:26:49 -0000
@@ -537,6 +541,9 @@ thumb_instruction_changes_pc (unsigned s
   if ((inst & 0xff00) == 0x4700)	/* bx REG, blx REG */
     return 1;
 
+  if ((inst & 0xff87) == 0x4687)	/* mov pc, REG */
+    return 1;
+
   if ((inst & 0xf500) == 0xb100)	/* CBNZ or CBZ.  */
     return 1;
 
@@ -3572,6 +4210,15 @@ thumb_get_next_pc_raw (struct frame_info
       else
 	nextpc = get_frame_register_unsigned (frame, bits (inst1, 3, 6));
     }
+  else if ((inst1 & 0xff87) == 0x4687)	/* mov pc, REG */
+    {
+      if (bits (inst1, 3, 6) == 0x0f)
+	nextpc = pc_val;
+      else
+	nextpc = get_frame_register_unsigned (frame, bits (inst1, 3, 6));
+
+      nextpc = MAKE_THUMB_ADDR (nextpc);
+    }
   else if ((inst1 & 0xf500) == 0xb100)
     {
       /* CBNZ or CBZ.  */
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]