This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 5/7] target: consider addressable unit size when reading/writing memory
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org
- Date: Thu, 21 May 2015 18:46:35 +0100
- Subject: Re: [PATCH v2 5/7] target: consider addressable unit size when reading/writing memory
- Authentication-results: sourceware.org; auth=none
- References: <1429127258-1033-1-git-send-email-simon dot marchi at ericsson dot com> <1429127258-1033-6-git-send-email-simon dot marchi at ericsson dot com>
On 04/15/2015 08:47 PM, Simon Marchi wrote:
> If we are reading/writing from a memory object, the length represents
> the number of "addresses" to read/write, so the addressable unit size
> needs to be taken into account when allocating memory on gdb's side.
>
> gdb/ChangeLog:
>
> * target.c (target_read): Consider addressable unit size when
> reading from a memory object.
> (read_memory_robust): Same.
> (read_whatever_is_readable): Same.
> (target_write_with_progress): Consider addressable unit size
> when writing to a memory object.
> * target.h (target_read): Update documentation.
> (target_write): Add documentation.
> --- a/gdb/target.c
> +++ b/gdb/target.c
> @@ -1589,6 +1589,15 @@ target_read (struct target_ops *ops,
> ULONGEST offset, LONGEST len)
> {
> LONGEST xfered_total = 0;
> + int unit_size = 1;
> +
> + /* If we are reading from a memory object, find the length of an addressable
> + unit for that architecture. */
> + if (object == TARGET_OBJECT_MEMORY
> + || object == TARGET_OBJECT_STACK_MEMORY
> + || object == TARGET_OBJECT_CODE_MEMORY
> + || object == TARGET_OBJECT_RAW_MEMORY)
> + unit_size = gdbarch_addressable_memory_unit_size (target_gdbarch());
Missing space before parens. Otherwise looks OK.
Thanks,
Pedro Alves