This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/3 v2] Implement vFile:fstat: packet in gdbserver


On 03/11/2015 10:33 AM, Gary Benson wrote:

> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -36062,6 +36062,11 @@ These are the currently defined stub features and their properties:
>  @tab @samp{-}
>  @tab No
>  
> +@item @samp{vFile:fstat}
> +@tab No
> +@tab @samp{-}
> +@tab Yes
> +
>  @end multitable
>  
>  These are the currently defined stub features, in more detail:
> @@ -36250,6 +36255,9 @@ breakpoints.
>  The remote stub reports the @samp{hwbreak} stop reason for hardware
>  breakpoints.
>  
> +@item vFile:fstat
> +The remote stub understands the @samp{vFile:fstat} packet.
> +

Thanks, combined with the "set remote ..." bit, I think that was
all that was missing.

>  @end table
>  
>  @item qSymbol::
> @@ -37411,6 +37419,13 @@ packet is used.  @samp{vFile:write} returns the number of bytes written,
>  which may be shorter than the length of @var{data}, or -1 if an
>  error occurred.
>  
> +@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}.
> +

I still think that we should mention the need for the qSupported feature
here.  This is because the other vFile:XXX packets don't have associated
qSupported features - GDB just tries them out and detects empty
response (probes them).

For example for the recent "swbreak" feature, I added:

 The remote stub must also supply the appropriate @samp{qSupported}
 feature indicating support.

> +
> +  remote_fileio_to_fio_stat (&st, &fst);
> +
> +  bytes_sent = hostio_reply_with_data (own_buf,
> +				       (char *) &fst, sizeof (fst),
> +				       new_packet_len);
> +
> +  /* If the response does not fit into a single packet, do not attempt
> +     to return a partial response, but simply fail.  */
> +  if (bytes_sent < sizeof (fst))
> +    sprintf (own_buf, "F-1,%x", FILEIO_ENOSYS);

It occurred to me that this -1 case isn't really an error with the
syscall, but rather a protocol error.  Thus, shouldn't this really
be an RSP E01 error ?

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]