Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Escape backslash in windows path
@ 2014-03-29  1:56 Yao Qi
  2014-03-29  6:04 ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Yao Qi @ 2014-03-29  1:56 UTC (permalink / raw)
  To: gdb-patches

Hi,
On windows host, we see the following ERROR,

(gdb) PASS: gdb.base/setshow.exp: set history filename ~/foobar.baz
ERROR OCCURED: couldn't compile regular expression pattern: invalid escape \ sequence
    while executing
"expect -nobrace -i exp13 -timeout 10 -re {.*A problem internal to GDB has been
detected} {
	    fail "$message (GDB internal error)"
	    gdb_internal..."
    invoked from within
"expect {
-i exp13 -timeout 10
	-re ".*A problem internal to GDB has been detected" {
	    fail "$message (GDB internal error)"
	    gdb_internal_erro..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $body" REGEXP REG_EESCAPE {invalid escape \ sequence} couldn't compile
regular expression pattern: invalid escape \ sequenceERROR: Process no longer exists

which leads to
UNRESOLVED: gdb.base/setshow.exp: show history filename (~/foobar.baz)

and this error is thrown from this test below:

gdb_test "show history filename" \
    "The filename in which to record the command history is \"$HOME/foobar.baz\"..*" \
    "show history filename (~/foobar.baz)"

HOME is a windows path, like C:\foo\bar.  When it is used in gdb_test to match
output, the error is thrown because backslash is a special character in
regular expression.  This patch is to escape backslash to fix this error.

This patch is obvious to me, and I'll commit it in a few days.

gdb/testsuite:

2014-03-29  Yao Qi  <yao@codesourcery.com>

	* gdb.base/setshow.exp: Escape backslash in HOME and PWD.
---
 gdb/testsuite/gdb.base/setshow.exp |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp
index 13da410..0feb729 100644
--- a/gdb/testsuite/gdb.base/setshow.exp
+++ b/gdb/testsuite/gdb.base/setshow.exp
@@ -171,6 +171,8 @@ set test "show environment HOME"
 gdb_test_multiple $test $test {
     -re "\nHOME = (\[^\r\n\]*)\[\r\n\]+$gdb_prompt $" {
         set HOME $expect_out(1,string)
+	# Escape backslash in case HOME is a windows path.
+	regsub -all {\\} $HOME {\\\\} HOME
         pass $test
     }
 }
@@ -187,6 +189,8 @@ set test "show working directory"
 gdb_test_multiple "pwd" $test {
     -re "\nWorking directory (\[^\r\n\]*)\\.\[\r\n\]+$gdb_prompt $" {
         set PWD $expect_out(1,string)
+	# Escape backslash in case PWD is a windows path.
+	regsub -all {\\} $PWD {\\\\} PWD
         pass $test
     }
 }
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-03  6:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-29  1:56 [PATCH] Escape backslash in windows path Yao Qi
2014-03-29  6:04 ` Keith Seitz
2014-03-31  1:06   ` Yao Qi
2014-04-03  6:56     ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox