Add REGISTRY for struct address_space.
authorYao Qi <yao@codesourcery.com>
Mon, 21 Oct 2013 08:31:17 +0000 (16:31 +0800)
committerYao Qi <yao@codesourcery.com>
Wed, 20 Nov 2013 04:41:25 +0000 (12:41 +0800)
This patch adds REGISTRY for struct address_space.

gdb:

2013-11-20  Yao Qi  <yao@codesourcery.com>

* progspace.c (struct address_space): Update comments.
<REGISTRY_FIELDS>: New fields.
DEFINE_REGISTRY for address_space.
(new_address_space): Call address_space_alloc_data.
(free_address_space): Call address_space_free_data.
* progspace.h: Use DECLARE_REGISTRY.

gdb/ChangeLog
gdb/progspace.c
gdb/progspace.h

index 13622954ef2fc7940d00331fdf0063bdada3edc4..e8df902bffaae20ef3001c3ee424ae9e00f931c4 100644 (file)
@@ -1,3 +1,12 @@
+2013-11-20  Yao Qi  <yao@codesourcery.com>
+
+       * progspace.c (struct address_space): Update comments.
+       <REGISTRY_FIELDS>: New fields.
+       DEFINE_REGISTRY for address_space.
+       (new_address_space): Call address_space_alloc_data.
+       (free_address_space): Call address_space_free_data.
+       * progspace.h: Use DECLARE_REGISTRY.
+
 2013-11-20  Yao Qi  <yao@codesourcery.com>
 
        * Makefile.in (SFILES):Add target-dcache.c.
index 6e7221122e53ae3baff49f364a25b3c2abdd1da1..303e88e075480f22be2653c332240e19d4102d73 100644 (file)
@@ -44,17 +44,25 @@ static int highest_address_space_num;
 
 DEFINE_REGISTRY (program_space, REGISTRY_ACCESS_FIELD)
 
-\f
-
-/* An address space.  Currently this is not used for much other than
-   for comparing if pspaces/inferior/threads see the same address
+/* An address space.  It is used for comparing if pspaces/inferior/threads
+   see the same address space and for associating caches to each address
    space.  */
 
 struct address_space
 {
   int num;
+
+  /* Per aspace data-pointers required by other GDB modules.  */
+  REGISTRY_FIELDS;
 };
 
+/* Keep a registry of per-address_space data-pointers required by other GDB
+   modules.  */
+
+DEFINE_REGISTRY (address_space, REGISTRY_ACCESS_FIELD)
+
+\f
+
 /* Create a new address space object, and add it to the list.  */
 
 struct address_space *
@@ -64,6 +72,7 @@ new_address_space (void)
 
   aspace = XZALLOC (struct address_space);
   aspace->num = ++highest_address_space_num;
+  address_space_alloc_data (aspace);
 
   return aspace;
 }
@@ -89,6 +98,7 @@ maybe_new_address_space (void)
 static void
 free_address_space (struct address_space *aspace)
 {
+  address_space_free_data (aspace);
   xfree (aspace);
 }
 
index f24a5697d3d0edca08522dd2000adbbc66f93976..04ac3741ca8aa1c3a77de834dab90c021d230a29 100644 (file)
@@ -304,4 +304,9 @@ extern void clear_program_space_solib_cache (struct program_space *);
 
 DECLARE_REGISTRY (program_space);
 
+/* Keep a registry of per-aspace data-pointers required by other GDB
+   modules.  */
+
+DECLARE_REGISTRY (address_space);
+
 #endif