From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cLfdMdwIjl+ERwAAWB0awg (envelope-from ) for ; Mon, 19 Oct 2020 17:45:00 -0400 Received: by simark.ca (Postfix, from userid 112) id C72CD1EFBB; Mon, 19 Oct 2020 17:45:00 -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=ham 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 F38F51EFBD for ; Mon, 19 Oct 2020 17:44:51 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 03C0B388EC15; Mon, 19 Oct 2020 21:44:44 +0000 (GMT) Received: from gateway33.websitewelcome.com (gateway33.websitewelcome.com [192.185.146.130]) by sourceware.org (Postfix) with ESMTPS id 30A1F388EC3B for ; Mon, 19 Oct 2020 21:44:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 30A1F388EC3B 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 cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 53363126963B for ; Mon, 19 Oct 2020 16:44:34 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id UcxFkUB8pXp2AUcxFkGALA; Mon, 19 Oct 2020 16:44:33 -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=+0mDO3ZfbrNW3+2VKkQrogsYKhvV8ARKznwBj8Y/LOI=; b=ZVcfRpWT8hsnxuZPZhorCmcqOl scjYjwCPZrk68DiEBFzwINH0SaGcbgeOsReK5KwFYJ/QoJ5l66HZL0hE2VmnkLDUi2xvbzWYWb/LO uhh5CcJ1ZWu+N0OeEhbtGXvu2; 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 1kUcxF-004Oci-OL; Mon, 19 Oct 2020 15:44:33 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH v2 06/16] Remove current_target_sections macro Date: Mon, 19 Oct 2020 15:44:19 -0600 Message-Id: <20201019214429.13815-7-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: 1kUcxF-004Oci-OL 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: 7 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 removes the current_target_sections macro, replacing it with uses of the appropriate member from current_program_space. gdb/ChangeLog 2020-10-19 Tom Tromey * progspace.h (current_target_sections): Remove macro. * solib-svr4.c (scan_dyntag): Update. * solib-dsbt.c (scan_dyntag): Update. * exec.c (exec_target::close): Update. (add_target_sections, add_target_sections_of_objfile) (remove_target_sections, exec_target::get_section_table) (exec_target::files_info, set_section_command) (exec_set_section_address, exec_target::has_memory) (exec_target::has_memory): Update. --- gdb/ChangeLog | 12 ++++++++++++ gdb/exec.c | 18 +++++++++--------- gdb/progspace.h | 4 ---- gdb/solib-dsbt.c | 2 +- gdb/solib-svr4.c | 2 +- 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/gdb/exec.c b/gdb/exec.c index 22be006a9c0..013fcfc1356 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -159,7 +159,7 @@ exec_target::close () for (struct program_space *ss : program_spaces) { set_current_program_space (ss); - current_target_sections->clear (); + ss->target_sections.clear (); ss->exec_close (); } } @@ -591,7 +591,7 @@ void add_target_sections (void *owner, const target_section_table §ions) { - target_section_table *table = current_target_sections; + target_section_table *table = ¤t_program_space->target_sections; if (!sections.empty ()) { @@ -626,7 +626,7 @@ add_target_sections (void *owner, void add_target_sections_of_objfile (struct objfile *objfile) { - target_section_table *table = current_target_sections; + target_section_table *table = ¤t_program_space->target_sections; struct obj_section *osect; gdb_assert (objfile != nullptr); @@ -649,7 +649,7 @@ add_target_sections_of_objfile (struct objfile *objfile) void remove_target_sections (void *owner) { - target_section_table *table = current_target_sections; + target_section_table *table = ¤t_program_space->target_sections; gdb_assert (owner != NULL); @@ -893,7 +893,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf, target_section_table * exec_target::get_section_table () { - return current_target_sections; + return ¤t_program_space->target_sections; } enum target_xfer_status @@ -991,7 +991,7 @@ void exec_target::files_info () { if (exec_bfd) - print_section_info (current_target_sections, exec_bfd); + print_section_info (¤t_program_space->target_sections, exec_bfd); else puts_filtered (_("\t\n")); } @@ -1015,7 +1015,7 @@ set_section_command (const char *args, int from_tty) /* Parse out new virtual address. */ secaddr = parse_and_eval_address (args); - for (target_section &p : *current_target_sections) + for (target_section &p : current_program_space->target_sections) { if (!strncmp (secname, bfd_section_name (p.the_bfd_section), seclen) && bfd_section_name (p.the_bfd_section)[seclen] == '\0') @@ -1041,7 +1041,7 @@ set_section_command (const char *args, int from_tty) void exec_set_section_address (const char *filename, int index, CORE_ADDR address) { - for (target_section &p : *current_target_sections) + for (target_section &p : current_program_space->target_sections) { if (filename_cmp (filename, bfd_get_filename (p.the_bfd_section->owner)) == 0 @@ -1058,7 +1058,7 @@ exec_target::has_memory () { /* We can provide memory if we have any file/target sections to read from. */ - return !current_target_sections->empty (); + return !current_program_space->target_sections.empty (); } char * diff --git a/gdb/progspace.h b/gdb/progspace.h index 6dcec9c96f7..03634034ba0 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -365,10 +365,6 @@ struct address_space #define symfile_objfile current_program_space->symfile_object_file -/* The set of target sections matching the sections mapped into the - current program space. */ -#define current_target_sections (¤t_program_space->target_sections) - /* The list of all program spaces. There's always at least one. */ extern std::vectorprogram_spaces; diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index 57c7ab18430..6f610c511e0 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -424,7 +424,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr) return 0; bool found = false; - for (target_section &target_section : *current_target_sections) + for (target_section &target_section : current_program_space->target_sections) if (sect == target_section.the_bfd_section) { dyn_addr = target_section.addr; diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index a780f8d3467..faaba471a19 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -608,7 +608,7 @@ scan_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr, return 0; bool found = false; - for (target_section &target_section : *current_target_sections) + for (target_section &target_section : current_program_space->target_sections) if (sect == target_section.the_bfd_section) { dyn_addr = target_section.addr; -- 2.17.2