From patchwork Mon Nov 4 01:34:52 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: 35591 Received: (qmail 70886 invoked by alias); 4 Nov 2019 01:34:57 -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 70871 invoked by uid 89); 4 Nov 2019 01:34:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 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; Mon, 04 Nov 2019 01:34:56 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 330EF21086; Sun, 3 Nov 2019 20:34:54 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id D78D620322 for ; Sun, 3 Nov 2019 20:34:52 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id B6BE12816A for ; Sun, 3 Nov 2019 20:34:52 -0500 (EST) X-Gerrit-PatchSet: 1 Date: Sun, 3 Nov 2019 20:34:52 -0500 From: "Tom Tromey (Code Review)" To: gdb-patches@sourceware.org Message-ID: Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange Subject: [review] Make add_separate_debug_objfile static X-Gerrit-Change-Id: I631f43bb71738dea6ae0697317bf8ef4a0db4617 X-Gerrit-Change-Number: 493 X-Gerrit-ChangeURL: X-Gerrit-Commit: 923cdd0c06acabbceea1c2b2fbf9f0d1f355ae7c References: Reply-To: tromey@sourceware.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-75-g9005159e5d 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-11-03 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 bfb60c3..fbcc3de 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2019-11-03 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-11-03 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 eb47cad..f658a22 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 b14f291..a5d8504 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