From: Yao Qi <qiyaoltc@gmail.com>
To: Alan Hayward <Alan.Hayward@arm.com>
Cc: "gdb-patches\@sourceware.org" <gdb-patches@sourceware.org>,
Subject: Re: [PATCH] Remove MAX_REGISTER_SIZE from target.c
Date: Wed, 01 Mar 2017 17:23:00 -0000 [thread overview]
Message-ID: <868toorjwz.fsf@gmail.com> (raw)
In-Reply-To: <CF801F56-59C3-4A53-9309-2AC05D7C8501@arm.com> (Alan Hayward's message of "Fri, 24 Feb 2017 10:08:58 +0000")
Alan Hayward <Alan.Hayward@arm.com> writes:
> +extern void regcache_debug_print_register (const char *func,
> + struct regcache *regcache,
> + int regno);
Comments are needed.
> +
> #endif /* REGCACHE_H */
> diff --git a/gdb/regcache.c b/gdb/regcache.c
> index f190eda0e47c5c03744fc26263505d1c30ea1ee8..31aa1baf7ef69c27c00e45e3c8d4eb3c41dc4203 100644
> --- a/gdb/regcache.c
> +++ b/gdb/regcache.c
> @@ -1259,6 +1259,42 @@ regcache_write_pc (struct regcache *regcache, CORE_ADDR pc)
> reinit_frame_cache ();
> }
>
> +void
> +regcache_debug_print_register (const char *func, struct regcache *regcache,
> + int regno)
> +{
> + struct gdbarch *gdbarch = get_regcache_arch (regcache);
> +
> + fprintf_unfiltered (gdb_stdlog, "%s ", func);
> + if (regno >= 0 && regno < gdbarch_num_regs (gdbarch)
> + && gdbarch_register_name (gdbarch, regno) != NULL
> + && gdbarch_register_name (gdbarch, regno)[0] != '\0')
> + fprintf_unfiltered (gdb_stdlog, "(%s)",
> + gdbarch_register_name (gdbarch, regno));
> + else
> + fprintf_unfiltered (gdb_stdlog, "(%d)", regno);
> + if (regno >= 0 && regno < gdbarch_num_regs (gdbarch))
> + {
> + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
> + int i, size = register_size (gdbarch, regno);
> + gdb_byte *buf = register_buffer (regcache, regno);
> +
> + regcache_raw_collect (regcache, regno, buf);
Don't need to call regcache_raw_collect, otherwise, the src and dst of
copy is at the same address (register_buffer (regcache, regno)).
--
Yao (齐尧)
next prev parent reply other threads:[~2017-03-01 17:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 10:09 Alan Hayward
2017-03-01 17:23 ` Yao Qi [this message]
2017-03-24 15:23 ` Alan Hayward
2017-03-24 15:59 ` Yao Qi
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=868toorjwz.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=Alan.Hayward@arm.com \
--cc=gdb-patches@sourceware.org \
/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