From: Pedro Alves <palves@redhat.com>
To: Julio Guerra <julio@farjump.io>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH v4] Allow using special files with File I/O functions
Date: Mon, 09 Jul 2018 15:37:00 -0000 [thread overview]
Message-ID: <3dce8539-9a6b-e641-4088-3af012a76763@redhat.com> (raw)
In-Reply-To: <010201647fa337da-17606848-2754-4441-9fed-999f7c238536-000000@eu-west-1.amazonses.com>
On 07/09/2018 04:22 PM, Julio Guerra wrote:
>
>>>>> Signed-off-by: Julio Guerra <julio@farjump.io>
>>>> 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
prev parent reply other threads:[~2018-07-09 15:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180705091618.33743-1-julio@farjump.io>
2018-07-05 9:16 ` Julio Guerra
2018-07-09 12:47 ` Pedro Alves
[not found] ` <a74d27a4-64c9-adcd-deaf-f36e0c03e73d@farjump.io>
2018-07-09 13:16 ` Julio Guerra
2018-07-09 14:37 ` Pedro Alves
[not found] ` <28e7d8d4-7a1a-8fe0-a868-bed711cdb417@farjump.io>
2018-07-09 15:22 ` Julio Guerra
2018-07-09 15:37 ` Pedro Alves [this message]
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=3dce8539-9a6b-e641-4088-3af012a76763@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=julio@farjump.io \
/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