From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id C38FE385742C; Tue, 14 Jun 2022 09:06:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C38FE385742C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix regexp in gdb.ada/mi_var_access.exp X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: a7e29f797cecd5a2f73c27838b09eae1f1b6c657 X-Git-Newrev: c5a72a8d1c321fcf8ea1c5dc742f273a7429fd56 Message-Id: <20220614090635.C38FE385742C@sourceware.org> Date: Tue, 14 Jun 2022 09:06:35 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jun 2022 09:06:35 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc5a72a8d1c32= 1fcf8ea1c5dc742f273a7429fd56 commit c5a72a8d1c321fcf8ea1c5dc742f273a7429fd56 Author: Tom de Vries Date: Tue Jun 14 11:06:26 2022 +0200 [gdb/testsuite] Fix regexp in gdb.ada/mi_var_access.exp =20 With gcc-12 and target board unix/-m32, we run into: ... (gdb) ^M Expecting: ^(-var-create A_String_Access \* A_String_Access[^M ]+)?(\^done,name=3D"A_String_Access",numchild=3D"1",.*[^M ]+[(]gdb[)] ^M [ ]*) -var-create A_String_Access * A_String_Access^M ^error,msg=3D"Value out of range."^M (gdb) ^M FAIL: gdb.ada/mi_var_access.exp: Create varobj (unexpected output) ... =20 What happens is easier to understand if we take things out of the mi co= ntext: ... $ gdb -q -batch \ outputs/gdb.ada/mi_var_access/mi_access \ -ex "b mi_access.adb:19" \ -ex run \ -ex "p A_String_Access" ... Breakpoint 1, mi_access () at mi_access.adb:19 19 A_String : String (3 .. 5) :=3D "345"; -- STOP $1 =3D (pck.string_access) ... while with target board unix we have instead: ... $1 =3D (pck.string_access) 0x431b40 ... =20 The var-create command samples the value of the variable at a location = where the variable is not yet initialized, and with target board unix we accidentally hit a valid address, but with target board unix/-m32 that'= s not the case. =20 Fix the FAIL by accepting the error message. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D28464 Diff: --- gdb/testsuite/gdb.ada/mi_var_access.exp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.ada/mi_var_access.exp b/gdb/testsuite/gdb.ad= a/mi_var_access.exp index 7a9fe7f7f60..0d5e4e949d6 100644 --- a/gdb/testsuite/gdb.ada/mi_var_access.exp +++ b/gdb/testsuite/gdb.ada/mi_var_access.exp @@ -40,8 +40,10 @@ mi_continue_to_line \ "stop at start of mi_access" =20 # The bug was that creating a varobj for A_String_Access would crash. +set re_ok "\\^done,name=3D\"A_String_Access\",numchild=3D\"1\",.*" +set re_error "\\^error,msg=3D\"Value out of range\.\".*" mi_gdb_test "-var-create A_String_Access * A_String_Access" \ - "\\^done,name=3D\"A_String_Access\",numchild=3D\"1\",.*" \ + "($re_ok|$re_error)" \ "Create varobj" =20 set bp_location [gdb_get_line_number "STOP2" ${testdir}/mi_access.adb]