From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50267 invoked by alias); 27 Jun 2017 07:37:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 38967 invoked by uid 89); 27 Jun 2017 07:37:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=nowadays, H*r:sk:static. X-HELO: mail-io0-f196.google.com Received: from mail-io0-f196.google.com (HELO mail-io0-f196.google.com) (209.85.223.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Jun 2017 07:37:42 +0000 Received: by mail-io0-f196.google.com with SMTP id h134so1985768iof.3 for ; Tue, 27 Jun 2017 00:37:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=4bPwMo98Cl1QFsPPam/CleuQcbPGq/3icEltfnAe+9w=; b=qb1h9Hnj93aire2tKwx5LA4kU4SroRRSOXe6qfH7EIL2XX5voVNEAGBBXtFqRUKdU8 EgjRscWnjfQu5FEfO2NJ0XipRQWItYHesLnq1uroiP6TBkLDNW4qSver3iYV0eqCpveC xUhwWxPVAgiAIAQ+LE+5N9KsjXGEIFwrXclJZbkAJfRkbaosfAlUg2euyTcL+ZE7+lxi FHF2+2uwAPHJhaFwfO2gkZW13bPZEBYYnWst13uXcmcS0p7sYE/18VZ9IxutwGY5UJ+D IiuhXj3k1uA6FxvHSDRmlDnrqiCI32N1TNCqRU6ohRFDp1acPjmKuuwykeVQWBW55u4A KiXQ== X-Gm-Message-State: AKS2vOzCFQx0MfWJavXSBfSBZMdEmQF0dJG+z6tQzNG3rarbKhX8jFD3 7XR3CaBkg4cxkm1L X-Received: by 10.107.171.65 with SMTP id u62mr4969779ioe.125.1498549060791; Tue, 27 Jun 2017 00:37:40 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id u191sm1017326ita.22.2017.06.27.00.37.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Jun 2017 00:37:40 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] Simplify regcache_cpy and remove regcache::cpy_no_passthrough Date: Tue, 27 Jun 2017 07:37:00 -0000 Message-Id: <1498549057-3942-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00715.txt.bz2 Nowadays, regcache_cpy is used where src is read-only and dst is not read-only, so the regcache_cpy can be simplified to handle this case only. As a result, regcache::cpy_no_passthrough, which is about two read-only regcache copy, is no longer used, remove it as well. Regression tested on x86_64-linux, both native and gdbserver. gdb: 2017-06-27 Yao Qi * regcache.c (regcache_cpy): Simplify it. (regcache::cpy_no_passthrough): Remove it. * regcache.h (cpy_no_passthrough): Remove it. --- gdb/regcache.c | 31 ++----------------------------- gdb/regcache.h | 2 -- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/gdb/regcache.c b/gdb/regcache.c index 7eeb737..e8f92d6 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -388,36 +388,9 @@ regcache_cpy (struct regcache *dst, struct regcache *src) gdb_assert (src != NULL && dst != NULL); gdb_assert (src->m_descr->gdbarch == dst->m_descr->gdbarch); gdb_assert (src != dst); - gdb_assert (src->m_readonly_p || dst->m_readonly_p); + gdb_assert (src->m_readonly_p && !dst->m_readonly_p); - if (!src->m_readonly_p) - regcache_save (dst, do_cooked_read, src); - else if (!dst->m_readonly_p) - dst->restore (src); - else - dst->cpy_no_passthrough (src); -} - -/* Copy/duplicate the contents of a register cache. Unlike regcache_cpy, - which is pass-through, this does not go through to the target. - Only values values already in the cache are transferred. The SRC and DST - buffers must not overlap. */ - -void -regcache::cpy_no_passthrough (struct regcache *src) -{ - gdb_assert (src != NULL); - gdb_assert (src->m_descr->gdbarch == m_descr->gdbarch); - /* NOTE: cagney/2002-05-17: Don't let the caller do a no-passthrough - move of data into a thread's regcache. Doing this would be silly - - it would mean that regcache->register_status would be - completely invalid. */ - gdb_assert (m_readonly_p && src->m_readonly_p); - - memcpy (m_registers, src->m_registers, - m_descr->sizeof_cooked_registers); - memcpy (m_register_status, src->m_register_status, - m_descr->sizeof_cooked_register_status); + dst->restore (src); } struct regcache * diff --git a/gdb/regcache.h b/gdb/regcache.h index b416d5e..03c042a 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -369,8 +369,6 @@ private: void restore (struct regcache *src); - void cpy_no_passthrough (struct regcache *src); - enum register_status xfer_part (int regnum, int offset, int len, void *in, const void *out, decltype (regcache_raw_read) read, -- 1.9.1