From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 104416 invoked by alias); 9 Jul 2018 15:37:14 -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 104400 invoked by uid 89); 9 Jul 2018 15:37:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Jul 2018 15:37:12 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0FD71400225D; Mon, 9 Jul 2018 15:37:11 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55F832166BA2; Mon, 9 Jul 2018 15:37:10 +0000 (UTC) Subject: Re: [PATCH v4] Allow using special files with File I/O functions To: Julio Guerra , "gdb-patches@sourceware.org" References: <20180705091618.33743-1-julio@farjump.io> <0102016469ba9beb-e8338b53-74bd-46ea-91c7-eea909052532-000000@eu-west-1.amazonses.com> <50cbe319-5b79-24dd-c615-25209d6dd390@redhat.com> <010201647f2fec5a-727b623a-1c7f-4d7e-a9e2-e8076d9e3cc2-000000@eu-west-1.amazonses.com> <263942fb-504c-7eeb-7840-fc4b70a76ed1@redhat.com> <28e7d8d4-7a1a-8fe0-a868-bed711cdb417@farjump.io> <010201647fa337da-17606848-2754-4441-9fed-999f7c238536-000000@eu-west-1.amazonses.com> From: Pedro Alves Message-ID: <3dce8539-9a6b-e641-4088-3af012a76763@redhat.com> Date: Mon, 09 Jul 2018 15:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <010201647fa337da-17606848-2754-4441-9fed-999f7c238536-000000@eu-west-1.amazonses.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-07/txt/msg00217.txt.bz2 On 07/09/2018 04:22 PM, Julio Guerra wrote: > >>>>> Signed-off-by: Julio Guerra >>>> I'm not sure whether I asked this before, but, just in case, >>>> do you have a copyright assignment on file with the FSF? >>>> I looked for one now and couldn't find it. >>>> >>> No, I don't. >> See: >> >> https://sourceware.org/gdb/wiki/ContributionChecklist#FSF_copyright_Assignment >> >> The request-assign.future one is most common one. Please follow the >> instructions at the top of the file. > > Done. Thanks. > >> >>>>> diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c >>>>> index 313da642ea..168590245e 100644 >>>>> --- a/gdb/remote-fileio.c >>>>> +++ b/gdb/remote-fileio.c >>>>> @@ -885,16 +885,9 @@ remote_fileio_func_stat (remote_target *remote, char *buf) >>>>> remote_fileio_return_errno (remote, -1); >>>>> return; >>>>> } >>>>> - /* Only operate on regular files and directories. */ >>>>> - if (!ret && !S_ISREG (st.st_mode) && !S_ISDIR (st.st_mode)) >>>>> - { >>>>> - remote_fileio_reply (remote, -1, FILEIO_EACCES); >>>>> - return; >>>>> - } >>>> What happens if we stat/open some kind of unsupported file type? >>>> Do we end up with st_mode == 0 and report success anyway, or is >>>> something else catching it and returning FILEIO_EACCES or some such? >>>> >>> Yes, bits SFMT of st_mode end up with everything 0 and it doesn't fail. >>> It's like not knowing what kind of file it exactly is, but still get >>> other values. >> Hmm, OK. I mildly worry whether that that might cause trouble. >> I wonder what other filesystem network protocols do here. Like, >> e.g., nfs, sshfs, etc. >> > > The 3 options I see: > 1 - No restrinction: this one. > 2 - Warning: test SFMT bits and when "unsupported", set File IO SFMT > bits to some specific FILEIO_S_UNKNOWN value. > 3 - Restrict: strictly restrict to those SFMT types I added. > > I would go for 1 or 2, to avoid another similar restriction like there > was in open before this patch. OK, let's try going with 1. But please add a comment to the effect somewhere so that it doesn't looks like it happens by accident. >>>> I couldn't tell what's this change for? Why did you need it? >>> I couldn't find any other way of adding some CFLAGS and LDFLAGS to the >>> call to the cross-compiler to link against the libc using File IOs, to >>> add target-specific compilation flags, etc. For example, in my case: >>> >>>> set_board_info fileio,cflags "--specs=$sdk/Alpha.specs >>> -mfloat-abi=hard -mfpu=vfp -march=armv6zk -mtune=arm1176jzf-s" >>>> set_board_info fileio,ldflags "-Wl,-T$sdk/link.ld" >> Is this something really specific to this testcase? Don't you >> need to do the same for all other testcases? > > Yes, every other tests involving cross-compilation and the C library > need the same. > >> Did you try CC_FOR_TARGET/LD_FOR_TARGET? > > I just tried and couldn't make it work. That's strange, because we have a few boards that rely on those. Grep for CC_FOR_TARGET under src/gdb/testsuite/boards/. I actually meant to suggest CFLAGS_FOR_TARGET/LDFLAGS_FOR_TARGET, but I don't think there's a practical difference, just like e.g., "CC=gcc -m32" vs "CFLAGS=-m32" should end up the same in practice. > Common use cases are indeed > adding extra flags but also extra files to be linked (such as the fileio > open, read, write, ... stubs). Thanks, Pedro Alves