aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1994-06-02 23:02:00 +0000
committerPer Bothner <per@bothner.com>1994-06-02 23:02:00 +0000
commitfaa157708bf8653146c1f850b3208ba2e1c1a961 (patch)
tree94bd6646a7a62185d75648f758a75e1ada0af82c /gdb/testsuite/lib
parenta1ade84e4748187c9ceaba6b77d46b6445d915d7 (diff)
downloadgdb-faa157708bf8653146c1f850b3208ba2e1c1a961.zip
gdb-faa157708bf8653146c1f850b3208ba2e1c1a961.tar.gz
gdb-faa157708bf8653146c1f850b3208ba2e1c1a961.tar.bz2
* lib/gdb.exp (string_to_regexp, gdb_test_exact): New procedures.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/gdb.exp21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index cf754f9..126422e 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -258,6 +258,27 @@ proc gdb_test { args } {
return $result
}
+# Given an input string, adds backslashes as needed to create a
+# regexp that will match the string.
+proc string_to_regexp {str} {
+ regsub -all {[]*+.|()^$[]} $str {\\&} result
+ return $result
+}
+
+# Same as gdb_test, but the second parameter is not a regexp,
+# but a string that must match exactly.
+
+proc gdb_test_exact { args } {
+ set command [lindex $args 0]
+ set pattern [string_to_regexp [lindex args 1]]
+ if [llength $args]==3 then {
+ set message [lindex $args 2]
+ } else {
+ set message $command
+ }
+ return [gdb_test $command $pattern $message]
+}
+
proc gdb_reinitialize_dir { subdir } {
global prompt