[gdb/testsuite] Add -early pattern flag for gdb_test_multiple
authorTom de Vries <tdevries@suse.de>
Wed, 30 Oct 2019 16:41:03 +0000 (17:41 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 30 Oct 2019 16:41:03 +0000 (17:41 +0100)
commit60b6ede84503a340cbb3d4f76e874e702d69812f
tree16673d15bb009def7034a36e1739e989ee3ab7a2
parent808590ec5af20db08005885559fe29ebe7128b48
[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
gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp
This page took 0.028033 seconds and 4 git commands to generate.