From patchwork Thu Nov 13 12:54:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 3701 Received: (qmail 10587 invoked by alias); 13 Nov 2014 12:55:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 10551 invoked by uid 89); 13 Nov 2014 12:55:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f52.google.com Received: from mail-pa0-f52.google.com (HELO mail-pa0-f52.google.com) (209.85.220.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 13 Nov 2014 12:55:32 +0000 Received: by mail-pa0-f52.google.com with SMTP id fa1so15220943pad.11 for ; Thu, 13 Nov 2014 04:55:31 -0800 (PST) X-Received: by 10.70.94.197 with SMTP id de5mr1774753pdb.161.1415883330939; Thu, 13 Nov 2014 04:55:30 -0800 (PST) Received: from sspiff.org (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by mx.google.com with ESMTPSA id ir2sm24800059pbc.57.2014.11.13.04.55.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Nov 2014 04:55:30 -0800 (PST) Message-ID: <5464aa42.22c5440a.14f0.ffff8d3f@mx.google.com> Received: by sspiff.org (sSMTP sendmail emulation); Thu, 13 Nov 2014 04:54:38 -0800 Date: Thu, 13 Nov 2014 04:54:38 -0800 From: Doug Evans To: gdb-patches@sourceware.org Subject: [PATCH 02/21] struct symtab split part 2: objfiles.c objfiles.h X-IsSubscribed: yes This patch contains the changes to objfiles.c, objfiles.h. Full ChangeLog: https://sourceware.org/ml/gdb-patches/2014-11/msg00233.html 2014-11-12 Doug Evans * objfiles.c (objfile_relocate1): Loop over blockvectors in a separate loop. * objfiles.h (struct objfile) : Renamed from symtabs. Change type to "struct compunit_symtab *". All uses updated. (ALL_OBJFILE_FILETABS): Renamed from ALL_OBJFILE_SYMTABS. All uses updated. (ALL_OBJFILE_COMPUNITS): Renamed from ALL_OBJFILE_PRIMARY_SYMTABS. All uses updated. (ALL_FILETABS): Renamed from ALL_SYMTABS. All uses updated. (ALL_COMPUNITS): Renamed from ALL_PRIMARY_SYMTABS. All uses updated. diff --git a/gdb/objfiles.c b/gdb/objfiles.c index cbe1b8c..5878add 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -740,12 +740,12 @@ objfile_relocate1 (struct objfile *objfile, /* OK, get all the symtabs. */ { + struct compunit_symtab *cust; struct symtab *s; - ALL_OBJFILE_SYMTABS (objfile, s) + ALL_OBJFILE_FILETABS (objfile, cust, s) { struct linetable *l; - const struct blockvector *bv; int i; /* First the line table. */ @@ -753,17 +753,20 @@ objfile_relocate1 (struct objfile *objfile, if (l) { for (i = 0; i < l->nitems; ++i) - l->item[i].pc += ANOFFSET (delta, s->block_line_section); + l->item[i].pc += ANOFFSET (delta, + COMPUNIT_BLOCK_LINE_SECTION + (cust)); } + } - /* Don't relocate a shared blockvector more than once. */ - if (!s->primary) - continue; + ALL_OBJFILE_COMPUNITS (objfile, cust) + { + const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust); + int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust); - bv = SYMTAB_BLOCKVECTOR (s); if (BLOCKVECTOR_MAP (bv)) addrmap_relocate (BLOCKVECTOR_MAP (bv), - ANOFFSET (delta, s->block_line_section)); + ANOFFSET (delta, block_line_section)); for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i) { @@ -772,8 +775,8 @@ objfile_relocate1 (struct objfile *objfile, struct dict_iterator iter; b = BLOCKVECTOR_BLOCK (bv, i); - BLOCK_START (b) += ANOFFSET (delta, s->block_line_section); - BLOCK_END (b) += ANOFFSET (delta, s->block_line_section); + BLOCK_START (b) += ANOFFSET (delta, block_line_section); + BLOCK_END (b) += ANOFFSET (delta, block_line_section); /* We only want to iterate over the local symbols, not any symbols in included symtabs. */ @@ -939,7 +942,7 @@ objfile_has_partial_symbols (struct objfile *objfile) int objfile_has_full_symbols (struct objfile *objfile) { - return objfile->symtabs != NULL; + return objfile->compunit_symtabs != NULL; } /* Return non-zero if OBJFILE has full or partial symbols, either directly diff --git a/gdb/objfiles.h b/gdb/objfiles.h index b14aab0..a888311 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -28,7 +28,6 @@ struct bcache; struct htab; -struct symtab; struct objfile_data; /* This structure maintains information on a per-objfile basis about the @@ -286,11 +285,10 @@ struct objfile struct program_space *pspace; - /* Each objfile points to a linked list of symtabs derived from this file, - one symtab structure for each compilation unit (source file). Each link - in the symtab list contains a backpointer to this objfile. */ + /* List of compunits. + These are used to do symbol lookups and file/line-number lookups. */ - struct symtab *symtabs; + struct compunit_symtab *compunit_symtabs; /* Each objfile points to a linked list of partial symtabs derived from this file, one partial symtab structure for each compilation unit @@ -590,14 +588,14 @@ extern void default_iterate_over_objfiles_in_search_order /* Traverse all symtabs in one objfile. */ -#define ALL_OBJFILE_SYMTABS(objfile, s) \ - for ((s) = (objfile) -> symtabs; (s) != NULL; (s) = (s) -> next) +#define ALL_OBJFILE_FILETABS(objfile, cu, s) \ + ALL_OBJFILE_COMPUNITS (objfile, cu) \ + ALL_COMPUNIT_FILETABS (cu, s) -/* Traverse all primary symtabs in one objfile. */ +/* Traverse all compunits in one objfile. */ -#define ALL_OBJFILE_PRIMARY_SYMTABS(objfile, s) \ - ALL_OBJFILE_SYMTABS ((objfile), (s)) \ - if ((s)->primary) +#define ALL_OBJFILE_COMPUNITS(objfile, cu) \ + for ((cu) = (objfile) -> compunit_symtabs; (cu) != NULL; (cu) = (cu) -> next) /* Traverse all minimal symbols in one objfile. */ @@ -609,17 +607,15 @@ extern void default_iterate_over_objfiles_in_search_order /* Traverse all symtabs in all objfiles in the current symbol space. */ -#define ALL_SYMTABS(objfile, s) \ - ALL_OBJFILES (objfile) \ - ALL_OBJFILE_SYMTABS (objfile, s) +#define ALL_FILETABS(objfile, ps, s) \ + ALL_OBJFILES (objfile) \ + ALL_OBJFILE_FILETABS (objfile, ps, s) -/* Traverse all symtabs in all objfiles in the current program space, - skipping included files (which share a blockvector with their - primary symtab). */ +/* Traverse all compunits in all objfiles in the current program space. */ -#define ALL_PRIMARY_SYMTABS(objfile, s) \ +#define ALL_COMPUNITS(objfile, cu) \ ALL_OBJFILES (objfile) \ - ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s) + ALL_OBJFILE_COMPUNITS (objfile, cu) /* Traverse all minimal symbols in all objfiles in the current symbol space. */