From patchwork Wed Jan 24 15:52:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 25496 Received: (qmail 110386 invoked by alias); 24 Jan 2018 15:52:56 -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 110370 invoked by uid 89); 24 Jan 2018 15:52:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=interactive, H*r:sk:static. X-HELO: mail-wr0-f179.google.com Received: from mail-wr0-f179.google.com (HELO mail-wr0-f179.google.com) (209.85.128.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 Jan 2018 15:52:54 +0000 Received: by mail-wr0-f179.google.com with SMTP id 16so4517223wry.12 for ; Wed, 24 Jan 2018 07:52:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=NFwDZzBZ29+/ELCDv+idB87nGwsR87cUcdNyCQqqvLw=; b=OI7o9cAJbaKgyNs9nyVbGvpjecavZtq0yAj8MDLp/9WRSMPHRSHeqi/h4/yzSbkRMW 4XGJUZDe056oXrurFZWZD80Ss2Zfb6wk9BYYnmPozj8XQFEwEhZ7b/bQY0tZ3T201TRj Fc+t4UIlHwir2Nf26SzPZG+6bDpw2R2AUwaZPUYg6mAa3XtONUhk4kD4HhhTW6GGBZlD GnyU8On5cCbJzq6ZJRXGnn9/e768TWLybXqnxQQignnsUrMdt/trzYjSrtIpYLPSVCrS DvSQQYZKRXEKQvJfjmDHHYuPLQeky3jHLtFB+2Dunjp5N6NT7//F14fUoTgvNbobn/md kKWQ== X-Gm-Message-State: AKwxytcT6Du7i6sq+odu2KsldUVC5+uIw7cvnHijJAM/7ZdL+OwFWN2b OOknLe2gp2kyvX6bkB7KGjmamA== X-Google-Smtp-Source: AH8x227AtBYiq6qJhRL0XsrDYCEEz4WcWqOxAKySmXcctwFFh+esOLmbJRlgS5WcSbSFifdSclYTDA== X-Received: by 10.223.197.72 with SMTP id s8mr6423037wrf.96.1516809172073; Wed, 24 Jan 2018 07:52:52 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id k35sm6127402wrc.2.2018.01.24.07.52.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Jan 2018 07:52:51 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] Fix gdb.base/attach.exp fails when gdb is configured --with-sysroot=/ Date: Wed, 24 Jan 2018 15:52:47 +0000 Message-Id: <1516809167-10599-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes I see some test fails in gdb.base/attach.exp when gdb is configured --with-sysroot=/. FAIL: gdb.base/attach.exp: attach2, with no file FAIL: gdb.base/attach.exp: load file manually, after attach2 (re-read) (got interactive prompt) FAIL: gdb.base/attach.exp: attach when process' a.out not in cwd If gdb is configured this way, sysroot is "/" in default, and if binfile is a absolute path, the regexp pattern $sysroot$escapedbinfile is incorrect. There are different ways to fix it, but I don't want to complicate the test, so I choose this naive way. gdb/testsuite: 2018-01-24 Yao Qi * gdb.base/attach.exp (do_attach_tests): Set sysroot to ".*". --- gdb/testsuite/gdb.base/attach.exp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index d315c27..c30e95d 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -57,15 +57,12 @@ proc do_attach_tests {} { # Figure out a regular expression that will match the sysroot, # 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 "" - set test "show sysroot" - gdb_test_multiple $test $test { - -re "The current system root is \"(.*)\"\..*${gdb_prompt} $" { - set sysroot $expect_out(1,string) - } - } - regsub "^target:" "$sysroot" "(target:)?" sysroot + # operating on the local filesystem. However the default sysroot + # can be set via configure option --with-sysroot, which can be "/". + # If $binfile is a absolute path, so pattern + # "$sysroot$escapedbinfile" below is wrong. Use .* to make + # $sysroot simple. + set sysroot ".*" # Start the program running and then wait for a bit, to be sure # that it can be attached to.