This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[committed] MIPS/Linux: Use common MIPS code to write the PC
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Fri, 18 May 2012 13:43:14 +0100
- Subject: [committed] MIPS/Linux: Use common MIPS code to write the PC
Hello,
In the process of investigating ISA bit Linux results I have discovered
that the MIPS/Linux backend replaces the common MIPS handler used to write
the PC with a private own one. This stops the ISA bit from being set
correctly and causes about 1100 failures in the test suite per each MIPS16
and microMIPS multilib.
This requirement to set the bit will be going away with the proposed
change, however I think the MIPS/Linux should still refer to common MIPS
code regardless and only make any extra steps itself. The change below
implements that.
No regressions for mips-sde-elf or mips-linux-gnu, o32/MIPS, o32/MIPS16,
o32/microMIPS and n64 ABIs plus these 1100 progressions for Linux
o32/MIPS16 and o32/microMIPS each (per endianness).
I have applied this change now.
2012-05-18 Maciej W. Rozycki <macro@codesourcery.com>
gdb/
* mips-tdep.h (mips_write_pc): New prototype.
* mips-tdep.c (mips_write_pc): Make external, add description.
* mips-linux-tdep.c (mips_linux_write_pc): Use mips_write_pc,
add description.
Maciej
gdb-mips16-linux-write-pc.diff
Index: gdb-fsf-trunk-quilt/gdb/mips-linux-tdep.c
===================================================================
--- gdb-fsf-trunk-quilt.orig/gdb/mips-linux-tdep.c 2012-05-18 12:10:15.375560448 +0100
+++ gdb-fsf-trunk-quilt/gdb/mips-linux-tdep.c 2012-05-18 13:25:45.075635420 +0100
@@ -1151,11 +1151,14 @@ mips_linux_n32n64_sigframe_init (const s
trad_frame_set_id (this_cache, frame_id_build (frame_sp, func));
}
+/* Implement the "write_pc" gdbarch method. */
+
static void
mips_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
- regcache_cooked_write_unsigned (regcache, gdbarch_pc_regnum (gdbarch), pc);
+
+ mips_write_pc (regcache, pc);
/* Clear the syscall restart flag. */
if (mips_linux_restart_reg_p (gdbarch))
Index: gdb-fsf-trunk-quilt/gdb/mips-tdep.c
===================================================================
--- gdb-fsf-trunk-quilt.orig/gdb/mips-tdep.c 2012-05-18 13:21:58.755610226 +0100
+++ gdb-fsf-trunk-quilt/gdb/mips-tdep.c 2012-05-18 13:25:45.075635420 +0100
@@ -1141,7 +1141,9 @@ mips_dummy_id (struct gdbarch *gdbarch,
get_frame_pc (this_frame));
}
-static void
+/* Implement the "write_pc" gdbarch method. */
+
+void
mips_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
int regnum = gdbarch_pc_regnum (get_regcache_arch (regcache));
Index: gdb-fsf-trunk-quilt/gdb/mips-tdep.h
===================================================================
--- gdb-fsf-trunk-quilt.orig/gdb/mips-tdep.h 2012-05-18 12:10:15.505565737 +0100
+++ gdb-fsf-trunk-quilt/gdb/mips-tdep.h 2012-05-18 13:25:45.075635420 +0100
@@ -159,6 +159,9 @@ extern int mips_pc_is_mips16 (bfd_vma me
/* Return the currently configured (or set) saved register size. */
extern unsigned int mips_abi_regsize (struct gdbarch *gdbarch);
+/* Make PC the address of the next instruction to execute. */
+extern void mips_write_pc (struct regcache *regcache, CORE_ADDR pc);
+
/* Target descriptions which only indicate the size of general
registers. */
extern struct target_desc *mips_tdesc_gp32;