Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Reimplement "vFile:fstat" without qSupported
@ 2015-03-17 11:04 Gary Benson
  2015-03-17 11:09 ` Eli Zaretskii
  2015-03-18  9:25 ` Pedro Alves
  0 siblings, 2 replies; 4+ messages in thread
From: Gary Benson @ 2015-03-17 11:04 UTC (permalink / raw)
  To: gdb-patches

Hi all,

When I implemented the vFile:fstat packet the other week I didn't
understand how support for the other vFile packets was negotiated.
I implemented it using qSupported to indicate support, which means
the vFile:fstat packet is handled differently from all other vFile
packets--and for no good reason.

This commit makes support for the vFile:fstat packet be determined
by probing rather than using qSupported.  This makes it consistent
with all other vFile packets.

Built and regtested on RHEL 6.6 x86_64.

Ok to commit?

Thanks,
Gary

---
gdb/ChangeLog:

	(remote_protocol_features): Remove the "vFile:fstat" feature.
	(remote_hostio_fstat): Probe for "vFile:fstat" support.

gdb/doc/ChangeLog:

	* gdb.texinfo (General Query Packets): Remove documentation
	for now-removed vFile:fstat qSupported features.

gdb/gdbserver/ChangeLog:

	* server.c (handle_query): Do not report vFile:fstat as supported.
---
 gdb/ChangeLog           |    5 +++++
 gdb/doc/ChangeLog       |    5 +++++
 gdb/doc/gdb.texinfo     |   12 ------------
 gdb/gdbserver/ChangeLog |    5 ++++-
 gdb/gdbserver/server.c  |    2 --
 gdb/remote.c            |   24 +++++++++++-------------
 6 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 9e71642..552da31 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -36062,11 +36062,6 @@ These are the currently defined stub features and their properties:
 @tab @samp{-}
 @tab No
 
-@item @samp{vFile:fstat}
-@tab No
-@tab @samp{-}
-@tab No
-
 @end multitable
 
 These are the currently defined stub features, in more detail:
@@ -36255,9 +36250,6 @@ 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.
-
 @end table
 
 @item qSymbol::
@@ -37426,10 +37418,6 @@ 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}).
-
 @item vFile:unlink: @var{filename}
 Delete the file at @var{filename} on the target.  Return 0,
 or -1 if an error occurs.  The @var{filename} is a string.
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 9ff2f8e..08dbb60 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -2082,8 +2082,6 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
       if (target_supports_stopped_by_hw_breakpoint ())
 	strcat (own_buf, ";hwbreak+");
 
-      strcat (own_buf, ";vFile:fstat+");
-
       return;
     }
 
diff --git a/gdb/remote.c b/gdb/remote.c
index 9aaee13..dfa68b3 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4049,8 +4049,6 @@ static const struct protocol_feature remote_protocol_features[] = {
     PACKET_Qbtrace_conf_bts_size },
   { "swbreak", PACKET_DISABLE, remote_supported_packet, PACKET_swbreak_feature },
   { "hwbreak", PACKET_DISABLE, remote_supported_packet, PACKET_hwbreak_feature },
-  { "vFile:fstat", PACKET_DISABLE, remote_supported_packet,
-    PACKET_vFile_fstat },
 };
 
 static char *remote_support_xml;
@@ -10084,8 +10082,18 @@ remote_hostio_fstat (struct target_ops *self,
   struct fio_stat fst;
   int read_len;
 
-  if (packet_support (PACKET_vFile_fstat) != PACKET_ENABLE)
+  remote_buffer_add_string (&p, &left, "vFile:fstat:");
+
+  remote_buffer_add_int (&p, &left, fd);
+
+  ret = remote_hostio_send_command (p - rs->buf, PACKET_vFile_fstat,
+				    remote_errno, &attachment,
+				    &attachment_len);
+  if (ret < 0)
     {
+      if (*remote_errno != FILEIO_ENOSYS)
+	return ret;
+
       /* 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
@@ -10104,16 +10112,6 @@ remote_hostio_fstat (struct target_ops *self,
       return 0;
     }
 
-  remote_buffer_add_string (&p, &left, "vFile:fstat:");
-
-  remote_buffer_add_int (&p, &left, fd);
-
-  ret = remote_hostio_send_command (p - rs->buf, PACKET_vFile_fstat,
-				    remote_errno, &attachment,
-				    &attachment_len);
-  if (ret < 0)
-    return ret;
-
   read_len = remote_unescape_input ((gdb_byte *) attachment, attachment_len,
 				    (gdb_byte *) &fst, sizeof (fst));
 
-- 
1.7.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Reimplement "vFile:fstat" without qSupported
  2015-03-17 11:04 [PATCH] Reimplement "vFile:fstat" without qSupported Gary Benson
@ 2015-03-17 11:09 ` Eli Zaretskii
  2015-03-18  9:25 ` Pedro Alves
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2015-03-17 11:09 UTC (permalink / raw)
  To: Gary Benson; +Cc: gdb-patches

> From: Gary Benson <gbenson@redhat.com>
> Date: Tue, 17 Mar 2015 11:04:08 +0000
> 
> When I implemented the vFile:fstat packet the other week I didn't
> understand how support for the other vFile packets was negotiated.
> I implemented it using qSupported to indicate support, which means
> the vFile:fstat packet is handled differently from all other vFile
> packets--and for no good reason.
> 
> This commit makes support for the vFile:fstat packet be determined
> by probing rather than using qSupported.  This makes it consistent
> with all other vFile packets.
> 
> Built and regtested on RHEL 6.6 x86_64.
> 
> Ok to commit?

OK for the documentation part.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Reimplement "vFile:fstat" without qSupported
  2015-03-17 11:04 [PATCH] Reimplement "vFile:fstat" without qSupported Gary Benson
  2015-03-17 11:09 ` Eli Zaretskii
@ 2015-03-18  9:25 ` Pedro Alves
  2015-03-18 11:25   ` Gary Benson
  1 sibling, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2015-03-18  9:25 UTC (permalink / raw)
  To: Gary Benson, gdb-patches

On 03/17/2015 11:04 AM, Gary Benson wrote:
> Hi all,
> 
> When I implemented the vFile:fstat packet the other week I didn't
> understand how support for the other vFile packets was negotiated.
> I implemented it using qSupported to indicate support, which means
> the vFile:fstat packet is handled differently from all other vFile
> packets--and for no good reason.
> 
> This commit makes support for the vFile:fstat packet be determined
> by probing rather than using qSupported.  This makes it consistent
> with all other vFile packets.
> 
> Built and regtested on RHEL 6.6 x86_64.
> 
> Ok to commit?

OK.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Reimplement "vFile:fstat" without qSupported
  2015-03-18  9:25 ` Pedro Alves
@ 2015-03-18 11:25   ` Gary Benson
  0 siblings, 0 replies; 4+ messages in thread
From: Gary Benson @ 2015-03-18 11:25 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Eli Zaretskii, gdb-patches

Pedro Alves wrote:
> On 03/17/2015 11:04 AM, Gary Benson wrote:
> > When I implemented the vFile:fstat packet the other week I didn't
> > understand how support for the other vFile packets was negotiated.
> > I implemented it using qSupported to indicate support, which means
> > the vFile:fstat packet is handled differently from all other vFile
> > packets--and for no good reason.
> > 
> > This commit makes support for the vFile:fstat packet be determined
> > by probing rather than using qSupported.  This makes it consistent
> > with all other vFile packets.
> > 
> > Built and regtested on RHEL 6.6 x86_64.
> > 
> > Ok to commit?
> 
> OK.

Thanks Eli, Pedro, this is pushed now.

Cheers,
Gary

-- 
http://gbenson.net/


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-18 11:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17 11:04 [PATCH] Reimplement "vFile:fstat" without qSupported Gary Benson
2015-03-17 11:09 ` Eli Zaretskii
2015-03-18  9:25 ` Pedro Alves
2015-03-18 11:25   ` Gary Benson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox