Re: [PATCH 3/3 v3] Implement remote_bfd_iovec_stat using vFile:fstat

Pedro Alves
2015-03-11T11:22:22Z

On 03/11/2015 10:23 AM, Gary Benson wrote:
> Pedro Alves wrote:
>>> + if (packet_support (PACKET_vFile_fstat) != PACKET_ENABLE)
>>> + {
>>> + memset (st, 0, sizeof (struct stat));
>>> + st->st_size = INT_MAX;
>>
>> A future reader may wonder why this isn't ENOSYS instead. I think
>> a comment here would help.
>
> How about this:
>
> /* Strictly we should return -1, ENOSYS here, but when
> "set sysroot remote:" was implemented in August 2008
> BFD's need for a stat function was sidestepped with
> this hack. This was not remedied until March 2015
> so we retain the previous behavior to avoid breaking
> compatibility.
>
> Note that the memset is a March 2015 addition; older
> GDBs set st_size *and nothing else* so the structure
> would have garbage in all other fields. This might
> break something but retaining the previous behavior
> here would be just too wrong. */

Thanks.

It also occurred to me something else on the gdbserver patch.
I'll send a follow up.

> Are you ok for me to commit this patch, reordered before the
> gdbserver changes, with extract_unsigned_integer used in
> remote_fileio_to_host_{uint,ulong}, and that comment added?

It be easier for me to just see the patch before answering, but
I think I am, though I'd like to take another look at the docs
patch with everything combined, to cross check whether more
bits would be missing.

I think it'd be good to have a "RSP packets: how to add / best practices
how to document" wiki page/guide, serving as both guidance for
submitters and for cross checking for reviewers, mentioning
things like remembering to document the "set remote foo commands",
qSupported entries, NEWS, etc.

> (I will regenerate patch 2 with updated docs for Eli to
> approve).

Thanks,
Pedro Alves