Re: [PATCH 2/3 v5] Implement remote_bfd_iovec_stat

Pedro Alves
2015-03-11T13:52:54Z

On 03/11/2015 01:39 PM, Gary Benson wrote:
> This patch implements the function remote_bfd_iovec_stat using a
> vFile:fstat hostio call to the remote target. If vFile:fstat is
> not supported GDB creates a dummy result by zeroing the supplied
> stat structure and then setting it's st_size field to INT_MAX.
> This mimic's GDB's previous behaviour, with the exception that
> GDB did not previously zero the structure so all other fields
> would have been returned unchanged, which is to say very likely
> populated with random values from the stack.

Note this reads as if the packet already existed. It should
be updated to say something like:

Subject: Add "vFile:fstat:", implement remote_bfd_iovec_stat

This patch adds a new packet "vFile:fstat:" to gdb.
This can be used by to retrieve information about files that have
been previously open with vFile:open.
This patch then implements the function remote_bfd_iovec_stat using a
vFile:fstat hostio call to the remote target. If vFile:fstat is
not supported GDB creates a dummy result by zeroing the supplied
stat structure and then setting it's st_size field to INT_MAX.
This mimic's GDB's previous behaviour, with the exception that
GDB did not previously zero the structure so all other fields
would have been returned unchanged, which is to say very likely
populated with random values from the stack.

> +@item vFile:fstat: @var{fd}
> +Get information about the open file corresponding to @var{fd}.
> +On success the information is returned as a binary attachment
> +and the return value is the size of this attachment in bytes.
> +If an error occurs the return value is -1. The format of the
> +returned binary attachment is as described in @ref{struct stat}.
> +
> +This packet is not probed by default; the remote stub must request
> +it, by supplying an appropriate @samp{qSupported} response
> +(@pxref{qSupported}).

Thanks for adding this. The patch looks great to me now.

Thanks,
Pedro Alves