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 196123948827 for ; Fri, 28 Aug 2020 16:23:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 196123948827 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 E6E84B6A0 for ; Fri, 28 Aug 2020 11:23:53 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id BhAPkx0alCjCVBhAPkhT55; Fri, 28 Aug 2020 11:23:53 -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=89LHH7N7SfP2KaHrmMUkd1RawQJYQXEyQxAj75M+yPY=; b=BUvYXGBXzel/0nLM/iQtBDzg1g b6JZWisDe06Scq5DgKkFt1AuEBDWYQsQp29TQKYLqp6HHcX7qkmczRpekdE10zWvNyeX5SMEMIf7i 4FNbXCzaw13LvJiaxSFXjbyBW; 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 1kBhAP-002WJo-EV; Fri, 28 Aug 2020 10:23:53 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 04/13] Use gdb_bfd_sections in get_stap_base_address Date: Fri, 28 Aug 2020 10:23:40 -0600 Message-Id: <20200828162349.987-5-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: 1kBhAP-002WJo-EV 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: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3035.7 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:56 -0000 This changes get_stap_base_address to avoid bfd_map_over_sections, in favor of iteration. gdb/ChangeLog 2020-08-28 Tom Tromey * stap-probe.c (get_stap_base_address_1): Remove. (get_stap_base_address): Use foreach. --- gdb/ChangeLog | 5 +++++ gdb/stap-probe.c | 20 ++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c index 73596446cce..fb6010d14ff 100644 --- a/gdb/stap-probe.c +++ b/gdb/stap-probe.c @@ -1578,19 +1578,6 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el, probesp->emplace_back (ret); } -/* Helper function which tries to find the base address of the SystemTap - base section named STAP_BASE_SECTION_NAME. */ - -static void -get_stap_base_address_1 (bfd *abfd, asection *sect, void *obj) -{ - asection **ret = (asection **) obj; - - if ((sect->flags & (SEC_DATA | SEC_ALLOC | SEC_HAS_CONTENTS)) - && sect->name && !strcmp (sect->name, STAP_BASE_SECTION_NAME)) - *ret = sect; -} - /* Helper function which iterates over every section in the BFD file, trying to find the base address of the SystemTap base section. Returns 1 if found (setting BASE to the proper value), zero otherwise. */ @@ -1600,7 +1587,12 @@ get_stap_base_address (bfd *obfd, bfd_vma *base) { asection *ret = NULL; - bfd_map_over_sections (obfd, get_stap_base_address_1, (void *) &ret); + for (asection *sect : gdb_bfd_sections (obfd)) + { + if ((sect->flags & (SEC_DATA | SEC_ALLOC | SEC_HAS_CONTENTS)) + && sect->name && !strcmp (sect->name, STAP_BASE_SECTION_NAME)) + ret = sect; + } if (ret == NULL) { -- 2.17.2