From: Tom de Vries Date: Wed, 9 Oct 2024 09:17:41 +0000 (+0200) Subject: [gdb/testsuite] Fix gdb.base/reggroups.exp with check-read1 X-Git-Tag: gdb-16-branchpoint~696 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2ae9b1b2d7e5feb0fd734f91250fc5dd187767a5;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Fix gdb.base/reggroups.exp with check-read1 On aarch64-linux, with make target check-read1, I run into: ... (gdb) info reg vector^M ... d19 {f = 0x0, u = 0x0, s = 0x0} {f =FAIL: gdb.base/reggroups.exp: fetch reggroup regs vector (timeout) 0, u = 0, s = 0}^M ... The problem is that while (as documented) the corresponding gdb_test_multiple doesn't work for vector registers, it doesn't skip them either. This causes the timeout, and it also causes the registers after a vector register not to be found. Fix this by using -lbl style matching. Make which reggroups and registers are found more explicit using verbose -log, which makes us notice that regnames with underscores are skipped, so fix that as well. While we're at it, this: ... set invalid_register_re "Invalid register .*" ... and this: ... -re $invalid_register_re { fail "$test (unexpected invalid register response)" } ... means that the prompt may or may not be consumed. Fix this by limiting the regexp to one line, and using exp_continue. While we're at it, improve readability of the complex regexp matching a single register by factoring out regexps. Tested on aarch64-linux and x86_64-linux. --- diff --git a/gdb/testsuite/gdb.base/reggroups.exp b/gdb/testsuite/gdb.base/reggroups.exp index f96153b9368..56c00e58831 100644 --- a/gdb/testsuite/gdb.base/reggroups.exp +++ b/gdb/testsuite/gdb.base/reggroups.exp @@ -27,7 +27,7 @@ if {![runto_main]} { return 0 } -set invalid_register_re "Invalid register .*" +set invalid_register_re "Invalid register \[^\r\n\]*" # Fetch all reggroups from 'maint print reggroups'. @@ -51,6 +51,7 @@ proc fetch_reggroups {test} { } } + verbose -log "found reggroups: $reggroups" return $reggroups } @@ -78,21 +79,34 @@ proc fetch_reggroup_regs {reggroup test} { # xmm0 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, ... }} # set regs {} - gdb_test_multiple "info reg $reggroup" $test { - -re "info reg $reggroup\r\n" { + set have_invalid_register_fail 0 + set re_regname "\[0-9a-zA-Z_-\]+" + set re_hws "\[ \t\]+" + set re_hs "\[^\n\r\]+" + set re_eol "\r\n" + set re_lookahead_eol "(?=$re_eol)" + gdb_test_multiple "info reg $reggroup" $test -lbl { + -re "^info reg $reggroup" { exp_continue } - -re "^(\[0-9a-zA-Z-\]+)\[ \t\]+(0x\[0-9a-f\]+)\[ \t\]+(\[^\n\r\]+)\r\n" { + -re "^${re_eol}($re_regname)$re_hws$::hex$re_hws${re_hs}$re_lookahead_eol" { lappend regs $expect_out(1,string) exp_continue } -re $invalid_register_re { - fail "$test (unexpected invalid register response)" + set have_invalid_register_fail 1 + exp_continue } - -re "$gdb_prompt $" { - pass $test + -re -wrap "" { + if { $have_invalid_register_fail } { + fail "$test (unexpected invalid register response)" + } else { + pass $test + } } } + + verbose -log "found regs in reggroup $reggroup: [join $regs]" return $regs }