From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway23.websitewelcome.com (gateway23.websitewelcome.com [192.185.48.84]) by sourceware.org (Postfix) with ESMTPS id B048C3875407 for ; Wed, 22 Jul 2020 03:34:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B048C3875407 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 cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 4F5C146BB for ; Tue, 21 Jul 2020 22:34:48 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id y5WqjqRWXBb5dy5Wqjdwx9; Tue, 21 Jul 2020 22:34:48 -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=+tEr6qYgMn04bF3tgwsT3uFCqOHpnJQ2ldSMF/hPYIE=; b=yid4wECGOScb83kCM/RxQAkdeM LGWLX4pFgSdrRRlrZZVaEqV2CcD3a25DzxcXRtD01dBl6Iu5MB0q7RvqKNe1aHnZid7nUK2aSMCfF dBedvcVgsrmyuomV4y1uga9Gu; Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:44534 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 1jy5Wp-000kGI-ST; Tue, 21 Jul 2020 21:34:47 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 5/9] Remove current_target_sections macro Date: Tue, 21 Jul 2020 21:34:40 -0600 Message-Id: <20200722033444.18522-6-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200722033444.18522-1-tom@tromey.com> References: <20200722033444.18522-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: 174.16.104.48 X-Source-L: No X-Exim-ID: 1jy5Wp-000kGI-ST X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-104-48.hlrn.qwest.net (bapiya.Home) [174.16.104.48]:44534 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3034.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP, URIBL_CSS, URIBL_CSS_A autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Wed, 22 Jul 2020 03:34:59 -0000 This removes the current_target_sections macro, replacing it with uses of the appropriate member from current_program_space. gdb/ChangeLog 2020-07-21 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 | 23 +++++++++++++---------- gdb/progspace.h | 4 ---- gdb/solib-dsbt.c | 6 +++--- gdb/solib-svr4.c | 6 +++--- 5 files changed, 31 insertions(+), 20 deletions(-) diff --git a/gdb/exec.c b/gdb/exec.c index 6ca867ab53e..e2a0cae787c 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); - clear_section_table (current_target_sections); + clear_section_table (&ss->target_sections); ss->exec_close (); } } @@ -660,7 +660,8 @@ add_target_sections (void *owner, struct target_section *sections_end) { int count; - struct target_section_table *table = current_target_sections; + struct target_section_table *table + = ¤t_program_space->target_sections; count = sections_end - sections; @@ -700,7 +701,8 @@ add_target_sections (void *owner, void add_target_sections_of_objfile (struct objfile *objfile) { - struct target_section_table *table = current_target_sections; + struct target_section_table *table + = ¤t_program_space->target_sections; struct obj_section *osect; int space; unsigned count = 0; @@ -747,7 +749,8 @@ void remove_target_sections (void *owner) { struct target_section *src, *dest; - struct target_section_table *table = current_target_sections; + struct target_section_table *table + = ¤t_program_space->target_sections; gdb_assert (owner != NULL); @@ -1006,7 +1009,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf, struct target_section_table * exec_target::get_section_table () { - return current_target_sections; + return ¤t_program_space->target_sections; } enum target_xfer_status @@ -1105,7 +1108,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")); } @@ -1131,7 +1134,7 @@ set_section_command (const char *args, int from_tty) /* Parse out new virtual address. */ secaddr = parse_and_eval_address (args); - table = current_target_sections; + table = ¤t_program_space->target_sections; for (p = table->sections; p < table->sections_end; p++) { if (!strncmp (secname, bfd_section_name (p->the_bfd_section), seclen) @@ -1161,7 +1164,7 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address) struct target_section *p; struct target_section_table *table; - table = current_target_sections; + table = ¤t_program_space->target_sections; for (p = table->sections; p < table->sections_end; p++) { if (filename_cmp (filename, @@ -1179,8 +1182,8 @@ exec_target::has_memory () { /* We can provide memory if we have any file/target sections to read from. */ - return (current_target_sections->sections - != current_target_sections->sections_end); + return (current_program_space->target_sections.sections + != current_program_space->target_sections.sections_end); } char * diff --git a/gdb/progspace.h b/gdb/progspace.h index 777bef2e38e..ef39f8a1dab 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 94a6ac83754..ae76bb74c05 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -424,12 +424,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr) if (sect == NULL) return 0; - for (target_section = current_target_sections->sections; - target_section < current_target_sections->sections_end; + for (target_section = current_program_space->target_sections->sections; + target_section < current_program_space->target_sections->sections_end; target_section++) if (sect == target_section->the_bfd_section) break; - if (target_section < current_target_sections->sections_end) + if (target_section < current_program_space->target_sections->sections_end) dyn_addr = target_section->addr; else { diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 570450c5400..520d9e8ed12 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -608,12 +608,12 @@ scan_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr, if (sect == NULL) return 0; - for (target_section = current_target_sections->sections; - target_section < current_target_sections->sections_end; + for (target_section = current_program_space->target_sections.sections; + target_section < current_program_space->target_sections.sections_end; target_section++) if (sect == target_section->the_bfd_section) break; - if (target_section < current_target_sections->sections_end) + if (target_section < current_program_space->target_sections.sections_end) dyn_addr = target_section->addr; else { -- 2.17.2