From patchwork Thu Dec 12 23:50:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36817 Received: (qmail 129213 invoked by alias); 12 Dec 2019 23:56:54 -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 129194 invoked by uid 89); 12 Dec 2019 23:56:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Dec 2019 23:56:52 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 3B01720D24; Thu, 12 Dec 2019 18:50:15 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id B2C6320490; Thu, 12 Dec 2019 18:50:08 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 990B220AF6; Thu, 12 Dec 2019 18:50:08 -0500 (EST) X-Gerrit-PatchSet: 2 Date: Thu, 12 Dec 2019 18:50:08 -0500 From: "Sourceware to Gerrit sync (Code Review)" To: Tom Tromey , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: merged Subject: [pushed] Make add_separate_debug_objfile static X-Gerrit-Change-Id: I631f43bb71738dea6ae0697317bf8ef4a0db4617 X-Gerrit-Change-Number: 493 X-Gerrit-ChangeURL: X-Gerrit-Commit: f65fe5704af56aca58fd5547d0841a9512e540af In-Reply-To: References: Reply-To: noreply@gnutoolchain-gerrit.osci.io, tromey@sourceware.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Message-Id: <20191212235008.990B220AF6@gnutoolchain-gerrit.osci.io> Sourceware to Gerrit sync has submitted this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/493 ...................................................................... Make add_separate_debug_objfile static This changes objfile::make to take a "parent" parameter, and makes add_separate_debug_objfile static. gdb/ChangeLog 2019-12-12 Tom Tromey * symfile.c (symbol_file_add_with_addrs): Pass "parent" to objfile::make. * objfiles.h (struct objjfile) : No longer inline. (add_separate_debug_objfile): Don't declare. * objfiles.c (add_separate_debug_objfile): Now static. (objfile::make): Move from objfiles.h. Call add_separate_debug_objfile. Add "parent" parameter. Change-Id: I631f43bb71738dea6ae0697317bf8ef4a0db4617 --- M gdb/ChangeLog M gdb/objfiles.c M gdb/objfiles.h M gdb/symfile.c 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 393d43e..7bcd2c7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2019-12-12 Tom Tromey + * symfile.c (symbol_file_add_with_addrs): Pass "parent" to + objfile::make. + * objfiles.h (struct objjfile) : No longer inline. + (add_separate_debug_objfile): Don't declare. + * objfiles.c (add_separate_debug_objfile): Now static. + (objfile::make): Move from objfiles.h. Call + add_separate_debug_objfile. Add "parent" parameter. + +2019-12-12 Tom Tromey + * symfile.c (symbol_file_add_with_addrs): Use objfile::make. * objfiles.h (struct objfile): Make constructor private. : New static method. diff --git a/gdb/objfiles.c b/gdb/objfiles.c index b5bc09f..0ee5720 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -520,7 +520,7 @@ /* Add OBJFILE as a separate debug objfile of PARENT. */ -void +static void add_separate_debug_objfile (struct objfile *objfile, struct objfile *parent) { gdb_assert (objfile && parent); @@ -541,6 +541,18 @@ put_objfile_before (objfile, parent); } +/* See objfiles.h. */ + +objfile * +objfile::make (bfd *bfd_, const char *name_, objfile_flags flags_, + objfile *parent) +{ + objfile *result = new objfile (bfd_, name_, flags_); + if (parent != nullptr) + add_separate_debug_objfile (result, parent); + return result; +} + /* Free all separate debug objfile of OBJFILE, but don't free OBJFILE itself. */ diff --git a/gdb/objfiles.h b/gdb/objfiles.h index b5c04eb..663e639 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -402,10 +402,8 @@ public: /* Create an objfile. */ - static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_) - { - return new objfile (bfd_, name_, flags_); - } + static objfile *make (bfd *bfd_, const char *name_, objfile_flags flags_, + objfile *parent = nullptr); ~objfile (); @@ -649,8 +647,6 @@ extern void build_objfile_section_table (struct objfile *); -extern void add_separate_debug_objfile (struct objfile *, struct objfile *); - extern void free_objfile_separate_debug (struct objfile *); extern void free_all_objfiles (void); diff --git a/gdb/symfile.c b/gdb/symfile.c index eef27a8..8e3cf7f 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1093,10 +1093,7 @@ if (mainline) flags |= OBJF_MAINLINE; - objfile = objfile::make (abfd, name, flags); - - if (parent) - add_separate_debug_objfile (objfile, parent); + objfile = objfile::make (abfd, name, flags, parent); /* We either created a new mapped symbol table, mapped an existing symbol table file which has not had initial symbol reading