Re: [PATCH 1/4] Remove the restriction of File I/O functions to regular files only

Simon Marchi
2018-04-30T01:54:54Z

Hi Julio,

Thanks for the patch. I was not familiar with the fileio feature until
now, but I have some generic comments (until someone that might be more
familiar takes a look).

We seem to have a test for fileio already, in
testsuite/gdb.base/fileio.exp. The test sort of runs on native Linux,
but I suppose it doesn't actually test fileio (the debugged program just
accesses the filesystem directly). It's also not supported by
gdbserver. Would it be possible for you to run this test using your
target, see if if it passes before and after your patch? Also, it might
be a good idea to enhance that test to check for the capabilities that
this patch adds (opening/reading a non-regular file).

If you (or Mike who is in CC) would know how to run it, maybe using some
simulator available upstream, I'd be curious to know how.

On 2018-04-27 21:19, Julio Guerra wrote:
> The major goal is being able to write advanced embedded testing
> functions, like:
> - reading/writing to a dedicated fifo between the embedded program and
> the host,
> instead of using the GDB console only.
> - mocking features based on host's.
>
> Tested with
> https://github.com/farjump/raspberry-pi/blob/ea31c48d7c7eed27d39fb1bec2d3a1d308cb8ae7/src/semihosting/semihosting.c
>
> Also answers to an old RFC I did on the ML:
> https://sourceware.org/ml/gdb/2016-07/msg00003.html
>
> 2018-04-28 Julio Guerra <julio@farjump.io>
>
> * gdb/remote-fileio.c: allow using File I/O functions with special
> files.

Remove the "gdb/" part of the filename (the name should be relative to
the ChangeLog location), and capitalize "allow".

Thanks,

Simon