From: Zachary T Welch <zwelch@codesourcery.com>
To: Pedro Alves <palves@redhat.com>, <gdb-patches@sourceware.org>
Cc: Zachary T Welch <zwelch@codesourcery.com>
Subject: [PATCH v2] Escape paths used in regular expressions
Date: Wed, 10 Feb 2016 17:47:00 -0000 [thread overview]
Message-ID: <1455126461-9616-1-git-send-email-zwelch@codesourcery.com> (raw)
In-Reply-To: <56BB6967.4070503@redhat.com>
On 02/10/2016 08:46 AM, Pedro Alves wrote:
...
>> * gdb.exp (escape_regex_chars): New.
>
> Seems like you reinvented string_to_regexp.
How does this version look?
*gdb.base/maint.exp: Escape paths used in regular expressions.
* gdb.stabs/weird.exp: Likewise.
Signed-off-by: Zachary T Welch <zwelch@codesourcery.com>
---
gdb/testsuite/gdb.base/maint.exp | 15 +++++++++------
gdb/testsuite/gdb.stabs/weird.exp | 3 ++-
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index f444018..b33ae26 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -213,12 +213,13 @@ gdb_test "maint print psymbols" \
if { ! $have_gdb_index } {
set psymbols_output [standard_output_file psymbols_output]
+ set psymbols_output_re [string_to_regex $psymbols_output]
send_gdb "maint print psymbols $psymbols_output ${srcdir}/${subdir}/${srcfile}\n"
gdb_expect {
- -re "^maint print psymbols $psymbols_output \[^\n\]*\r\n$gdb_prompt $" {
+ -re "^maint print psymbols $psymbols_output_re \[^\n\]*\r\n$gdb_prompt $" {
send_gdb "shell ls $psymbols_output\n"
gdb_expect {
- -re "$psymbols_output\r\n$gdb_prompt $" {
+ -re "$psymbols_output_re\r\n$gdb_prompt $" {
# We want this grep to be as specific as possible,
# so it's less likely to match symbol file names in
# psymbols_output. Yes, this actually happened;
@@ -253,12 +254,13 @@ gdb_test "maint print msymbols" \
set msymbols_output [standard_output_file msymbols_output]
+set msymbols_output_re [string_to_regex $msymbols_output]
send_gdb "maint print msymbols $msymbols_output ${binfile}\n"
gdb_expect {
- -re "^maint print msymbols $msymbols_output \[^\n\]*\r\n$gdb_prompt $" {
+ -re "^maint print msymbols $msymbols_output_re \[^\n\]*\r\n$gdb_prompt $" {
send_gdb "shell ls $msymbols_output\n"
gdb_expect {
- -re "$msymbols_output\r\n$gdb_prompt $" {
+ -re "$msymbols_output_re\r\n$gdb_prompt $" {
send_gdb "shell grep factorial $msymbols_output\n"
gdb_expect {
-re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" {
@@ -331,12 +333,13 @@ gdb_test "maint print symbols" \
# for GNU libc.
set symbols_output [standard_output_file symbols_output]
+set symbols_output_re [string_to_regex $symbols_output]
send_gdb "maint print symbols $symbols_output ${srcdir}/${subdir}/${srcfile}\n"
gdb_expect {
- -re "^maint print symbols $symbols_output \[^\n\]*\r\n$gdb_prompt $" {
+ -re "^maint print symbols $symbols_output_re \[^\n\]*\r\n$gdb_prompt $" {
send_gdb "shell ls $symbols_output\n"
gdb_expect {
- -re "$symbols_output\r\n$gdb_prompt $" {
+ -re "$symbols_output_re\r\n$gdb_prompt $" {
# See comments for `maint print psymbols'.
send_gdb "shell grep 'main(.*block' $symbols_output\n"
gdb_expect {
diff --git a/gdb/testsuite/gdb.stabs/weird.exp b/gdb/testsuite/gdb.stabs/weird.exp
index 73f8b52..4f1f117 100644
--- a/gdb/testsuite/gdb.stabs/weird.exp
+++ b/gdb/testsuite/gdb.stabs/weird.exp
@@ -294,6 +294,7 @@ gdb_reinitialize_dir $srcdir/$subdir
set binfile [gdb_remote_download host ${binfile} \
[standard_output_file object.o]]
+set binfile_re [string_to_regex $binfile]
send_gdb "file $binfile\n"
# If $binfile is very long, a \r (but not a \n) will echo in the
# middle of the echo of the command. So to match the echo, we
@@ -310,7 +311,7 @@ gdb_expect 60 {
send_gdb "y\n"
exp_continue
}
- -re "^Reading symbols from .*$binfile\\.\\.\\.done\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)\r\n$gdb_prompt $" {
+ -re "^Reading symbols from .*$binfile_re\\.\\.\\.done\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)\r\n$gdb_prompt $" {
pass "weirdx.o read without error"
}
-re ".*$gdb_prompt $" {
--
1.8.1.1
next prev parent reply other threads:[~2016-02-10 17:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-10 16:40 [PATCH] GDB testsuite: " Zachary T Welch
2016-02-10 16:46 ` Pedro Alves
2016-02-10 17:47 ` Zachary T Welch [this message]
2016-02-10 17:53 ` [PATCH v2] " Pedro Alves
2016-07-12 22:28 ` Don Breazeal
2016-07-15 13:34 ` Yao Qi
2016-07-15 18:24 ` [pushed] " Don Breazeal
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=1455126461-9616-1-git-send-email-zwelch@codesourcery.com \
--to=zwelch@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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