This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] Correct semantics of target_read_partial, add target_read_whole
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 28 Jun 2006 12:18:02 +0400
- Subject: Re: [rfc] Correct semantics of target_read_partial, add target_read_whole
- References: <20060622032355.GA27566@nevyn.them.org>
Daniel Jacobowitz wrote:
> +/* Wrappers to perform a full read of unknown size. OBJECT/ANNEX will
> + be read using OPS. The return value will be -1 if the transfer
> + fails or is not supported; 0 if the object is empty; and the length
> + of the object otherwise. If a positive value is returned, a
> + sufficiently large buffer will be allocated using xmalloc and
> + returned in *BUF_P containing the contents of the object.
> +
> + This method should be used for objects sufficiently small to store
> + in a single xmalloced buffer, when no fixed bound on the object's
> + size is known in advance. Don't try to read TARGET_OBJECT_MEMORY
> + through this function. */
> +
> +extern LONGEST target_read_whole (struct target_ops *ops,
> + enum target_object object,
> + const char *annex, gdb_byte **buf_p);
Is there any reason why 'target_read_whole' calls 'target_read', as opposed
to calling 'target_read_partial' directly? I mean, if target_read_whole can
do several reads itself, there's no point to use 'target_read'.
- Volodya