Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gdb/dist/gdb sh_frame_cache always tries to re...



details:   https://anonhg.NetBSD.org/src/rev/da8850293258
branches:  trunk
changeset: 770777:da8850293258
user:      uwe <uwe%NetBSD.org@localhost>
date:      Tue Nov 01 21:47:53 2011 +0000

description:
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.

diffstat:

 external/gpl3/gdb/dist/gdb/sh-tdep.c |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (54 lines):

diff -r 10f1922ee223 -r da8850293258 external/gpl3/gdb/dist/gdb/sh-tdep.c
--- a/external/gpl3/gdb/dist/gdb/sh-tdep.c      Tue Nov 01 21:37:08 2011 +0000
+++ b/external/gpl3/gdb/dist/gdb/sh-tdep.c      Tue Nov 01 21:47:53 2011 +0000
@@ -521,11 +521,14 @@
 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 @@
        }
       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 @@
     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 @@
   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)
     {



Home | Main Index | Thread Index | Old Index