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 1/8] Types GC [unloading observer]


Hi,

prepare hooks primarily for varobj_invalidate rewrite.  They also get reused at
other GDB places.


Thanks,
Jan

gdb/doc/
2009-05-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* observer.texi (objfile_unloading, objfile_unloaded): New.

gdb/
2009-05-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* objfiles.c: Include observer.h.
	(free_objfile): Call observer_notify_objfile_unloading.
	* symfile.c (new_symfile_objfile): Call
	observer_notify_objfile_unloaded.
	(reread_symbols): Call observer_notify_objfile_unloading and
	observer_notify_objfile_unloaded.
---
 gdb/doc/observer.texi |    9 +++++++++
 gdb/objfiles.c        |    3 +++
 gdb/symfile.c         |    7 +++++++
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index 4984f31..0aecd6d 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -130,6 +130,15 @@ Called with @var{objfile} equal to @code{NULL} to indicate
 previously loaded symbol table data has now been invalidated.
 @end deftypefun
 
+@deftypefun void objfile_unloading (struct objfile *@var{objfile})
+The file specified by @var{objfile} is going to be removed from @value{GDBN}.
+@end deftypefun
+
+@deftypefun void objfile_unloaded (void)
+Removal of @var{objfile} started by @code{objfile_unloading} has finished and
+@var{objfile} is no longer known to @value{GDBN}.
+@end deftypefun
+
 @deftypefun void new_thread (struct thread_info *@var{t})
 The thread specified by @var{t} has been created.
 @end deftypefun
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 30a4313..42174e9 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -50,6 +50,7 @@
 #include "addrmap.h"
 #include "arch-utils.h"
 #include "exec.h"
+#include "observer.h"
 
 /* Prototypes for local functions */
 
@@ -409,6 +410,8 @@ free_objfile (struct objfile *objfile)
   /* Remove any references to this objfile in the global value
      lists.  */
   preserve_values (objfile);
+  /* Remove any references to this objfile in the global value lists.  */
+  observer_notify_objfile_unloading (objfile);
 
   /* First do any symbol file specific actions required when we are
      finished with a particular symbol file.  Note that if the objfile
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 4b8a576..0481ae1 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -926,6 +926,9 @@ new_symfile_objfile (struct objfile *objfile, int mainline, int verbo)
 
   /* We're done reading the symbol file; finish off complaints.  */
   clear_complaints (&symfile_complaints, 0, verbo);
+
+  /* We have finished unloading of OBJFILE.  */
+  observer_notify_objfile_unloaded ();
 }
 
 /* Process a symbol file, as either the main file or as a dynamically
@@ -2331,6 +2334,7 @@ reread_symbols (void)
 	      /* Remove any references to this objfile in the global
 		 value lists.  */
 	      preserve_values (objfile);
+	      observer_notify_objfile_unloading (objfile);
 
 	      /* Nuke all the state that we will re-read.  Much of the following
 	         code which sets things to NULL really is necessary to tell
@@ -2428,6 +2432,9 @@ reread_symbols (void)
 
 	      reinit_frame_cache ();
 
+	      /* We have finished reloading of OBJFILE.  */
+	      observer_notify_objfile_unloaded ();
+
 	      /* Discard cleanups as symbol reading was successful.  */
 	      discard_cleanups (old_cleanups);
 
-- 
1.6.2.2


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