From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74363 invoked by alias); 11 Mar 2015 10:23:23 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 74350 invoked by uid 89); 11 Mar 2015 10:23:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 11 Mar 2015 10:23:12 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2BANBoA005698 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 11 Mar 2015 06:23:11 -0400 Received: from blade.nx (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2BANAke003569; Wed, 11 Mar 2015 06:23:11 -0400 Received: by blade.nx (Postfix, from userid 1000) id 29623265072; Wed, 11 Mar 2015 10:23:10 +0000 (GMT) Date: Wed, 11 Mar 2015 10:23:00 -0000 From: Gary Benson To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 3/3 v3] Implement remote_bfd_iovec_stat using vFile:fstat Message-ID: <20150311102310.GB3698@blade.nx> References: <1425986407-18203-1-git-send-email-gbenson@redhat.com> <1426002678-30472-1-git-send-email-gbenson@redhat.com> <54FF39AD.2040707@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54FF39AD.2040707@redhat.com> X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00274.txt.bz2 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