From patchwork Fri Aug 21 21:21:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 8357 Received: (qmail 106483 invoked by alias); 21 Aug 2015 21:21:29 -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 106361 invoked by uid 89); 21 Aug 2015 21:21:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no 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; Fri, 21 Aug 2015 21:21:25 +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 F2A9E60 for ; Fri, 21 Aug 2015 21:21:23 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7LLLJZO019908 for ; Fri, 21 Aug 2015 17:21:20 -0400 Subject: [PATCH v12 09/32] Change sysroot to ":target:" From: Jan Kratochvil To: gdb-patches@sourceware.org Date: Fri, 21 Aug 2015 23:21:18 +0200 Message-ID: <20150821212118.6673.6454.stgit@host1.jankratochvil.net> In-Reply-To: <20150821212006.6673.35100.stgit@host1.jankratochvil.net> References: <20150821212006.6673.35100.stgit@host1.jankratochvil.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-IsSubscribed: yes Hi, that is try "" first and "target:" second. Various performance problems should be fixed by trying to look up the remote file first on local filesystem. Thanks to build-ids it is quick and safe to verify both files are the same build. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * NEWS (Changes since GDB 7.10): Mention sysroot. * main.c (captured_main): Initialize new gdb_sysroot. gdb/testsuite/ChangeLog * gdb.base/attach.exp (do_attach_tests): Update sysroot parsing. * gdb.base/break-probes.exp: Likewise. --- gdb/testsuite/gdb.base/attach.exp | 7 +++++-- gdb/testsuite/gdb.base/break-probes.exp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index f5a01e8..a45aaa6 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -38,6 +38,9 @@ show debug bfd-cache * The "set sysroot" (and "show sysroot") commands now permit multiple directory paths. +* Default sysroot has changed to ":target:", that is first host files + and then target files are tried. + * New options set validate-build-id (on|off) diff --git a/gdb/main.c b/gdb/main.c index aecd60a..a17ee34 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -548,7 +548,11 @@ captured_main (void *data) if (gdb_sysroot == NULL || *gdb_sysroot == '\0') { xfree (gdb_sysroot); - gdb_sysroot = xstrdup (TARGET_SYSROOT_PREFIX); + + /* Try first the local filesystem, + TARGET_SYSROOT_PREFIX is a fallback. */ + gdb_sysroot = xstrprintf ("%c%s", DIRNAME_SEPARATOR, + TARGET_SYSROOT_PREFIX); } debug_file_directory = relocate_gdb_directory (DEBUGDIR, diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index bf0d84e..a879e33 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -67,7 +67,7 @@ proc do_attach_tests {} { global timeout # Figure out a regular expression that will match the sysroot, - # noting that the default sysroot is "target:", and also noting + # noting that the default sysroot is ":target:", and also noting # that GDB will strip "target:" from the start of filenames when # operating on the local filesystem set sysroot "" @@ -77,7 +77,10 @@ proc do_attach_tests {} { set sysroot $expect_out(1,string) } } - regsub "^target:" "$sysroot" "(target:)?" sysroot + # Use only the first element of $sysroot which will hopefully + # successfully match the filename. + regsub "^target:(\[^:\]*):.*$" "$sysroot" "" sysroot + regsub "^(?!target:)(\[^:\]*):.*$" "$sysroot" "" sysroot # Start the program running and then wait for a bit, to be sure # that it can be attached to. diff --git a/gdb/testsuite/gdb.base/break-probes.exp b/gdb/testsuite/gdb.base/break-probes.exp index 00ca458..0431aa3 100644 --- a/gdb/testsuite/gdb.base/break-probes.exp +++ b/gdb/testsuite/gdb.base/break-probes.exp @@ -67,8 +67,11 @@ if { $using_probes } { } # GDB strips "target:" from the start of filenames - # when operating on the local filesystem - regsub "^target:" "$sysroot" "(target:)?" sysroot + # when operating on the local filesystem. + # Also use only the first element of $sysroot which will hopefully + # successfully match the filename. + regsub "^target:(\[^:\]*):.*$" "$sysroot" "" sysroot + regsub "^(?!target:)(\[^:\]*):.*$" "$sysroot" "" sysroot # Run til it loads our library set test "run til our library loads"