static bfd_boolean close_one (void) { register bfd *to_kill; if (bfd_last_cache == NULL) to_kill = NULL; else { for (to_kill = bfd_last_cache->lru_prev; ! to_kill->cacheable; to_kill = to_kill->lru_prev) { if (to_kill == bfd_last_cache) { to_kill = NULL; break; } } } if (to_kill == NULL) { /* There are no open cacheable BFD's. */ return TRUE; } to_kill->where = _bfd_real_ftell ((FILE *) to_kill->iostream); return bfd_cache_delete (to_kill); }
bfd_boolean bfd_cache_close (bfd *abfd) { if (abfd->iovec != &cache_iovec) return TRUE; if (abfd->iostream == NULL) /* Previously closed. */ return TRUE; return bfd_cache_delete (abfd); }
static bfd_boolean close_one (void) { register bfd *kill; if (bfd_last_cache == NULL) kill = NULL; else { for (kill = bfd_last_cache->lru_prev; ! kill->cacheable; kill = kill->lru_prev) { if (kill == bfd_last_cache) { kill = NULL; break; } } } if (kill == NULL) { /* There are no open cacheable BFD's. */ return TRUE; } kill->where = real_ftell ((FILE *) kill->iostream); /* Save the file st_mtime. This is a hack so that gdb can detect when an executable has been deleted and recreated. The only thing that makes this reasonable is that st_mtime doesn't change when a file is unlinked, so saving st_mtime makes BFD's file cache operation a little more transparent for this particular usage pattern. If we hadn't closed the file then we would not have lost the original contents, st_mtime etc. Of course, if something is writing to an existing file, then this is the wrong thing to do. FIXME: gdb should save these times itself on first opening a file, and this hack be removed. */ if (kill->direction == no_direction || kill->direction == read_direction) { bfd_get_mtime (kill); kill->mtime_set = TRUE; } return bfd_cache_delete (kill); }
static void DEFUN_VOID(close_one) { bfd *kill = cache_sentinel; if (kill == 0) /* Nothing in the cache */ return ; /* We can only close files that want to play this game. */ while (!kill->cacheable) { kill = kill->lru_prev; if (kill == cache_sentinel) /* Nobody wants to play */ return ; } kill->where = ftell((FILE *)(kill->iostream)); bfd_cache_delete(kill); }