summaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/gdb-utils.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/lib/gdb-utils.exp')
-rw-r--r--gdb/testsuite/lib/gdb-utils.exp9
1 files changed, 9 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index 7e03cbf33d9..0af437ea185 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -28,3 +28,12 @@ proc gdb_init_commands {} {
}
return $commands
}
+
+# Given an input string, adds backslashes as needed to create a
+# regexp that will match the string.
+
+proc string_to_regexp {str} {
+ set result $str
+ regsub -all {[]*+.|()^$\[\\]} $str {\\&} result
+ return $result
+}