[PATCH 5/8] Share code on to_xfer_partial for tfile and ctf target

Pedro Alves palves@redhat.com
Thu Feb 20 13:17:00 GMT 2014


On 02/12/2014 06:05 AM, Yao Qi wrote:

> +enum target_xfer_status
> +exec_read_only_xfer_partial (gdb_byte *readbuf, ULONGEST offset,
> +			     ULONGEST len, ULONGEST *xfered_len)

I think 'TARGET _ METHOD _ OVERLOAD_REASON' is clearer and
results in a better interface when we end up with multiple
overloads (thinking ahead).  E.g.:

 exec_xfer_partial_read_only
 exec_xfer_partial_loaded_only

vs:

 exec_read_only_xfer_partial
 exec_loaded_only_xfer_partial

etc.

Also nicer for discovery with tab completion, IMO.

Another nit is that so far, we've tended to reserve "xfer" for functions
that take both a read and write argument, using "read" and "write"
explicitly in the signature instead in functions that do only
one of the directions.  E.g., target_read_partial,
target_write_partial.  I think following that results in a
least surpristing API.  IOW, I think this function name would
be clearer:

enum target_xfer_status
exec_read_partial_read_only (gdb_byte *readbuf, ULONGEST offset,
			     ULONGEST len, ULONGEST *xfered_len)

Otherwise looks good to me.  Thanks!

-- 
Pedro Alves



More information about the Gdb-patches mailing list