From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28840 invoked by alias); 2 Dec 2014 17:01:52 -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 28823 invoked by uid 89); 2 Dec 2014 17:01:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 02 Dec 2014 17:01:50 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 98883116775; Tue, 2 Dec 2014 12:01:48 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 3HJrQvrTO8TP; Tue, 2 Dec 2014 12:01:48 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 38BAE11666C; Tue, 2 Dec 2014 12:01:48 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 830C346B60; Tue, 2 Dec 2014 21:01:44 +0400 (RET) Date: Tue, 02 Dec 2014 17:01:00 -0000 From: Joel Brobecker To: Yao Qi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 3/7] Import lstat Message-ID: <20141202170144.GA9407@adacore.com> References: <1416980800-21408-1-git-send-email-yao@codesourcery.com> <1416980800-21408-4-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1416980800-21408-4-git-send-email-yao@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-12/txt/msg00032.txt.bz2 > This patch is to import lstat gnulib module. > > gdb: > > 2014-11-26 Yao Qi > > * gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add > lstat. > * gnulib/aclocal.m4: Re-generated. > * gnulib/config.in: Re-generated. > * gnulib/configure: Re-generated. > * gnulib/import/Makefile.am: Re-generated. > * gnulib/import/Makefile.in: Re-generated. > * gnulib/import/m4/gnulib-cache.m4: Re-generated. > * gnulib/import/m4/gnulib-comp.m4: Re-generated. > * gnulib/import/lstat.c: New file. > * gnulib/import/m4/lstat.m4: New file. For the record, I think this patch causes a build failure in remote-sim.c on Windows hosts: In file included from /[...]/gdb/remote-sim.c:34:0: /[...]/gdb/../include/gdb/callback.h:93:9: error: duplicate member '_stati64' int (*lstat) (host_callback *, const char *, struct stat *); ^ What happens it that gnulib's stat.h makes the following defines: /* Large File Support on native Windows. */ #if 1 # define stat _stati64 #endif and then: #if 1 # if ! 0 /* mingw does not support symlinks, therefore it does not have lstat. But without links, stat does just fine. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lstat stat # endif So, the following fields in struct host_callback_struct... int (*stat) (host_callback *, const char *, struct stat *); int (*fstat) (host_callback *, int, struct stat *); int (*lstat) (host_callback *, const char *, struct stat *); ... get translated to... int (*_stati64) (host_callback *, const char *, struct _stati64 *); int (*_fstati64) (host_callback *, int, struct _stati64 *); int (*_stati64) (host_callback *, const char *, struct _stati64 *); ... which causes two fields to have the same name. I think the only reasonable way out to avoid this sort of issue, short of reverting the patch, is to do the same as in struct target_ops, where the names of the fields start with "to_...". I'll work on the immediate problem, which is to rename those 3 fields, but I think we'll want to be consistent and rename them all. For instance "ftruncate" also got translated: int (*ftruncate64) (host_callback *, int, long); Same for lseek (->lseek64), rename (->rpl_rename). No actual harm in those cases, but it shows that those translations do happen. -- Joel