From patchwork Tue Jul 28 15:36:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 7897 Received: (qmail 20866 invoked by alias); 28 Jul 2015 15:45:43 -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 20853 invoked by uid 89); 28 Jul 2015 15:45:42 -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:45:42 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 75E25BACC4; Tue, 28 Jul 2015 15:36:17 +0000 (UTC) Received: from blade.nx (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6SFaGIb031277; Tue, 28 Jul 2015 11:36:17 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 3A16B264F13; 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 5/5] Update exec_file_find callers Date: Tue, 28 Jul 2015 16:36:12 +0100 Message-Id: <1438097772-31480-6-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 This commit updates the two callers of exec_file_find to make the call regardless of what gdb_sysroot is set to. Also, one of the callers used exec_file_find for absolute filenames only, but the other used it in all cases. The latter is probably wrong, and has been updated to only use exec_file_find for absolute filenames. gdb/ChangeLog: * exec.c (exec_file_locate_attach): Use exec_file_find regardless of what gdb_sysroot is set to. * infrun.c (follow_exec): Likewise, but only if the new filename is absolute. --- gdb/ChangeLog | 7 +++++++ gdb/exec.c | 6 +++--- gdb/infrun.c | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gdb/exec.c b/gdb/exec.c index bbb7798..dcfa971 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -152,9 +152,9 @@ exec_file_locate_attach (int pid, int from_tty) if (exec_file == NULL) return; - /* If gdb_sysroot is not empty and the discovered filename - is absolute then prefix the filename with gdb_sysroot. */ - if (*gdb_sysroot != '\0' && IS_ABSOLUTE_PATH (exec_file)) + /* If the discovered filename is absolute then prefix the filename + with the target prefix (if necessary) and gdb_sysroot. */ + if (IS_ABSOLUTE_PATH (exec_file)) full_exec_path = exec_file_find (exec_file, NULL); if (full_exec_path == NULL) diff --git a/gdb/infrun.c b/gdb/infrun.c index 445a612..0b4f867 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -61,6 +61,7 @@ #include "target-dcache.h" #include "terminal.h" #include "solist.h" +#include "filenames.h" /* Prototypes for local functions */ @@ -1133,7 +1134,9 @@ follow_exec (ptid_t ptid, char *execd_pathname) breakpoint_init_inferior (inf_execd); - if (*gdb_sysroot != '\0') + /* If the discovered filename is absolute then prefix the filename + with the target prefix (if necessary) and gdb_sysroot. */ + if (IS_ABSOLUTE_PATH (execd_pathname)) { char *name = exec_file_find (execd_pathname, NULL);