This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Remove MAX_REGISTER_SIZE from mi/mi-main.c
- From: Pedro Alves <palves at redhat dot com>
- To: Alan Hayward <Alan dot Hayward at arm dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: nd <nd at arm dot com>
- Date: Thu, 8 Jun 2017 10:55:04 +0100
- Subject: Re: [PATCH] Remove MAX_REGISTER_SIZE from mi/mi-main.c
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3E05737EE1
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3E05737EE1
- References: <4AA96E9D-7905-4D03-9424-2BC71D117CE2@arm.com>
On 06/08/2017 10:42 AM, Alan Hayward wrote:
> /* Get register contents and compare. */
> - prev_status = regcache_cooked_read (prev_regs, regnum, prev_buffer);
> - this_status = regcache_cooked_read (this_regs, regnum, this_buffer);
> -
> - if (this_status != prev_status)
> - return 1;
> - else if (this_status == REG_VALID)
> - return memcmp (prev_buffer, this_buffer,
> - register_size (gdbarch, regnum)) != 0;
> + prev_value = prev_regs->cooked_read_value (regnum);
> + this_value = this_regs->cooked_read_value (regnum);
> + gdb_assert (prev_value != NULL);
> + gdb_assert (this_value != NULL);
> +
> + if (value_optimized_out (prev_value) != value_optimized_out (this_value)
> + || value_entirely_available (prev_value)
> + != value_entirely_available (this_value))
> + ret = 1;
> + if (value_optimized_out (prev_value)
> + || !value_entirely_available (prev_value))
> + ret = 0;
> else
> - return 0;
> + ret = memcmp (value_contents_all (prev_value),
> + value_contents_all (this_value),
> + register_size (gdbarch, regnum)) != 0;
> +
> + release_value (prev_value);
> + release_value (this_value);
> + value_free (prev_value);
> + value_free (this_value);
> + return ret;
> }
>
Use value_contents_eq?
Thanks,
Pedro Alves