summaryrefslogtreecommitdiff
path: root/gdb/solib.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-04-02 13:38:29 +0100
committerGary Benson <gbenson@redhat.com>2015-04-02 13:38:29 +0100
commit2938e6cf0809cd81d1593f414ea5836812e68ed2 (patch)
tree96a1f27dddd0331a1db735698d611fc53d60c8ca /gdb/solib.c
parentf08e97fed19e0722b6b36e7e638ee86a8aca7db5 (diff)
Convert "remote:" sysroots to "target:" and remove "remote:"
The functionality of "target:" sysroots is a superset of the functionality of "remote:" sysroots. This commit causes the "set sysroot" command to rewrite "remote:" sysroots as "target:" sysroots and replaces "remote:" specific code with "target:" specific code where still necessary. gdb/ChangeLog: * remote.h (REMOTE_SYSROOT_PREFIX): Remove definition. (remote_filename_p): Remove declaration. (remote_bfd_open): Likewise. * remote.c (remote_bfd_iovec_open): Remove function. (remote_bfd_iovec_close): Likewise. (remote_bfd_iovec_pread): Likewise. (remote_bfd_iovec_stat): Likewise. (remote_filename_p): Likewise. (remote_bfd_open): Likewise. * symfile.h (gdb_bfd_open_maybe_remote): Remove declaration. * symfile.c (separate_debug_file_exists): Use gdb_bfd_open. (gdb_bfd_open_maybe_remote): Remove function. (symfile_bfd_open): Replace remote filename check with target filename check. (reread_symbols): Use gdb_bfd_open. * build-id.c (gdbcore.h): New include. (build_id_to_debug_bfd): Use gdb_bfd_open. * infcmd.c (attach_command_post_wait): Remove remote filename check. * solib.c (solib_find): Replace remote-specific handling with target-specific handling. Update comments where necessary. (solib_bfd_open): Replace remote-specific handling with target-specific handling. (gdb_sysroot_changed): New function. (_initialize_solib): Call the above when gdb_sysroot changes. * windows-tdep.c (gdbcore.h): New include. (windows_xfer_shared_library): Use gdb_bfd_open.
Diffstat (limited to 'gdb/solib.c')
-rw-r--r--gdb/solib.c64
1 files changed, 42 insertions, 22 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index c8138ef7a8..2ec265a9aa 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -236,17 +236,17 @@ solib_find (char *in_pathname, int *fd)
|-----------------+-----------+----------------|
| /some/dir | / | c:/foo/bar.dll |
| /some/dir | | /foo/bar.dll |
- | remote: | | c:/foo/bar.dll |
- | remote: | | /foo/bar.dll |
- | remote:some/dir | / | c:/foo/bar.dll |
- | remote:some/dir | | /foo/bar.dll |
+ | target: | | c:/foo/bar.dll |
+ | target: | | /foo/bar.dll |
+ | target:some/dir | / | c:/foo/bar.dll |
+ | target:some/dir | | /foo/bar.dll |
IOW, we don't need to add a separator if IN_PATHNAME already
- has one, or when the the sysroot is exactly "remote:".
+ has one, or when the the sysroot is exactly "target:".
There's no need to check for drive spec explicitly, as we only
get here if IN_PATHNAME is considered an absolute path. */
need_dir_separator = !(IS_DIR_SEPARATOR (in_pathname[0])
- || strcmp (REMOTE_SYSROOT_PREFIX, sysroot) == 0);
+ || strcmp (TARGET_SYSROOT_PREFIX, sysroot) == 0);
/* Cat the prefixed pathname together. */
temp_pathname = concat (sysroot,
@@ -254,8 +254,8 @@ solib_find (char *in_pathname, int *fd)
in_pathname, (char *) NULL);
}
- /* Handle remote files. */
- if (remote_filename_p (temp_pathname))
+ /* Handle files to be accessed via the target. */
+ if (is_target_filename (temp_pathname))
{
*fd = -1;
do_cleanups (old_chain);
@@ -382,20 +382,10 @@ solib_find (char *in_pathname, int *fd)
bfd *
solib_bfd_fopen (char *pathname, int fd)
{
- bfd *abfd;
+ bfd *abfd = gdb_bfd_open (pathname, gnutarget, fd);
- if (remote_filename_p (pathname))
- {
- gdb_assert (fd == -1);
- abfd = remote_bfd_open (pathname, gnutarget);
- }
- else
- {
- abfd = gdb_bfd_open (pathname, gnutarget, fd);
-
- if (abfd)
- bfd_set_cacheable (abfd, 1);
- }
+ if (abfd != NULL && !gdb_bfd_has_target_filename (abfd))
+ bfd_set_cacheable (abfd, 1);
if (!abfd)
{
@@ -1403,6 +1393,36 @@ reload_shared_libraries (char *ignored, int from_tty,
ops->special_symbol_handling ();
}
+/* Wrapper for reload_shared_libraries that replaces "remote:"
+ at the start of gdb_sysroot with "target:". */
+
+static void
+gdb_sysroot_changed (char *ignored, int from_tty,
+ struct cmd_list_element *e)
+{
+ const char *old_prefix = "remote:";
+ const char *new_prefix = TARGET_SYSROOT_PREFIX;
+
+ if (startswith (gdb_sysroot, old_prefix))
+ {
+ static int warning_issued = 0;
+
+ gdb_assert (strlen (old_prefix) == strlen (new_prefix));
+ memcpy (gdb_sysroot, new_prefix, strlen (new_prefix));
+
+ if (!warning_issued)
+ {
+ warning (_("\"%s\" is deprecated, use \"%s\" instead."),
+ old_prefix, new_prefix);
+ warning (_("sysroot set to \"%s\"."), gdb_sysroot);
+
+ warning_issued = 1;
+ }
+ }
+
+ reload_shared_libraries (ignored, from_tty, e);
+}
+
static void
show_auto_solib_add (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
@@ -1597,7 +1617,7 @@ Show the current system root."), _("\
The system root is used to load absolute shared library symbol files.\n\
For other (relative) files, you can add directories using\n\
`set solib-search-path'."),
- reload_shared_libraries,
+ gdb_sysroot_changed,
NULL,
&setlist, &showlist);