From 9810b41048d4fc230ec5e124ecdead4a3a9598ec Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Sat, 29 Mar 2014 09:41:02 +0800 Subject: [PATCH] Escape backslash in windows path 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 \ seq uence 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 ex ists 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 by using string_to_regexp. gdb/testsuite: 2014-04-03 Yao Qi * gdb.base/setshow.exp: Invoke string_to_regexp to HOME and PWD. --- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.base/setshow.exp | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 51f2a70a12..bf7c7a65d6 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-04-03 Yao Qi + + * gdb.base/setshow.exp: Invoke string_to_regexp to HOME and PWD. + 2014-04-01 Anton Blanchard * gdb.arch/ppc64-atomic-inst.exp: Use untested. Make test diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp index 13da4101cc..639ca723ad 100644 --- a/gdb/testsuite/gdb.base/setshow.exp +++ b/gdb/testsuite/gdb.base/setshow.exp @@ -179,7 +179,7 @@ gdb_test_no_output "set history filename ~/foobar.baz" \ "set history filename ~/foobar.baz" #test show history filename ~/foobar.baz gdb_test "show history filename" \ - "The filename in which to record the command history is \"$HOME/foobar.baz\"..*" \ + "The filename in which to record the command history is \"[string_to_regexp $HOME]/foobar.baz\"..*" \ "show history filename (~/foobar.baz)" #get current working directory set PWD "" @@ -195,7 +195,7 @@ gdb_test_no_output "set history filename foobar.baz" \ "set history filename foobar.baz" #test show history filename foobar.baz gdb_test "show history filename" \ - "The filename in which to record the command history is \"$PWD/foobar.baz\"..*" \ + "The filename in which to record the command history is \"[string_to_regexp $PWD]/foobar.baz\"..*" \ "show history filename (current_directory/foobar.baz)" #test set history save on gdb_test_no_output "set history save on" "set history save on" -- 2.34.1