diff options
author | John Gilmore <gnu@cygnus> | 1991-05-09 23:48:26 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1991-05-09 23:48:26 +0000 |
commit | 2203f786c8976ce32d97fda1610b598b41c7d38e (patch) | |
tree | a07351321bd4a3e3d8c2514945e3a0e5d0c250e6 /bfd/libbfd.c | |
parent | 7564d3d74a92d82d8e03b556eb9842b860e1db7e (diff) | |
download | gdb-2203f786c8976ce32d97fda1610b598b41c7d38e.zip gdb-2203f786c8976ce32d97fda1610b598b41c7d38e.tar.gz gdb-2203f786c8976ce32d97fda1610b598b41c7d38e.tar.bz2 |
Add bfd_generic_get_section_contents.
Diffstat (limited to 'bfd/libbfd.c')
-rw-r--r-- | bfd/libbfd.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/bfd/libbfd.c b/bfd/libbfd.c index f278a9c..ec6a223 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -325,10 +325,22 @@ _do_putllong (data, addr) addr[2] = (bfd_byte)(data >> 16); addr[3] = (bfd_byte)(data >> 24); } + +/* Default implementation */ - - - - - - +boolean +bfd_generic_get_section_contents (abfd, section, location, offset, count) + bfd *abfd; + sec_ptr section; + PTR location; + file_ptr offset; + int count; +{ + if (count == 0) + return true; + if (offset >= section->size + || bfd_seek(abfd, section->filepos + offset, SEEK_SET) == -1 + || bfd_read(location, 1, count, abfd) != count) + return (false); /* on error */ + return (true); +} |