This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 7/8] Add methods to gdbserver regcache and raw_compare
On 05/11/2018 11:52 AM, Alan Hayward wrote:
> +/* Compare the contents of the register stored in the regcache (ignoring the
> + first OFFSET bytes) to the contents of BUF (without any offset). Returns 0
> + if identical. */
Is this a tristate return, like memcmp? If yes, that should be explicitly documented.
If not, I'd suggest renaming the function to something like raw_equals or
raw_contents_eq, flipping the logic around and return a bool, with true
meaning equal.
The description should probably be moved to the .h file.
> +
> +int
> +regcache::raw_compare (int regnum, const void *buf, int offset) const
> +{
> + gdb_assert (register_size (tdesc, regnum) > offset);
> + return memcmp (buf, register_data (this, regnum, 1) + offset,
> + register_size (tdesc, regnum) - offset);
> +}
Thanks,
Pedro Alves