aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/gdb-utils.exp
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-05-14 08:04:22 -0600
committerTom Tromey <tromey@adacore.com>2019-05-22 13:59:52 -0400
commit18125b163947bfd0c358d4a5acf4e0e3b43b64cf (patch)
tree38476e9c4b49f58f798ad1b176f4b2cc72e20778 /gdb/testsuite/lib/gdb-utils.exp
parentaf1a8d038798bef11471e28d999ad1687312a6a7 (diff)
downloadgdb-18125b163947bfd0c358d4a5acf4e0e3b43b64cf.zip
gdb-18125b163947bfd0c358d4a5acf4e0e3b43b64cf.tar.gz
gdb-18125b163947bfd0c358d4a5acf4e0e3b43b64cf.tar.bz2
Add "style" proc to the test suite
This adds a "style" helper proc to the test suite, and updates existing style tests to use it. Thanks to Sergio for the idea. Tested on x86-64 Fedora 29. gdb/testsuite/ChangeLog 2019-05-22 Tom Tromey <tromey@adacore.com> * gdb.base/info-shared.exp (check_info_shared): Use "style". * gdb.base/style.exp: Use "style". * lib/gdb-utils.exp (style): New proc.
Diffstat (limited to 'gdb/testsuite/lib/gdb-utils.exp')
-rw-r--r--gdb/testsuite/lib/gdb-utils.exp18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index 26bbbf5..a656788 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -37,3 +37,21 @@ proc string_to_regexp {str} {
regsub -all {[]*+.|(){}^$\[\\]} $str {\\&} result
return $result
}
+
+# Wrap STR in an ANSI terminal escape sequences -- one to set the
+# style to STYLE, and one to reset the style to the default. The
+# return value is suitable for use as a regular expression.
+
+# STYLE can either be the payload part of an ANSI terminal sequence,
+# or a shorthand for one of the gdb standard styles: "file",
+# "function", "variable", or "address".
+
+proc style {str style} {
+ switch -exact -- $style {
+ file { set style 32 }
+ function { set style 33 }
+ variable { set style 36 }
+ address { set style 34 }
+ }
+ return "\033\\\[${style}m${str}\033\\\[m"
+}