Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Maxime Coste <frrrwww@gmail.com>
To: gdb-patches@sourceware.org
Cc: Maxime Coste <frrrwww@gmail.com>
Subject: [PATCH 2/3] Add a frame_changed observer
Date: Fri, 26 Apr 2013 21:10:00 -0000	[thread overview]
Message-ID: <1367002961-12311-3-git-send-email-frrrwww@gmail.com> (raw)
In-Reply-To: <1367002961-12311-1-git-send-email-frrrwww@gmail.com>

---
 gdb/doc/observer.texi | 4 ++++
 gdb/frame.c           | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index adb7085..9653d6b 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -105,6 +105,10 @@ 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;
+@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



  parent reply	other threads:[~2013-04-26 19:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 21:07 Add a python event registry for selected frame changes Maxime Coste
2013-04-26 21:09 ` [PATCH 1/3] Add a select_frame_reason enum parameter to select_frame Maxime Coste
2013-04-30 11:05   ` Tom Tromey
2013-04-30 11:53     ` Joel Brobecker
2013-05-06 16:54     ` Pedro Alves
2013-05-10 19:50       ` Tom Tromey
2013-05-14 13:23       ` Maxime Coste
2013-04-26 21:10 ` Maxime Coste [this message]
2013-04-30 10:51   ` [PATCH 2/3] Add a frame_changed observer Tom Tromey
2013-04-27  7:55 ` [PATCH 3/3] Add a gdb.events.frame_change event registry Maxime Coste
2013-04-30 11:07   ` Tom Tromey
2013-04-30 11:09     ` Tom Tromey
2013-04-30 10:53 ` Add a python event registry for selected frame changes Tom Tromey
2013-04-30 23:29   ` Maxime Coste

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367002961-12311-3-git-send-email-frrrwww@gmail.com \
    --to=frrrwww@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox