aboutsummaryrefslogtreecommitdiff
path: root/bfd/cache.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-05-02 04:11:40 +0000
committerJohn Gilmore <gnu@cygnus>1991-05-02 04:11:40 +0000
commitfc7233808a1d88db99a5181e1ee0f6865f8f5206 (patch)
tree2f0626920d2d237a52aae12eccd0d5b8dd54ec1c /bfd/cache.c
parentff37ea550b842cdb18aca531e5e705c03d4eed72 (diff)
downloadgdb-fc7233808a1d88db99a5181e1ee0f6865f8f5206.zip
gdb-fc7233808a1d88db99a5181e1ee0f6865f8f5206.tar.gz
gdb-fc7233808a1d88db99a5181e1ee0f6865f8f5206.tar.bz2
Merge devo/bfd with GDB's bfd.
Remove obstack.h to ../include and obstack.c to ../libiberty. Move COFF symbol swapping code to coffswap.c where GDB can call it but it won't be duplicated if we have N different COFF targets. Add support for traditional Unix core files (with a upage). This support is from an Ultrix port, but is probably slightly broken now. Improve bfd_release's of obstack'd items on error returns. gcc -Wall fixes. Handle section alignment slightly better in coff, and comment where it needs more work (on page-aligning virtual vs file addresses for DPAGED). Use set_tdata everywhere that tdata is set, to avoid "cast to the left of assignment" problems with some compilers. Move bfd_alloc, bfd_zalloc, bfd_realloc, and bfd_release into libbfd.h (from bfd.h) since they are internal routines. Remove the redundant suffix "_struct" from struct tags. Set symbol count early in file reading, before slurping in the syms, for GDB's use.
Diffstat (limited to 'bfd/cache.c')
-rw-r--r--bfd/cache.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/bfd/cache.c b/bfd/cache.c
index d1172fb..c3418ea 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -23,13 +23,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "libbfd.h"
-/* These declarations should not be needed; libbfd.h's inclusion should
- have handled it.
- int fclose();
- int fseek();
-*/
-
-
/* The maximum number of FDs opened by bfd */
#define BFD_CACHE_MAX_OPEN 10
@@ -38,10 +31,14 @@ static int open_files;
static bfd *cache_sentinel; /* Chain of bfds with active fds we've
opened */
-static void
-bfd_cache_delete();
-bfd *bfd_last_cache;
+bfd *bfd_last_cache; /* Zero, or a pointer to the topmost
+ bfd on the chain. This is used by the
+ bfd_cache_lookup() macro in libbfd.h
+ to determine when it can avoid a function
+ call. */
+
+static void bfd_cache_delete();
static void
@@ -60,8 +57,8 @@ DEFUN_VOID(close_one)
kill->where = ftell((FILE *)(kill->iostream));
bfd_cache_delete(kill);
-
}
+
/* Cuts the bfd abfd out of the chain in the cache */
static void
DEFUN(snip,(abfd),
@@ -135,12 +132,12 @@ DEFUN(bfd_open_file, (abfd),
close_one();
}
switch (abfd->direction) {
- case read_direction:
- case no_direction:
+ case read_direction:
+ case no_direction:
abfd->iostream = (char *) fopen(abfd->filename, "r");
break;
- case both_direction:
- case write_direction:
+ case both_direction:
+ case write_direction:
if (abfd->opened_once == true) {
abfd->iostream = (char *) fopen(abfd->filename, "r+");
if (!abfd->iostream) {