From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17550 invoked by alias); 23 Oct 2013 08:29:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 17484 invoked by uid 89); 23 Oct 2013 08:29:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Oct 2013 08:29:11 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VYtoR-0006VW-Os from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 23 Oct 2013 01:29:07 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 23 Oct 2013 01:29:07 -0700 Received: from qiyao.dyndns.dyndns.org (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Wed, 23 Oct 2013 01:29:06 -0700 From: Yao Qi To: Subject: [PATCH 1/5] Add REGISTRY for struct address_space. Date: Wed, 23 Oct 2013 08:29:00 -0000 Message-ID: <1382516855-32218-2-git-send-email-yao@codesourcery.com> In-Reply-To: <1382516855-32218-1-git-send-email-yao@codesourcery.com> References: <1382516855-32218-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00710.txt.bz2 This patch adds REGISTRY for struct address_space. gdb: 2013-10-23 Yao Qi * progspace.c: DEFINE_REGISTRY for address_space. (new_address_space): Call address_space_alloc_data. (free_address_space): Call address_space_free_data. (struct address_space): Move it to ... * progspace.h: ... here. (struct address_space) : New. Use DECLARE_REGISTRY. --- gdb/progspace.c | 14 ++++++-------- gdb/progspace.h | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/gdb/progspace.c b/gdb/progspace.c index 6e72211..b9b32dd 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -44,16 +44,12 @@ static int highest_address_space_num; DEFINE_REGISTRY (program_space, REGISTRY_ACCESS_FIELD) - +/* Keep a registry of per-address_space data-pointers required by other GDB + modules. */ -/* An address space. Currently this is not used for much other than - for comparing if pspaces/inferior/threads see the same address - space. */ +DEFINE_REGISTRY (address_space, REGISTRY_ACCESS_FIELD) -struct address_space -{ - int num; -}; + /* Create a new address space object, and add it to the list. */ @@ -64,6 +60,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 +86,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 f24a569..3735202 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -31,7 +31,6 @@ struct bfd; struct objfile; struct inferior; struct exec; -struct address_space; struct program_space_data; typedef struct so_list *so_list_ptr; @@ -131,6 +130,18 @@ DEF_VEC_P (so_list_ptr); (traditional unix/uClinux), or, in the DICOS case, the address space bound to the program space is mostly ignored. */ +/* 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; +}; + /* The program space structure. */ struct program_space @@ -304,4 +315,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 -- 1.7.7.6