From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84802 invoked by alias); 23 Jun 2017 07:39:58 -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 84785 invoked by uid 89); 23 Jun 2017 07:39:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 spammy=Hx-languages-length:1753 X-HELO: mail-it0-f54.google.com Received: from mail-it0-f54.google.com (HELO mail-it0-f54.google.com) (209.85.214.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Jun 2017 07:39:55 +0000 Received: by mail-it0-f54.google.com with SMTP id x12so6030293itb.0 for ; Fri, 23 Jun 2017 00:39:54 -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=MrdypOaYHV9uGlPMz9KDCl+S79x17xso9osnGCdHxZI=; b=rongsqKO+AlZqpUZzBHyjSlSJV/8OCSYfXIaV5IZONjeEKAuIkcbOwavkpVfiWh4UI ouSysNoBQ7Bv2sZ8Dsa5N3vraWAa30KpvtCM0fi7VscilqEk5iOP29knc8Rq+Y6ujTCx Yh1IdciAChb91BK2MPMfjrNMlTfemp0hy7UiBBMsGH/gKz/aXTQ0mTXMNtZlnUgzttuX IgWGGKl0H4TupSLQQNy3Tn0eQfU/20/WaefttFgZ4IOjswM1Qc+ofh/AXAvpDOtMwhhz RoyUSYhwkuOK25IqdR56bp/rfttclcMcOsy2TnttobvIRcnJtiW5h2yiufBT3/1vKIHQ 4cOw== X-Gm-Message-State: AKS2vOxJ26Sfu8nB5gd/5PtQ3t+g8/HKbHnfObNHFQ7Uj8SMRquSzcvl jfr8VGwRu5d6xA== X-Received: by 10.36.1.141 with SMTP id 135mr5973656itk.4.1498203593604; Fri, 23 Jun 2017 00:39:53 -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 v75sm2387848ita.20.2017.06.23.00.39.52 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 23 Jun 2017 00:39:53 -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: <86fuesjtss.fsf@gmail.com> <84525A76-483C-4200-B7B6-C1F6AD5CC12F@arm.com> Date: Fri, 23 Jun 2017 07:39:00 -0000 In-Reply-To: <84525A76-483C-4200-B7B6-C1F6AD5CC12F@arm.com> (Alan Hayward's message of "Thu, 22 Jun 2017 16:02:13 +0000") Message-ID: <86efubi24c.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/msg00670.txt.bz2 Alan Hayward writes: > Resulting in: > void raw_supply (int regnum, const void *buf); > void raw_supply (int regnum, const struct regcache *src_regcache); ^^^^^^^^^^^^^^^^^^^^^^^^ We should use reference instead of pointer, otherwise, raw_supply (0, NULL) is ambiguous. >>=20 >> http://people.linaro.org/~yao.qi/gdb/doxy/regcache-split/gdb-xref/classr= egcache.html >>=20 >> 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, >>=20 >> void (*to_fetch_registers) (struct target_ops *, regcache_collect_sup= ply *, int) >> TARGET_DEFAULT_IGNORE (); >> void (*to_store_registers) (struct target_ops *, regcache_collect_sup= ply *, int) >> TARGET_DEFAULT_NORETURN (noprocess ()); >> void (*to_prepare_to_store) (struct target_ops *, regcache_collect_su= pply *) >> TARGET_DEFAULT_NORETURN (noprocess ()); >>=20 >> 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 > > Following this through, regcache_dup and regcache_cpy should create a > detached_regcache ? > Yes, it can be. > Code would be free to write to the detached_regcache and there would > be no need to mark > it as =E2=80=9Cread-only=E2=80=9D. No. > > Would there be any requirement to still have a read-only regcache ? The detached_regcache can be read-write and read-only. regcache_dup and regcache_cpy create the read-only one, but record-full still uses the read-write one. --=20 Yao (=E9=BD=90=E5=B0=A7)