Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: New frame_cache_cleared observer.
@ 2015-03-25 17:11 Andrew Burgess
  2015-03-25 23:18 ` Doug Evans
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Burgess @ 2015-03-25 17:11 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

This adds a new observer for the frame cache cleared event.

While working on a new gdb port I found that I wanted to cache machine
state that was gathered as part of the register read process.  The
most appropriate time to discard this cached information is when the
frame cache is flushed.

However, as I don't have an actual use for this observer that I can
post upstream (yet) I don't know if this will be acceptable, but given
it's a fairly small change I thought I'd try.

OK to apply?

Thanks,
Andrew

---
This adds a new frame_cache_cleared observer.

gdb/ChangeLog:

	* frame.c (reinit_frame_cache): Trigger frame_cache_cleared
	observers.

gdb/doc/ChangeLog:

	* observer.texi (frame_cache_cleared): New event.
---
 gdb/ChangeLog         | 5 +++++
 gdb/doc/ChangeLog     | 4 ++++
 gdb/doc/observer.texi | 4 ++++
 gdb/frame.c           | 3 +++
 4 files changed, 16 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index febc377..6d5c757 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-25  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* frame.c (reinit_frame_cache): Trigger frame_cache_cleared
+	observers.
+
 2015-03-25  Pedro Alves  <palves@redhat.com>
 
 	* target.h <to_async>: Replace 'callback' and 'context' parameters
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 30d5a5b..b801f0c 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-25  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* observer.texi (frame_cache_cleared): New event.
+
 2015-03-24  Pedro Alves  <palves@redhat.com>
 
 	* gdb.texinfo (test_step) <set scheduler-locking step>: No longer
diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index fc3c74a..f33ecb4 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -122,6 +122,10 @@ A synchronous command finished.
 An error was caught while executing a command.
 @end deftypefun
 
+@deftypefun void frame_cache_cleared (void)
+The inferior has had its frame cached cleared.
+@end deftypefun
+
 @deftypefun void target_changed (struct target_ops *@var{target})
 The target's register contents have changed.
 @end deftypefun
diff --git a/gdb/frame.c b/gdb/frame.c
index b3cbf23..94e4f75 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1690,6 +1690,9 @@ reinit_frame_cache (void)
 {
   struct frame_info *fi;
 
+  /* Announce cache clearance before releasing memory.  */
+  observer_notify_frame_cache_cleared ();
+
   /* Tear down all frame caches.  */
   for (fi = current_frame; fi != NULL; fi = fi->prev)
     {
-- 
2.2.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-31 12:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25 17:11 [PATCH] gdb: New frame_cache_cleared observer Andrew Burgess
2015-03-25 23:18 ` Doug Evans
2015-03-26  9:24   ` Pedro Alves
2015-03-26 12:50     ` Andrew Burgess
2015-03-30 18:51       ` Doug Evans
2015-03-31 12:08         ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox