[gdb/testsuite] Add -early pattern flag for gdb_test_multiple
Proc gdb_test_multiple builds up and executes a gdb_expect expression with
pattern/action clauses. The clauses are either implicit (added by
gdb_test_multiple) or explicit (passed via the gdb_test_multiple parameter
user_code).
However, there are a few implicit clauses which are inserted before the
explicit ones, making sure those take precedence.
Add an -early pattern flag for a gdb_test_multiple user_code clause to specify
that the clause needs to be inserted before any implicit clause.
Using this pattern flag, we can f.i. setup a kfail for an assertion failure
<assert> during gdb_continue_to_breakpoint by the rewrite:
...
gdb_continue_to_breakpoint <msg> <pattern>
...
into:
...
set breakpoint_pattern "(?:Breakpoint|Temporary breakpoint) .* (at|in)"
gdb_test_multiple "continue" "continue to breakpoint: <msg>" {
-early -re "internal-error: <assert>" {
setup_kfail gdb/nnnnn "*-*-*"
exp_continue
}
-re "$breakpoint_pattern <pattern>\r\n$gdb_prompt $" {
pass $gdb_test_name
}
}
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-30 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_test_multiple): Handle -early pattern flag.
Change-Id: I376c636b0812be52e7137634b1a4f50bf2b999b6