This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC] sh-tdep.c: Don't fetch FPSCR register if it doesn't exist
- From: Kevin Buettner <kevinb at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Thomas Schwinge <thomas at schwinge dot name>
- Date: Wed, 29 Feb 2012 17:34:08 -0700
- Subject: [RFC] sh-tdep.c: Don't fetch FPSCR register if it doesn't exist
The patch below fixes 119 failures for the default sh-elf multilib (using
sh-sim.) I can post a list if there's interest in seeing them.
Comments? Is there a better way to test for the existence of a register?
Kevin
* sh-tdep.c (sh_frame_cache): Don't fetch the FPSCR register
unless it exists for this architecture.
Index: sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.239
diff -u -p -r1.239 sh-tdep.c
--- sh-tdep.c 27 Feb 2012 16:40:48 -0000 1.239
+++ sh-tdep.c 1 Mar 2012 00:31:31 -0000
@@ -2553,7 +2553,12 @@ sh_frame_cache (struct frame_info *this_
if (cache->pc != 0)
{
ULONGEST fpscr;
- fpscr = get_frame_register_unsigned (this_frame, FPSCR_REGNUM);
+ const char *fpscr_name = gdbarch_register_name (gdbarch, FPSCR_REGNUM);
+
+ if (fpscr_name && fpscr_name[0])
+ fpscr = get_frame_register_unsigned (this_frame, FPSCR_REGNUM);
+ else
+ fpscr = 0;
sh_analyze_prologue (gdbarch, cache->pc, current_pc, cache, fpscr);
}