diff options
author | Don Breazeal <donb@codesourcery.com> | 2016-07-15 11:19:19 -0700 |
---|---|---|
committer | Don Breazeal <donb@codesourcery.com> | 2016-07-15 11:19:19 -0700 |
commit | 37539ebee2ea9fc0daceaae1074a79de88d563fb (patch) | |
tree | 4e57deaea2cd3707113d3d386d3ed55d97daeaec /gdb/testsuite/gdb.stabs | |
parent | 76359541825cf36ecd14ab6b5974ee56e1c59eff (diff) |
GDB testsuite: Escape paths used in regular expressions
This patch fixes problems with a few GDB testsuites when executing in a
path that contains special characters (e.g. "++"). When such paths are
used as a regular expression, the regular expression parser will choke
and cause the tests to fail. This patch uses string_to_regexp to
escape strings that will be used as regular expressions, in order to
sanitize path names used in expect scripts.
2016-07-15 Zachary Welch <zwelch@codesourcery.com>
Don Breazeal <donb@codesourcery.com>
gdb/testsuite/ChangeLog:
* gdb.base/maint.exp: Escape paths used in regular expressions.
* gdb.stabs/weird.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.stabs')
-rw-r--r-- | gdb/testsuite/gdb.stabs/weird.exp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.stabs/weird.exp b/gdb/testsuite/gdb.stabs/weird.exp index fa418ed696..2a8ef3ec51 100644 --- a/gdb/testsuite/gdb.stabs/weird.exp +++ b/gdb/testsuite/gdb.stabs/weird.exp @@ -284,6 +284,7 @@ gdb_reinitialize_dir $srcdir/$subdir set binfile [gdb_remote_download host ${binfile} \ [standard_output_file object.o]] +set binfile_re [string_to_regexp $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 @@ -300,7 +301,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 $" { |