* [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* Re: [PATCH] Escape backslash in windows path
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
0 siblings, 1 reply; 4+ messages in thread
From: Keith Seitz @ 2014-03-29 6:04 UTC (permalink / raw)
To: Yao Qi, gdb-patches
On 03/28/2014 06:53 PM, Yao Qi wrote:
> 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
> }
> }
Does string_to_regexp work for this?
Keith
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Escape backslash in windows path
2014-03-29 6:04 ` Keith Seitz
@ 2014-03-31 1:06 ` Yao Qi
2014-04-03 6:56 ` Yao Qi
0 siblings, 1 reply; 4+ messages in thread
From: Yao Qi @ 2014-03-31 1:06 UTC (permalink / raw)
To: Keith Seitz; +Cc: gdb-patches
On 03/29/2014 02:04 PM, Keith Seitz wrote:
>> + # Escape backslash in case HOME is a windows path.
>> > + regsub -all {\\} $HOME {\\\\} HOME
>> > pass $test
>> > }
>> > }
> Does string_to_regexp work for this?
Yes, I didn't know this procedure before. Update the patch using
string_to_regexp.
--
Yao (é½å°§)
gdb/testsuite:
2014-03-31 Yao Qi <yao@codesourcery.com>
* gdb.base/setshow.exp: Invoke string_to_regexp to HOME and PWD.
---
gdb/testsuite/gdb.base/setshow.exp | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp
index 13da410..639ca72 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"
--
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