From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42642 invoked by alias); 22 Jun 2017 08:44:30 -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 41738 invoked by uid 89); 22 Jun 2017 08:44:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:static., yesterday X-HELO: mail-qk0-f179.google.com Received: from mail-qk0-f179.google.com (HELO mail-qk0-f179.google.com) (209.85.220.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Jun 2017 08:44:27 +0000 Received: by mail-qk0-f179.google.com with SMTP id r62so6782886qkf.0 for ; Thu, 22 Jun 2017 01:44:26 -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:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=CvNl0LTRw0wk8zZBcWyYxkanqqg7IxRzTrMS7Cd0GUw=; b=l5pwJCxTMOur5bOH/gu5xnp2K16JmnnZRa85GRr0zG+w1WhajoYjTklMcCFNFp9EAw OjVqhAknp9vGMmel8iwMdBjdz7KiklMQdBYuxjEnz0Qa9U2K1N5/fTQ2vDRCtGIW/4CY 2yin79KNzOSBJcTNsngpJisie44/XxgdR+H9bB7vjaZAue3Td+kMTu4oV9ZC5YjC9FAT qOcmLncV0sFhLFVbJDTnNQsfuQe28ALd7lM86zP0BK0OLgnRcGSNfSoIkYGQAQREti+E U1kel15pv6gxWioP5On2+lexVLIezqkxQBokI+9v4KsXKsiayjV4pHBJiDtCk560DL3V SLGg== X-Gm-Message-State: AKS2vOwjGqoq6v6a8n68mEdOK1j01C3l2ex6LeISznp8HSFUGykiex1S UNqChsFjJ09Q16n9 X-Received: by 10.55.37.205 with SMTP id l74mr1339848qkl.157.1498121064840; Thu, 22 Jun 2017 01:44:24 -0700 (PDT) Received: from E107787-LIN (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id z21sm652196qtb.56.2017.06.22.01.44.23 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 22 Jun 2017 01:44:24 -0700 (PDT) From: Yao Qi To: Alan Hayward Cc: "gdb-patches\@sourceware.org" , nd Subject: Re: [PATCH] Replace regbuf with regcache in record-full.c References: Date: Thu, 22 Jun 2017 08:44:00 -0000 In-Reply-To: (Alan Hayward's message of "Wed, 14 Jun 2017 14:02:04 +0000") Message-ID: <86fuesjtss.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00623.txt.bz2 Alan Hayward writes: > In record-full.c, instead of backing up all the registers into a large > buffer, duplicate the regcache. > This enables the removal of an instance of MAX_REGISTER_SIZE. > > Note that regcache_dup() create a read-only copy of a register cache, > which ensures the new regcache cannot write back to the target. > > Once created, we need to be able to copy registers between the two caches, > which we want to do without creating a temporary buffer. > > I've added regcache::raw_copy() to allow the copying of raw registers > between two regcaches - either of which might be set as read-only. Can we name this method raw_supply? > > Alternatively, I could make the new regcache as writable (by enabling a > regcache copy constructor). But, I think this would be dangerous as it > it then has the potential to write back to the target if the wrong functi= on > is called. regcache only interacts with target through ::raw_update and ::raw_write. Can we have a regcache class without raw_update and raw_write? regcache has two set of methods, {raw,cooked}_{read,write} and raw_{collect,supply}XXX. The former interacts with target, but the latter doesn't. We can create a new class regcache_collect_supply which has methods raw_{collect,supply}XXXX, regcache extends it. Then, add a method "void raw_supply (int regnum, const regcache_collect_supply &src)" and change record_full_core_regbuf to a regcache_collect_supply. The interface looks like this, (regcache_collect_supply is regcache_1 in the doxygen doc, because I didn't figure out a reasonable name yesterday), http://people.linaro.org/~yao.qi/gdb/doxy/regcache-split/gdb-xref/classregc= ache.html Do you like this design? One more thing is that the new class regcache_collect_supply can be used in target_ops hooks to_fetch_registers, to_store_registers, to_prepare_to_store, void (*to_fetch_registers) (struct target_ops *, regcache_collect_suppl= y *, int) TARGET_DEFAULT_IGNORE (); void (*to_store_registers) (struct target_ops *, regcache_collect_suppl= y *, int) TARGET_DEFAULT_NORETURN (noprocess ()); void (*to_prepare_to_store) (struct target_ops *, regcache_collect_supp= ly *) TARGET_DEFAULT_NORETURN (noprocess ()); so that all the implementations of these methods above can only access raw_{collect,supply}XX methods, and they can't access {raw,cooked}_{read,write}XXX methods, which in turn may call target_ops to_fetch_registers and to_store_registers again. --=20 Yao (=E9=BD=90=E5=B0=A7)