From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 3/6] Class-fy regcache
Date: Thu, 27 Apr 2017 17:35:00 -0000 [thread overview]
Message-ID: <f9a40b6c-a5f4-27d1-7cce-6c43630e9bfd@redhat.com> (raw)
In-Reply-To: <1493152106-3246-4-git-send-email-yao.qi@linaro.org>
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
next prev parent reply other threads:[~2017-04-27 17:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 20:28 [PATCH 0/6] Class-fy regcache in GDB Yao Qi
2017-04-25 20:28 ` [PATCH 2/6] Add constructor and destructor to regcache Yao Qi
2017-04-27 17:34 ` Pedro Alves
2017-04-28 13:42 ` Yao Qi
2017-04-25 20:28 ` [PATCH 1/6 OBV] Change readonly_p to bool Yao Qi
2017-04-25 20:28 ` [PATCH 6/6] Remove cleanup in get_return_value Yao Qi
2017-04-25 20:28 ` [PATCH 4/6] Simplify regcache_dup Yao Qi
2017-04-25 20:29 ` [PATCH 3/6] Class-fy regcache Yao Qi
2017-04-27 17:35 ` Pedro Alves [this message]
2017-04-25 20:29 ` [PATCH 5/6] Use copy ctor in regcache_dup Yao Qi
2017-04-27 17:37 ` Pedro Alves
2017-04-28 9:11 ` Yao Qi
2017-04-28 9:51 ` Pedro Alves
2017-04-28 13:20 ` Yao Qi
2017-04-28 14:26 ` [PATCH 0/4 v2] Class-fy regcache in GDB Yao Qi
2017-04-28 14:26 ` [PATCH 4/4] Remove cleanup in get_return_value Yao Qi
2017-04-28 15:05 ` Pedro Alves
2017-04-28 14:26 ` [PATCH 1/4] Class-fy regcache Yao Qi
2017-04-28 15:03 ` Pedro Alves
2017-04-28 21:44 ` Yao Qi
2017-04-28 14:26 ` [PATCH 3/4] Use tag dispatch regcache ctor in regcache_dup Yao Qi
2017-04-28 15:04 ` Pedro Alves
2017-04-28 14:26 ` [PATCH 2/4] Simplify regcache_dup Yao Qi
2017-04-28 15:03 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f9a40b6c-a5f4-27d1-7cce-6c43630e9bfd@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox