From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YCbeGNkIjl+ERwAAWB0awg (envelope-from ) for ; Mon, 19 Oct 2020 17:44:57 -0400 Received: by simark.ca (Postfix, from userid 112) id 62D7A1EFC5; Mon, 19 Oct 2020 17:44:56 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 20CA71EFBF for ; Mon, 19 Oct 2020 17:44:46 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BA1FC3894C31; Mon, 19 Oct 2020 21:44:41 +0000 (GMT) Received: from gateway32.websitewelcome.com (gateway32.websitewelcome.com [192.185.145.111]) by sourceware.org (Postfix) with ESMTPS id 49C0A388EC2B for ; Mon, 19 Oct 2020 21:44:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 49C0A388EC2B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway32.websitewelcome.com (Postfix) with ESMTP id E44755E5DA for ; Mon, 19 Oct 2020 16:44:35 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id UcxHkUxCvBD8bUcxHkRuBe; Mon, 19 Oct 2020 16:44:35 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=XMdQ4UBJ2/c8Bv0phi7xhMg/MtfAIapsXLhHtVw6JLE=; b=G7gnJ66Zsp6ejYeuZAVC44ZW+W c45+Q7OUtcuhC5lCsQ4Y68TJ79d2+EXkCroI5Hu4/GB7cS1E9fMDqFD1Zd2/eXdriQJOLfd/Z50nm Ck3/QQMvb9iWb1lOmd9RUDKM1; Received: from 75-166-102-113.hlrn.qwest.net ([75.166.102.113]:45712 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kUcxH-004Oci-Mm; Mon, 19 Oct 2020 15:44:35 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH v2 13/16] Change add_target_sections to method on program_space Date: Mon, 19 Oct 2020 15:44:26 -0600 Message-Id: <20201019214429.13815-14-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20201019214429.13815-1-tom@tromey.com> References: <20201019214429.13815-1-tom@tromey.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.102.113 X-Source-L: No X-Exim-ID: 1kUcxH-004Oci-Mm X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-102-113.hlrn.qwest.net (bapiya.Home) [75.166.102.113]:45712 X-Source-Auth: tom+tromey.com X-Email-Count: 14 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom Tromey Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" This changes add_target_sections to be a method on program_space. Like the earlier change to remove_target_sections, this makes sense because this function is manipulating data that is stored on the program space. gdb/ChangeLog 2020-10-19 Tom Tromey * solib.c (solib_map_sections): Update. * exec.c (program_space::add_target_sections): Now a method. (exec_file_attach): Update. * exec.h (add_target_sections): Don't declare. * progspace.h (struct program_space) : Declare. --- gdb/ChangeLog | 9 +++++++++ gdb/exec.c | 16 +++++++--------- gdb/exec.h | 6 ------ gdb/progspace.h | 5 +++++ gdb/solib.c | 2 +- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/gdb/exec.c b/gdb/exec.c index 8952a99bf1a..552730b4336 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -495,7 +495,8 @@ exec_file_attach (const char *filename, int from_tty) /* Add the executable's sections to the current address spaces' list of sections. This possibly pushes the exec_ops target. */ - add_target_sections (¤t_program_space->ebfd, sections); + current_program_space->add_target_sections (¤t_program_space->ebfd, + sections); /* Tell display code (if any) about the changed file name. */ if (deprecated_exec_file_display_hook) @@ -592,28 +593,25 @@ build_section_table (struct bfd *some_bfd) current set of target sections. */ void -add_target_sections (void *owner, - const target_section_table §ions) +program_space::add_target_sections (void *owner, + const target_section_table §ions) { - target_section_table *table = ¤t_program_space->target_sections; - if (!sections.empty ()) { for (const target_section &s : sections) { - table->push_back (s); - table->back ().owner = owner; + target_sections.push_back (s); + target_sections.back ().owner = owner; } scoped_restore_current_pspace_and_thread restore_pspace_thread; - program_space *curr_pspace = current_program_space; /* If these are the first file sections we can provide memory from, push the file_stratum target. Must do this in all inferiors sharing the program space. */ for (inferior *inf : all_inferiors ()) { - if (inf->pspace != curr_pspace) + if (inf->pspace != this) continue; if (inf->target_is_pushed (&exec_ops)) diff --git a/gdb/exec.h b/gdb/exec.h index d5b3cff3855..3aa248527c9 100644 --- a/gdb/exec.h +++ b/gdb/exec.h @@ -92,12 +92,6 @@ extern enum target_xfer_status /* Set the loaded address of a section. */ extern void exec_set_section_address (const char *, int, CORE_ADDR); -/* Add the sections array defined by [SECTIONS..SECTIONS_END[ to the - current set of target sections. */ - -extern void add_target_sections (void *owner, - const target_section_table §ions); - /* Add the sections of OBJFILE to the current set of target sections. * OBJFILE owns the new target sections. */ diff --git a/gdb/progspace.h b/gdb/progspace.h index f4e1107c6ec..92a7942c560 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -300,6 +300,11 @@ struct program_space /* Remove all target sections owned by OWNER. */ void remove_target_sections (void *owner); + /* Add the sections array defined by SECTIONS to the + current set of target sections. */ + void add_target_sections (void *owner, + const target_section_table §ions); + /* Unique ID number. */ int num = 0; diff --git a/gdb/solib.c b/gdb/solib.c index 64b2035cd89..e7dbde6a7f6 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -578,7 +578,7 @@ solib_map_sections (struct so_list *so) section tables. Do this immediately after mapping the object so that later nodes in the list can query this object, as is needed in solib-osf.c. */ - add_target_sections (so, *so->sections); + current_program_space->add_target_sections (so, *so->sections); return 1; } -- 2.17.2