Re: [PATCH 10/15] Add target/target.h

Gary Benson
2014-07-16T08:53:03Z

Tom Tromey wrote:
> >>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:
>
> Gary> This adds target/target.h. This file declares some functions
> Gary> that the "common" code can use and that the clients must
> Gary> implement. It also changes code in common to use these
> Gary> functions.
>
> Gary> +/* See target/target.h. */
> Gary> +
> Gary> +int
> Gary> +target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
>
> These comments refer to docs I never got around to writing... :
>
> Gary> +extern int target_read_uint32 (CORE_ADDR memaddr, unsigned int *result);
> Gary> +
> Gary> +extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
> Gary> + ssize_t len);

How does this sound?

/* Read LEN bytes of target memory at address MEMADDR, placing the
results in GDB's memory at MYADDR. Return zero for success,
nonzero if any error occurs. Implementations of this function may
define and use their own error codes, but functions in the common,
nat and target directories must treat the return code as opaque.
No guarantee is made about the contents of the data at MYADDR if
any error occurs. */

extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
ssize_t len);

/* Read an unsigned 32-bit integer in the target's format from target
memory at address MEMADDR, storing the result in GDB's format in
GDB's memory at RESULT. Return zero for success, nonzero if any
error occurs. Implementations of this function may define and use
their own error codes, but functions in the common, nat and target
directories must treat the return code as opaque. No guarantee is
made about the contents of the data at RESULT if any error
occurs. */

extern int target_read_uint32 (CORE_ADDR memaddr, unsigned int *result);

/* Write LEN bytes from MYADDR to target memory at address MEMADDR.
Return zero for success, nonzero if any error occurs.
Implementations of this function may define and use their own error
codes, but functions in the common, nat and target directories must
treat the return code as opaque. No guarantee is made about the
contents of the data at MEMADDR if any error occurs. */

extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
ssize_t len);

Thanks,
Gary

--