From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50435 invoked by alias); 27 Apr 2017 17:35:49 -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 50393 invoked by uid 89); 27 Apr 2017 17:35:47 -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,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Apr 2017 17:35:46 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 94EE0681E3; Thu, 27 Apr 2017 17:35:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 94EE0681E3 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 94EE0681E3 Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E89417C56; Thu, 27 Apr 2017 17:35:44 +0000 (UTC) Subject: Re: [PATCH 3/6] Class-fy regcache To: Yao Qi , gdb-patches@sourceware.org References: <1493152106-3246-1-git-send-email-yao.qi@linaro.org> <1493152106-3246-4-git-send-email-yao.qi@linaro.org> From: Pedro Alves Message-ID: Date: Thu, 27 Apr 2017 17:35:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1493152106-3246-4-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-04/txt/msg00746.txt.bz2 On 04/25/2017 09:28 PM, Yao Qi wrote: > This patch moves regcache declaration to regcache.h, and converts > regcache apis to member functions, for example, regcache_invalidate > is changed to regcache::invalidate. Some changes are not done in > this patch, > > - keep "struct regcache" instead of renaming to "class regcache", > because "struct regcache" is widely used (even in GDBserver). "struct regcache *" and "class regcache *" are interchangeble, they mean exactly the same thing. > + > +/* Dump the contents of a register from the register cache to the target > + debug. */ > + void debug_print_register (const char *func, int regno); > + > +private: > + explicit regcache (struct gdbarch *gdbarch, struct address_space *aspace_, > + bool readonly_p_); > + > + gdb_byte *register_buffer (int regnum) const; > + > + 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, > + enum register_status (*read) (struct regcache *regcache, > + int regnum, gdb_byte *buf), > + void (*write) (struct regcache *regcache, int regnum, > + const gdb_byte *buf)); > + "restore" and "xfer_part" stand out as having odd formatting with the type on its own line. > + void transfer_regset (const struct regset *regset, > + struct regcache *out_regcache, > + int regnum, const void *in_buf, > + void *out_buf, size_t size) const; > + > + struct regcache_descr *descr; > + > + /* The address space of this register cache (for registers where it > + makes sense, like PC or SP). */ > + struct address_space *aspace; > + > + /* The register buffers. A read-only register cache can hold the > + full [0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs) while a read/write > + register cache can only hold [0 .. gdbarch_num_regs). */ > + gdb_byte *registers; > + /* Register cache status. */ > + signed char *register_status; > + /* Is this a read-only cache? A read-only cache is used for saving > + the target's register state (e.g, across an inferior function > + call or just before forcing a function return). A read-only > + cache can only be updated via the methods regcache_dup() and > + regcache_cpy(). The actual contents are determined by the > + reggroup_save and reggroup_restore methods. */ > + bool readonly_p; > + /* If this is a read-write cache, which thread's registers is > + it connected to? */ > + ptid_t ptid; All these fields should be prefixed with "m_" now. You already need to touch all code that references these fields, so it seems to me that the patch would have the exact same size if you do it at the same time. That allow renaming the get_ptid() method to ptid(), "get_aspace()" to "aspace()" etc. too. Thanks, Pedro Alves