This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/3] Add a frame_changed observer


---
 ChangeLog             | 2 ++
 gdb/doc/observer.texi | 5 +++++
 gdb/frame.c           | 6 ++++++
 3 files changed, 13 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 7868e85..0ee72e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,8 @@
 	* thread.c: Idem.
 	* valops.c: Idem.
 	* varobj.c: Idem.
+	* doc/observer.texi: add a frame_changed observer
+	* frame.c: Idem
 
 2013-04-29  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
 
diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index adb7085..63523ad 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -105,6 +105,11 @@ been modified since being loaded by the debugger (by being recompiled,
 for instance).
 @end deftypefun
 
+@deftypefun void frame_changed (struct frame_info *@var{frame})
+the selected frame has changed in a user-visible way. @var{frame}
+is the new frame.
+@end deftypefun
+
 @deftypefun void inferior_created (struct target_ops *@var{objfile}, int @var{from_tty})
 @value{GDBN} has just connected to an inferior.  For @samp{run},
 @value{GDBN} calls this observer while the inferior is still stopped
diff --git a/gdb/frame.c b/gdb/frame.c
index 0a0acda..0e21e33 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1414,6 +1414,9 @@ deprecated_safe_get_selected_frame (void)
 void
 select_frame (struct frame_info *fi, enum select_frame_reason reason)
 {
+  int changed = (reason == REASON_USER || reason == REASON_STOP)
+                && (fi != selected_frame);
+
   selected_frame = fi;
   /* NOTE: cagney/2002-05-04: FI can be NULL.  This occurs when the
      frame is being invalidated.  */
@@ -1453,6 +1456,9 @@ select_frame (struct frame_info *fi, enum select_frame_reason reason)
 	    set_language (s->language);
 	}
     }
+
+    if (changed)
+      observer_notify_frame_changed (fi);
 }
 
 /* Create an arbitrary (i.e. address specified by user) or innermost frame.
-- 
1.8.2.1



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]