This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 3/5] Rename TARGET_SYSROOT_PREFIX as TARGET_FILENAME_PREFIX
- From: Gary Benson <gbenson at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Pedro Alves <palves at redhat dot com>, Sandra Loosemore <sandra at codesourcery dot com>, Paul_Koning at Dell dot com, Jan Kratochvil <jan dot kratochvil at redhat dot com>, Joel Brobecker <brobecker at adacore dot com>
- Date: Tue, 28 Jul 2015 16:36:10 +0100
- Subject: [PATCH 3/5] Rename TARGET_SYSROOT_PREFIX as TARGET_FILENAME_PREFIX
- Authentication-results: sourceware.org; auth=none
- References: <1438097772-31480-1-git-send-email-gbenson at redhat dot com>
TARGET_SYSROOT_PREFIX is misnamed, as its use is not limited to
the system root. This commit renames it as TARGET_FILENAME_PREFIX.
gdb/ChangeLog:
* gdb_bfd.h (TARGET_SYSROOT_PREFIX): Rename from this...
(TARGET_FILENAME_PREFIX): ...to this. Update all uses.
---
gdb/ChangeLog | 5 +++++
gdb/exec.c | 6 +++---
gdb/gdb_bfd.c | 6 +++---
gdb/gdb_bfd.h | 10 +++++-----
gdb/remote-sim.c | 2 +-
gdb/solib.c | 6 +++---
6 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/gdb/exec.c b/gdb/exec.c
index f1b1049..bbb7798 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -225,7 +225,7 @@ exec_file_attach (const char *filename, int from_tty)
if (is_target_filename (filename))
{
if (target_filesystem_is_local ())
- filename += strlen (TARGET_SYSROOT_PREFIX);
+ filename += strlen (TARGET_FILENAME_PREFIX);
else
load_via_target = 1;
}
@@ -235,8 +235,8 @@ exec_file_attach (const char *filename, int from_tty)
/* gdb_bfd_fopen does not support "target:" filenames. */
if (write_files)
warning (_("writing into executable files is "
- "not supported for %s sysroots"),
- TARGET_SYSROOT_PREFIX);
+ "not supported for %s filenames"),
+ TARGET_FILENAME_PREFIX);
scratch_pathname = xstrdup (filename);
make_cleanup (xfree, scratch_pathname);
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index 1781d80..3afcf5f 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -144,7 +144,7 @@ eq_bfd (const void *a, const void *b)
int
is_target_filename (const char *name)
{
- return startswith (name, TARGET_SYSROOT_PREFIX);
+ return startswith (name, TARGET_FILENAME_PREFIX);
}
/* See gdb_bfd.h. */
@@ -223,7 +223,7 @@ gdb_bfd_iovec_fileio_open (struct bfd *abfd, void *inferior)
gdb_assert (is_target_filename (filename));
fd = target_fileio_open ((struct inferior *) inferior,
- filename + strlen (TARGET_SYSROOT_PREFIX),
+ filename + strlen (TARGET_FILENAME_PREFIX),
FILEIO_O_RDONLY, 0,
&target_errno);
if (fd == -1)
@@ -336,7 +336,7 @@ gdb_bfd_open (const char *name, const char *target, int fd)
gdb_bfd_iovec_fileio_fstat);
}
- name += strlen (TARGET_SYSROOT_PREFIX);
+ name += strlen (TARGET_FILENAME_PREFIX);
}
if (gdb_bfd_cache == NULL)
diff --git a/gdb/gdb_bfd.h b/gdb/gdb_bfd.h
index 8fbdf36..2e1e901 100644
--- a/gdb/gdb_bfd.h
+++ b/gdb/gdb_bfd.h
@@ -27,20 +27,20 @@ DECLARE_REGISTRY (bfd);
/* If supplied a path starting with this sequence, gdb_bfd_open will
open BFDs using target fileio operations. */
-#define TARGET_SYSROOT_PREFIX "target:"
+#define TARGET_FILENAME_PREFIX "target:"
-/* Returns nonzero if NAME starts with TARGET_SYSROOT_PREFIX, zero
+/* Returns nonzero if NAME starts with TARGET_FILENAME_PREFIX, zero
otherwise. */
int is_target_filename (const char *name);
/* Returns nonzero if the filename associated with ABFD starts with
- TARGET_SYSROOT_PREFIX, zero otherwise. */
+ TARGET_FILENAME_PREFIX, zero otherwise. */
int gdb_bfd_has_target_filename (struct bfd *abfd);
/* Open a read-only (FOPEN_RB) BFD given arguments like bfd_fopen.
- If NAME starts with TARGET_SYSROOT_PREFIX then the BFD will be
+ If NAME starts with TARGET_FILENAME_PREFIX then the BFD will be
opened using target fileio operations if necessary. Returns NULL
on error. On success, returns a new reference to the BFD, which
must be freed with gdb_bfd_unref. BFDs returned by this call are
@@ -48,7 +48,7 @@ int gdb_bfd_has_target_filename (struct bfd *abfd);
then after this call it is owned by BFD. If the BFD was not
accessed using target fileio operations then the filename
associated with the BFD and accessible with bfd_get_filename will
- not be exactly NAME but rather NAME with TARGET_SYSROOT_PREFIX
+ not be exactly NAME but rather NAME with TARGET_FILENAME_PREFIX
stripped. */
struct bfd *gdb_bfd_open (const char *name, const char *target, int fd);
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 82c129d..58e1ce3 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -675,7 +675,7 @@ gdbsim_open (const char *args, int from_tty)
sysroot = gdb_sysroot;
if (is_target_filename (sysroot))
- sysroot += strlen (TARGET_SYSROOT_PREFIX);
+ sysroot += strlen (TARGET_FILENAME_PREFIX);
if (remote_debug)
fprintf_unfiltered (gdb_stdlog,
diff --git a/gdb/solib.c b/gdb/solib.c
index eb933c0..32931da 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -167,7 +167,7 @@ solib_find_1 (char *in_pathname, int *fd, int is_solib)
for all local files regardless of whether a "target:" prefix was
used. */
if (is_target_filename (sysroot) && target_filesystem_is_local ())
- sysroot += strlen (TARGET_SYSROOT_PREFIX);
+ sysroot += strlen (TARGET_FILENAME_PREFIX);
/* Strip any trailing slashes from the absolute prefix. */
prefix_len = orig_prefix_len = strlen (sysroot);
@@ -239,7 +239,7 @@ solib_find_1 (char *in_pathname, int *fd, int is_solib)
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 (TARGET_SYSROOT_PREFIX, sysroot) == 0);
+ || strcmp (TARGET_FILENAME_PREFIX, sysroot) == 0);
/* Cat the prefixed pathname together. */
temp_pathname = concat (sysroot,
@@ -1477,7 +1477,7 @@ 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;
+ const char *new_prefix = TARGET_FILENAME_PREFIX;
if (startswith (gdb_sysroot, old_prefix))
{
--
1.7.1