From: Gary Benson <gbenson@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/3 v3] Implement remote_bfd_iovec_stat using vFile:fstat
Date: Wed, 11 Mar 2015 10:23:00 -0000 [thread overview]
Message-ID: <20150311102310.GB3698@blade.nx> (raw)
In-Reply-To: <54FF39AD.2040707@redhat.com>
Pedro Alves wrote:
> On 03/10/2015 03:51 PM, Gary Benson wrote:
> > +/* Unpack an fio_uint_t. */
> > +
> > +static unsigned int
> > +remote_fileio_to_host_uint (fio_uint_t fnum)
> > +{
> > + gdb_byte *buf, *lim;
> > + unsigned int num = 0;
> > +
> > + for (buf = (gdb_byte *) fnum, lim = buf + 4; buf < lim; buf++)
> > + {
> > + num <<= 8;
> > + num |= *buf;
> > + }
>
> How about we use
>
> extract_unsigned_integer ((gdb_byte *) fnum, 4, BFD_ENDIAN_BIG)
>
> instead?
Ok.
> > + into ST. Return 0 on success, or -1 if an error occurs (and
> > + set *REMOTE_ERRNO). */
> > +
> > +static int
> > +remote_hostio_fstat (struct target_ops *self,
> > + int fd, struct stat *st,
> > + int *remote_errno)
> > +{
> > + struct remote_state *rs = get_remote_state ();
> > + char *p = rs->buf;
> > + int left = get_remote_packet_size ();
> > + int attachment_len, ret;
> > + char *attachment;
> > + struct fio_stat fst;
> > + int read_len;
> > +
> > + 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. */
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?
(I will regenerate patch 2 with updated docs for Eli to
approve).
Thanks,
Gary
next prev parent reply other threads:[~2015-03-11 10:23 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-09 11:58 [PATCH 0/3] Properly implement remote_bfd_iovec_stat Gary Benson
2015-03-09 11:58 ` [PATCH 3/3] Implement remote_bfd_iovec_stat using vFile:fstat Gary Benson
2015-03-09 16:17 ` Eli Zaretskii
2015-03-10 9:32 ` Gary Benson
2015-03-10 16:40 ` Eli Zaretskii
2015-03-10 11:20 ` [PATCH 3/3 v2] " Gary Benson
2015-03-10 15:51 ` [PATCH 3/3 v3] " Gary Benson
2015-03-10 18:31 ` Pedro Alves
2015-03-10 18:36 ` Pedro Alves
2015-03-11 10:23 ` Gary Benson [this message]
2015-03-11 11:22 ` Pedro Alves
2015-03-11 12:58 ` [PATCH 3/3 v4] Implement remote_bfd_iovec_stat Gary Benson
2015-03-11 13:15 ` Pedro Alves
2015-03-11 13:16 ` Gary Benson
2015-03-11 13:39 ` [PATCH 0/3 v2] Gary Benson
2015-03-11 18:04 ` [PATCH 0/3 v2] Properly implement remote_bfd_iovec_stat Gary Benson
2015-03-11 13:40 ` [PATCH 2/3 v5] Implement remote_bfd_iovec_stat Gary Benson
2015-03-11 13:52 ` Pedro Alves
2015-03-11 13:40 ` [PATCH 1/3] Move remote_fileio_to_fio_stat to gdb/common Gary Benson
2015-03-11 13:40 ` [PATCH 3/3 v3] Implement vFile:fstat: packet in gdbserver Gary Benson
2015-03-11 13:53 ` Pedro Alves
2015-03-09 11:58 ` [PATCH 2/3] Add vFile:fstat: packet to gdbserver Gary Benson
2015-03-10 18:31 ` Pedro Alves
2015-03-11 10:33 ` [PATCH 2/3 v2] Implement vFile:fstat: packet in gdbserver Gary Benson
2015-03-11 11:35 ` Pedro Alves
2015-03-11 16:00 ` Eli Zaretskii
2015-03-09 11:58 ` [PATCH 1/3] Move remote_fileio_to_fio_stat to gdb/common Gary Benson
2015-03-10 18:30 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150311102310.GB3698@blade.nx \
--to=gbenson@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).