aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfdio.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2012-01-10 11:51:09 +0000
committerTristan Gingold <gingold@adacore.com>2012-01-10 11:51:09 +0000
commit660722b0e2ddd2d0efcc01f7f9f9e4a3dd31326e (patch)
tree50ea9f03b1e26a2b2282cb5bc0ed804752b8caa0 /bfd/bfdio.c
parent158184ac9e4ab97b97c6a9bb840db46661901585 (diff)
downloadgdb-660722b0e2ddd2d0efcc01f7f9f9e4a3dd31326e.zip
gdb-660722b0e2ddd2d0efcc01f7f9f9e4a3dd31326e.tar.gz
gdb-660722b0e2ddd2d0efcc01f7f9f9e4a3dd31326e.tar.bz2
2012-01-10 Tristan Gingold <gingold@adacore.com>
* bfdio.c (bfd_tell): Handle nested archives. (bfd_seek): Ditto. * cache.c (bfd_cache_lookup_worker): Ditto. * archive.c (_bfd_get_elt_at_filepos): Remove code dealing with nested archives. (bfd_generic_openr_next_archived_file): Likewise.
Diffstat (limited to 'bfd/bfdio.c')
-rw-r--r--bfd/bfdio.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index f8c9f3e..c142c17 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -233,10 +233,14 @@ bfd_tell (bfd *abfd)
if (abfd->iovec)
{
+ bfd *parent_bfd = abfd;
ptr = abfd->iovec->btell (abfd);
- if (abfd->my_archive)
- ptr -= abfd->origin;
+ while (parent_bfd->my_archive != NULL)
+ {
+ ptr -= parent_bfd->origin;
+ parent_bfd = parent_bfd->my_archive;
+ }
}
else
ptr = 0;
@@ -308,8 +312,16 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
}
file_position = position;
- if (direction == SEEK_SET && abfd->my_archive != NULL)
- file_position += abfd->origin;
+ if (direction == SEEK_SET)
+ {
+ bfd *parent_bfd = abfd;
+
+ while (parent_bfd->my_archive != NULL)
+ {
+ file_position += parent_bfd->origin;
+ parent_bfd = parent_bfd->my_archive;
+ }
+ }
if (abfd->iovec)
result = abfd->iovec->bseek (abfd, file_position, direction);