From patchwork Tue Jul 28 15:36:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 7896 Received: (qmail 104344 invoked by alias); 28 Jul 2015 15:36:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 104154 invoked by uid 89); 28 Jul 2015 15:36:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 28 Jul 2015 15:36:18 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 968393640F5; Tue, 28 Jul 2015 15:36:16 +0000 (UTC) Received: from blade.nx (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6SFaFGa001891; Tue, 28 Jul 2015 11:36:15 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 0B4C4264F11; Tue, 28 Jul 2015 16:36:15 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Cc: Pedro Alves , Sandra Loosemore , Paul_Koning@Dell.com, Jan Kratochvil , Joel Brobecker Subject: [PATCH 3/5] Rename TARGET_SYSROOT_PREFIX as TARGET_FILENAME_PREFIX Date: Tue, 28 Jul 2015 16:36:10 +0100 Message-Id: <1438097772-31480-4-git-send-email-gbenson@redhat.com> In-Reply-To: <1438097772-31480-1-git-send-email-gbenson@redhat.com> References: <1438097772-31480-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes 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)) {