From 3a8356ffac809056cb3650c50a00f4adb30cc147 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Mon, 21 Oct 2013 16:31:17 +0800 Subject: [PATCH] Add REGISTRY for struct address_space. This patch adds REGISTRY for struct address_space. gdb: 2013-11-20 Yao Qi * progspace.c (struct address_space): Update comments. : 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 | 9 +++++++++ gdb/progspace.c | 18 ++++++++++++++---- gdb/progspace.h | 5 +++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 13622954ef2..e8df902bffa 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2013-11-20 Yao Qi + + * progspace.c (struct address_space): Update comments. + : 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 * Makefile.in (SFILES):Add target-dcache.c. diff --git a/gdb/progspace.c b/gdb/progspace.c index 6e7221122e5..303e88e0754 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -44,17 +44,25 @@ static int highest_address_space_num; DEFINE_REGISTRY (program_space, REGISTRY_ACCESS_FIELD) - - -/* 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) + + + /* 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); } diff --git a/gdb/progspace.h b/gdb/progspace.h index f24a5697d3d..04ac3741ca8 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -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 -- 2.30.2