aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-07 22:32:52 +1030
committerAlan Modra <amodra@gmail.com>2019-12-08 22:03:53 +1030
commitbc754168c7c3fc64e40bb7ddd97ea1ad07fb32d2 (patch)
tree7ad59eaed63d19869be1254f850dac48a42f968a /binutils
parentc14aab8cd3135a86915f4be4ea711b30de674bb3 (diff)
downloadgdb-bc754168c7c3fc64e40bb7ddd97ea1ad07fb32d2.zip
gdb-bc754168c7c3fc64e40bb7ddd97ea1ad07fb32d2.tar.gz
gdb-bc754168c7c3fc64e40bb7ddd97ea1ad07fb32d2.tar.bz2
Optional matching for run_dump_test
This adds an alternative to using #... in dump files, useful where we only want to allow specific extra output. DW_CFA_nop in CIEs and FDEs to pad out to required alignment (larger for 64-bit than 32-bit) is an example where these optional match patterns are useful. binutils/ * testsuite/lib/binutils-common.exp (regexp_diff): Support #?REGEXP. ld/ * testsuite/ld-elf/eh4.d: Match optional padding DW_CFA_nop in FDEs. * testsuite/ld-elf/eh5.d: Likewise, and extra CIEs emitted on embedded targets.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog4
-rw-r--r--binutils/testsuite/lib/binutils-common.exp19
2 files changed, 23 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index d912989..ef72f21 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,7 @@
+2019-12-08 Alan Modra <amodra@gmail.com>
+
+ * testsuite/lib/binutils-common.exp (regexp_diff): Support #?REGEXP.
+
2019-11-22 Andrew Burgess <andrew.burgess@embecosm.com>
* dwarf.c (regname_internal_riscv): New function.
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 3b229ba..f2efa23 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -286,6 +286,10 @@ proc check_shared_lib_support { } {
# REGEXP
# Skip all lines in FILE_1 until the first that matches REGEXP.
#
+# #?REGEXP
+# Optionally match REGEXP against line from FILE_1. If the REGEXP
+# does not match then the next line from FILE_2 is tried.
+#
# Other # lines are comments. Regexp lines starting with the `!' character
# specify inverse matching (use `\!' for literal matching against a leading
# `!'). Skip empty lines in both files.
@@ -372,6 +376,21 @@ proc regexp_diff { file_1 file_2 args } {
}
}
break
+ } elseif { [string match "#\\?*" $line_b] } {
+ if { ! $end_1 } {
+ set line_b [string replace $line_b 0 1]
+ set negated [expr { [string index $line_b 0] == "!" }]
+ set line_bx [string range $line_b $negated end]
+ set n [expr { $negated ? "! " : "" }]
+ # Substitute on the reference.
+ foreach {name value} $ref_subst {
+ regsub -- $name $line_bx $value line_bx
+ }
+ verbose "optional match for $n\"^$line_bx$\"" 3
+ if { [expr [regexp "^$line_bx$" "$line_a"] != $negated] } {
+ break
+ }
+ }
}
if { [gets $file_b line_b] == $eof } {
set end_2 1