[rfa] Add the bfd_iovec
Ian Lance Taylor
ian@wasabisystems.com
Mon Apr 12 19:23:00 GMT 2004
Andrew Cagney <cagney@gnu.org> writes:
> Following up on earlier threads:
> http://sources.redhat.com/ml/binutils/2004-02/msg00167.html
> This adds an IOVEC to BFD. The IOVEC lets the client open a BFD on an
> arbitrary object (file, memory, GDB inferior, ...). The attached
> implements the iovec and then converts the file-io backend.
> Converting the memory bfd to an IOVEC is a follow-on change.
In general, I like it, but:
* bfd_iovec needs each entry point to be clearly documented,
particularly how error conditions are handled.
* I'm not crazy about the berror entry point. Right now it is used in
exactly one place, to indicate whether a short read is an error or
simply a truncated file. Since bfd_iovec is only going to be called
by BFD routines, I think it would be quite reasonable to make the
bread entry point responsible for calling bfd_set_error. Then the
caller does not need to go back in to find out what a short read
means. Note also that berror is the only function which doesn't
have an obvious mapping to a Unix system call.
* The same error handling principle could apply to all the other
bfd_iovec routines as well, of course. Compare with bfd_malloc, for
example: it just calls malloc and bfd_set_error, to centralize error
handling. I think we should use these routines to put the error
handling in the place which really knows what the error is. But I'm
certainly open to a counter argument.
Ian
More information about the Binutils
mailing list