Module Name:    src
Committed By:   uwe
Date:           Tue Nov  1 21:47:53 UTC 2011

Modified Files:
        src/external/gpl3/gdb/dist/gdb: sh-tdep.c

Log Message:
sh_frame_cache always tries to read FPSCR.  Since frame.c uses gdb
exceptions now, there's an unplesant side effect that when FPSCR is
unavailable, your last display will get disabled just in case, "to
avoid infinite recursion".  That happens directly in throw_exception,
so even catching that NOT_AVAILABLE_ERROR doesn't help.

Tweak the code a bit so that sh_analyze_prologue only reads FPSCR as
needed, when an FMOV instruction is encountered in the prologue.

XXX: I'm not sure if this is the right thing to do, but it seems
minimally intrusive.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sh-tdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/sh-tdep.c
diff -u src/external/gpl3/gdb/dist/gdb/sh-tdep.c:1.1.1.1 src/external/gpl3/gdb/dist/gdb/sh-tdep.c:1.2
--- src/external/gpl3/gdb/dist/gdb/sh-tdep.c:1.1.1.1	Sat Sep 24 20:12:21 2011
+++ src/external/gpl3/gdb/dist/gdb/sh-tdep.c	Tue Nov  1 21:47:53 2011
@@ -521,11 +521,14 @@ sh_breakpoint_from_pc (struct gdbarch *g
 static CORE_ADDR
 sh_analyze_prologue (struct gdbarch *gdbarch,
 		     CORE_ADDR pc, CORE_ADDR current_pc,
-		     struct sh_frame_cache *cache, ULONGEST fpscr)
+		     struct sh_frame_cache *cache,
+		     struct frame_info *fpscr_frame)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST inst;
   CORE_ADDR opc;
+  ULONGEST fpscr = 0;
+  int have_fpscr = (fpscr_frame == NULL);
   int offset;
   int sav_offset = 0;
   int r3_val = 0;
@@ -631,6 +634,12 @@ sh_analyze_prologue (struct gdbarch *gdb
 	}
       else if (IS_FPUSH (inst))
 	{
+	  if (!have_fpscr)
+	    {
+	      fpscr = get_frame_register_unsigned (fpscr_frame, FPSCR_REGNUM);
+	      have_fpscr = 1;
+	    }
+
 	  if (fpscr & FPSCR_SZ)
 	    {
 	      cache->sp_offset += 8;
@@ -745,7 +754,7 @@ sh_skip_prologue (struct gdbarch *gdbarc
     return max (pc, start_pc);
 
   cache.sp_offset = -4;
-  pc = sh_analyze_prologue (gdbarch, start_pc, (CORE_ADDR) -1, &cache, 0);
+  pc = sh_analyze_prologue (gdbarch, start_pc, (CORE_ADDR) -1, &cache, NULL);
   if (!cache.uses_fp)
     return start_pc;
 
@@ -2563,11 +2572,7 @@ sh_frame_cache (struct frame_info *this_
   cache->pc = get_frame_func (this_frame);
   current_pc = get_frame_pc (this_frame);
   if (cache->pc != 0)
-    {
-      ULONGEST fpscr;
-      fpscr = get_frame_register_unsigned (this_frame, FPSCR_REGNUM);
-      sh_analyze_prologue (gdbarch, cache->pc, current_pc, cache, fpscr);
-    }
+    sh_analyze_prologue (gdbarch, cache->pc, current_pc, cache, this_frame);
 
   if (!cache->uses_fp)
     {

Reply via email to