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/8] Types GC [preserve_values as observer]


Hi,

simplify preserve_values invocation by using the observer from patch 1/8.


Thanks,
Jan

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

	* objfiles.c (free_objfile): Remove preserve_values.
	* symfile.c (reread_symbols): Likewise.
	* value.c: Include observer.h.
	(preserve_values): Define the function as static.
	(_initialize_values): Register preserve_values as an observer.
	* value.h (preserve_values): Remove the declaration.
---
 gdb/objfiles.c |    3 ---
 gdb/symfile.c  |    1 -
 gdb/value.c    |    5 ++++-
 gdb/value.h    |    2 --
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 42174e9..36a123c 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -407,9 +407,6 @@ free_objfile (struct objfile *objfile)
       objfile->separate_debug_objfile_backlink->separate_debug_objfile = NULL;
     }
   
-  /* 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);
 
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 0481ae1..06e8c6e 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2333,7 +2333,6 @@ 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
diff --git a/gdb/value.c b/gdb/value.c
index 9c08a41..e6b99fc 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -38,6 +38,7 @@
 #include "objfiles.h"
 #include "valprint.h"
 #include "cli/cli-decode.h"
+#include "observer.h"
 
 #include "python/python.h"
 
@@ -1177,7 +1178,7 @@ preserve_one_value (struct value *value, struct objfile *objfile,
    this objfile's types, and the convenience variables will be adjusted to
    use the new global types.  */
 
-void
+static void
 preserve_values (struct objfile *objfile)
 {
   htab_t copied_types;
@@ -2049,4 +2050,6 @@ Placeholder command for showing help on convenience functions."),
   TYPE_CODE (internal_fn_type) = TYPE_CODE_INTERNAL_FUNCTION;
   TYPE_LENGTH (internal_fn_type) = sizeof (struct internal_function *);
   TYPE_NAME (internal_fn_type) = "<internal function>";
+
+  observer_attach_objfile_unloading (preserve_values);
 }
diff --git a/gdb/value.h b/gdb/value.h
index 69a59a2..a397647 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -641,8 +641,6 @@ extern void typedef_print (struct type *type, struct symbol *news,
 
 extern char *internalvar_name (struct internalvar *var);
 
-extern void preserve_values (struct objfile *);
-
 /* From values.c */
 
 extern struct value *value_copy (struct value *);
-- 
1.6.2.2


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