* lib/gdb.exp (string_to_regexp, gdb_test_exact): New procedures.
authorPer Bothner <per@bothner.com>
Thu, 2 Jun 1994 23:02:00 +0000 (23:02 +0000)
committerPer Bothner <per@bothner.com>
Thu, 2 Jun 1994 23:02:00 +0000 (23:02 +0000)
gdb/testsuite/lib/gdb.exp

index cf754f9723e6134f34cbf15441cff0a37385a048..126422e082a1a3196435592b5dc1e0f4b9417456 100644 (file)
@@ -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
 
This page took 0.025164 seconds and 4 git commands to generate.