* inline-frame.c (find_inline_frame_state): Check for changed PC
authorDaniel Jacobowitz <drow@false.org>
Fri, 13 Nov 2009 23:00:17 +0000 (23:00 +0000)
committerDaniel Jacobowitz <drow@false.org>
Fri, 13 Nov 2009 23:00:17 +0000 (23:00 +0000)
here...
(inline_frame_sniffer): ... not here.

gdb/ChangeLog
gdb/inline-frame.c

index f6aa0cf9f1dea0015c232b5326fb8eb6acbc3209..29539b12e1e94703eeaff73ccbb1af53ddc7d7b5 100644 (file)
@@ -1,3 +1,9 @@
+2009-11-13  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * inline-frame.c (find_inline_frame_state): Check for changed PC
+       here...
+       (inline_frame_sniffer): ... not here.
+
 2009-11-13  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * ui-file.c (stdio_file_read): Call gdb_select before read.
index 9af88f44159521c7d6fe930414bbaa612f6336df..5408e88002edc7441bb5fce8e877224e4920bd53 100644 (file)
@@ -22,6 +22,7 @@
 #include "block.h"
 #include "frame-unwind.h"
 #include "inferior.h"
+#include "regcache.h"
 #include "symtab.h"
 #include "vec.h"
 
@@ -59,7 +60,8 @@ DEF_VEC_O(inline_state_s);
 
 static VEC(inline_state_s) *inline_states;
 
-/* Locate saved inlined frame state for PTID, if it exists.  */
+/* Locate saved inlined frame state for PTID, if it exists
+   and is valid.  */
 
 static struct inline_state *
 find_inline_frame_state (ptid_t ptid)
@@ -70,7 +72,19 @@ find_inline_frame_state (ptid_t ptid)
   for (ix = 0; VEC_iterate (inline_state_s, inline_states, ix, state); ix++)
     {
       if (ptid_equal (state->ptid, ptid))
-       return state;
+       {
+         struct regcache *regcache = get_thread_regcache (ptid);
+         CORE_ADDR current_pc = regcache_read_pc (regcache);
+         if (current_pc != state->saved_pc)
+           {
+             /* PC has changed - this context is invalid.  Use the
+                default behavior.  */
+             VEC_unordered_remove (inline_state_s, inline_states, ix);
+             return NULL;
+           }
+         else
+           return state;
+       }
     }
 
   return NULL;
@@ -225,13 +239,8 @@ inline_frame_sniffer (const struct frame_unwind *self,
      can be stepped into later).  */
   if (state != NULL && state->skipped_frames > 0 && next_frame == NULL)
     {
-      if (this_pc != state->saved_pc)
-       state->skipped_frames = 0;
-      else
-       {
-         gdb_assert (depth >= state->skipped_frames);
-         depth -= state->skipped_frames;
-       }
+      gdb_assert (depth >= state->skipped_frames);
+      depth -= state->skipped_frames;
     }
 
   /* If all the inlined functions here already have frames, then pass
This page took 0.199644 seconds and 4 git commands to generate.