From patchwork Thu Mar 7 20:57:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31778 Received: (qmail 53794 invoked by alias); 7 Mar 2019 20:57:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 53551 invoked by uid 89); 7 Mar 2019 20:57:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.46.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Mar 2019 20:57:14 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 8F235F90F for ; Thu, 7 Mar 2019 14:57:13 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 204nheliW4FKp204nhv4OT; Thu, 07 Mar 2019 14:57:13 -0600 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=iK3aVBfdXj++Du/TkQw5+9NOW7eHIo1O291CmQVnqnw=; b=CjcFI0gHRxvNsCYo7pwVR9BEFu ndwuMODXh33wUg3wef610ICfWdPNxuQpYyehSqdH9T5cgZ/AQd3Uaj/k9VGGlS0VyGiwiNl047kIS R08ZcY74F6sWHE3KNQGtyiF4k; Received: from 75-166-85-218.hlrn.qwest.net ([75.166.85.218]:53182 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1h204n-002TOW-Bs; Thu, 07 Mar 2019 14:57:13 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 8/9] Use memcpy in minimal_symbol_reader::install Date: Thu, 7 Mar 2019 13:57:08 -0700 Message-Id: <20190307205709.21919-9-tom@tromey.com> In-Reply-To: <20190307205709.21919-1-tom@tromey.com> References: <20190307205709.21919-1-tom@tromey.com> minimal_symbol_reader::install copies minsyms from the msym_bunch objects into the allocated memory. It seemed better to me to do this via memcpy, as that is frequently optimized in libc. gdb/ChangeLog 2019-03-07 Tom Tromey * minsyms.c (minimal_symbol_reader::install): Use memcpy. --- gdb/ChangeLog | 4 ++++ gdb/minsyms.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gdb/minsyms.c b/gdb/minsyms.c index f86105db7ee..4f3c929cd72 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1330,7 +1330,6 @@ build_minimal_symbol_hash_tables (struct objfile *objfile) void minimal_symbol_reader::install () { - int bindex; int mcount; struct msym_bunch *bunch; struct minimal_symbol *msymbols; @@ -1377,8 +1376,9 @@ minimal_symbol_reader::install () for (bunch = m_msym_bunch; bunch != NULL; bunch = bunch->next) { - for (bindex = 0; bindex < m_msym_bunch_index; bindex++, mcount++) - msymbols[mcount] = bunch->contents[bindex]; + memcpy (&msymbols[mcount], &bunch->contents[0], + m_msym_bunch_index * sizeof (struct minimal_symbol)); + mcount += m_msym_bunch_index; m_msym_bunch_index = BUNCH_SIZE; }