public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
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:00 -0000	[thread overview]
Message-ID: <1516809167-10599-1-git-send-email-yao.qi@linaro.org> (raw)

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  <yao.qi@linaro.org>

	* 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.
-- 
1.9.1

             reply	other threads:[~2018-01-24 15:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 15:52 Yao Qi [this message]
2018-01-24 16:03 ` Andreas Schwab
2018-01-24 16:12   ` Yao Qi
2018-02-01 14:51     ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1516809167-10599-1-git-send-email-yao.qi@linaro.org \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).