diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2008-08-26 17:30:35 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2008-08-26 17:30:35 +0000 |
commit | f1838a98418d9912df59591058ca560f2de5cf14 (patch) | |
tree | 6f1a59a1733ab613b344f6d54b7100f6ea468179 /gdb/symfile.c | |
parent | 1cf3db46a678ced9d729572de9232fab9c00350d (diff) | |
download | gdb-f1838a98418d9912df59591058ca560f2de5cf14.zip gdb-f1838a98418d9912df59591058ca560f2de5cf14.tar.gz gdb-f1838a98418d9912df59591058ca560f2de5cf14.tar.bz2 |
ChangeLog:
* remote.h (remote_filename_p, remote_bfd_open): Add prototypes.
* remote.c (remote_bfd_iovec_open, remote_bfd_iovec_close,
remote_bfd_iovec_pread, remote_bfd_iovec_stat, remote_filename_p,
remote_bfd_open): New functions.
(remote_hostio_send_command): Fail safely if remote connection
is not set up.
* solist.h (solib_open): Remove prototype.
(solib_bfd_open): Add prototype.
* solib.c: Include "remote.h".
(solib_open): Remove, replace by ...
(solib_bfd_open): ... this new function. Handle remote BFDs.
(solib_map_sections): Replace solib_open by solib_bfd_open.
* solib-frv.c: Include "exceptions.h".
(enable_break2): Replace solib_open by solib_bfd_open.
* solib-svr4.c: Include "exceptions.h".
(enable_break): Replace solib_open by solib_bfd_open.
* symfile.c: Include "remote.h".
(build_id_verify): Handle remote BFDs.
(separate_debug_file_exists): Use BFD to access file. Handle
remote BFDs.
(symfile_bfd_open): Handle remote BFDs.
(reread_symbols): Handle remote BFDs.
* NEWS: Mention "remote:" argument prefix to "set sysroot".
doc/ChangeLog:
* gdb.texinfo (Commands to Specify Files): Document "remote:"
argument prefix to "set sysroot".
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index faa375b..8d22005 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -53,6 +53,7 @@ #include "varobj.h" #include "elf-bfd.h" #include "solib.h" +#include "remote.h" #include <sys/types.h> #include <fcntl.h> @@ -1216,7 +1217,10 @@ build_id_verify (const char *filename, struct build_id *check) int retval = 0; /* We expect to be silent on the non-existing files. */ - abfd = bfd_openr (filename, gnutarget); + if (remote_filename_p (filename)) + abfd = remote_bfd_open (filename, gnutarget); + else + abfd = bfd_openr (filename, gnutarget); if (abfd == NULL) return 0; @@ -1307,18 +1311,22 @@ static int separate_debug_file_exists (const char *name, unsigned long crc) { unsigned long file_crc = 0; - int fd; + bfd *abfd; gdb_byte buffer[8*1024]; int count; - fd = open (name, O_RDONLY | O_BINARY); - if (fd < 0) + if (remote_filename_p (name)) + abfd = remote_bfd_open (name, gnutarget); + else + abfd = bfd_openr (name, gnutarget); + + if (!abfd) return 0; - while ((count = read (fd, buffer, sizeof (buffer))) > 0) + while ((count = bfd_bread (buffer, sizeof (buffer), abfd)) > 0) file_crc = gnu_debuglink_crc32 (file_crc, buffer, count); - close (fd); + bfd_close (abfd); return crc == file_crc; } @@ -1564,6 +1572,28 @@ symfile_bfd_open (char *name) int desc; char *absolute_name; + if (remote_filename_p (name)) + { + name = xstrdup (name); + sym_bfd = remote_bfd_open (name, gnutarget); + if (!sym_bfd) + { + make_cleanup (xfree, name); + error (_("`%s': can't open to read symbols: %s."), name, + bfd_errmsg (bfd_get_error ())); + } + + if (!bfd_check_format (sym_bfd, bfd_object)) + { + bfd_close (sym_bfd); + make_cleanup (xfree, name); + error (_("`%s': can't read symbols: %s."), name, + bfd_errmsg (bfd_get_error ())); + } + + return sym_bfd; + } + name = tilde_expand (name); /* Returns 1st new malloc'd copy. */ /* Look down path for it, allocate 2nd new malloc'd copy. */ @@ -1594,7 +1624,7 @@ symfile_bfd_open (char *name) { close (desc); make_cleanup (xfree, name); - error (_("\"%s\": can't open to read symbols: %s."), name, + error (_("`%s': can't open to read symbols: %s."), name, bfd_errmsg (bfd_get_error ())); } bfd_set_cacheable (sym_bfd, 1); @@ -1606,7 +1636,7 @@ symfile_bfd_open (char *name) with the bfd). */ bfd_close (sym_bfd); /* This also closes desc. */ make_cleanup (xfree, name); - error (_("\"%s\": can't read symbols: %s."), name, + error (_("`%s': can't read symbols: %s."), name, bfd_errmsg (bfd_get_error ())); } @@ -2307,7 +2337,10 @@ reread_symbols (void) if (!bfd_close (objfile->obfd)) error (_("Can't close BFD for %s: %s"), objfile->name, bfd_errmsg (bfd_get_error ())); - objfile->obfd = bfd_openr (obfd_filename, gnutarget); + if (remote_filename_p (obfd_filename)) + objfile->obfd = remote_bfd_open (obfd_filename, gnutarget); + else + objfile->obfd = bfd_openr (obfd_filename, gnutarget); if (objfile->obfd == NULL) error (_("Can't open %s to read symbols."), objfile->name); /* bfd_openr sets cacheable to true, which is what we want. */ |