From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway30.websitewelcome.com (gateway30.websitewelcome.com [192.185.152.11]) by sourceware.org (Postfix) with ESMTPS id DB2BC394D837 for ; Fri, 28 Aug 2020 16:23:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DB2BC394D837 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 cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway30.websitewelcome.com (Postfix) with ESMTP id A8B5BB03E for ; Fri, 28 Aug 2020 11:23:55 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id BhARkx0d1CjCVBhARkhT7R; Fri, 28 Aug 2020 11:23:55 -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=atPqiOSN77VyGQdPUbovGDhKDv2dE8mSZ7KBeSuzXzY=; b=YtxoUlRbEWdbMLtXKqoDyc1W8W nBsnnNwImHq4fYiGJe0Ynk7RQL9bcWn9xw7HaFuqtccP22sMhUSzUN6BxI31As3lWcfCn/3qr45ua Z8PldXPAmW5uh2ESHGK0oV91x; Received: from 71-218-12-75.hlrn.qwest.net ([71.218.12.75]:33904 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 1kBhAQ-002WJo-QV; Fri, 28 Aug 2020 10:23:54 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 09/13] Use gdb_bfd_sections in gcore_memory_sections Date: Fri, 28 Aug 2020 10:23:45 -0600 Message-Id: <20200828162349.987-10-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200828162349.987-1-tom@tromey.com> References: <20200828162349.987-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: 71.218.12.75 X-Source-L: No X-Exim-ID: 1kBhAQ-002WJo-QV X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-218-12-75.hlrn.qwest.net (bapiya.Home) [71.218.12.75]:33904 X-Source-Auth: tom+tromey.com X-Email-Count: 10 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3035.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham 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: Fri, 28 Aug 2020 16:23:59 -0000 This changes gcore_memory_sections to avoid bfd_map_over_sections, in favor of iteration. gdb/ChangeLog 2020-08-28 Tom Tromey * gcore.c (make_output_phdrs): Remove 'ignored' parameter. (gcore_copy_callback): Likewise. (gcore_memory_sections): Use foreach. --- gdb/ChangeLog | 6 ++++++ gdb/gcore.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gdb/gcore.c b/gdb/gcore.c index d0e36b1a708..46ca2da5003 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -364,7 +364,7 @@ derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top) } static void -make_output_phdrs (bfd *obfd, asection *osec, void *ignored) +make_output_phdrs (bfd *obfd, asection *osec) { int p_flags = 0; int p_type = 0; @@ -531,7 +531,7 @@ objfile_find_memory_regions (struct target_ops *self, } static void -gcore_copy_callback (bfd *obfd, asection *osec, void *ignored) +gcore_copy_callback (bfd *obfd, asection *osec) { bfd_size_type size, total_size = bfd_section_size (osec); file_ptr offset = 0; @@ -587,10 +587,12 @@ gcore_memory_sections (bfd *obfd) } /* Record phdrs for section-to-segment mapping. */ - bfd_map_over_sections (obfd, make_output_phdrs, NULL); + for (asection *sect : gdb_bfd_sections (obfd)) + make_output_phdrs (obfd, sect); /* Copy memory region contents. */ - bfd_map_over_sections (obfd, gcore_copy_callback, NULL); + for (asection *sect : gdb_bfd_sections (obfd)) + gcore_copy_callback (obfd, sect); return 1; } -- 2.17.2