From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UvUZKVL5EmCtegAAWB0awg (envelope-from ) for ; Thu, 28 Jan 2021 12:50:10 -0500 Received: by simark.ca (Postfix, from userid 112) id 9AF741EF80; Thu, 28 Jan 2021 12:50:10 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 0C13E1E945 for ; Thu, 28 Jan 2021 12:50:10 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC8553861812; Thu, 28 Jan 2021 17:50:09 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 8F3613861812 for ; Thu, 28 Jan 2021 17:50:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8F3613861812 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9C6BEAD0B; Thu, 28 Jan 2021 17:50:05 +0000 (UTC) Subject: Re: [PATCH][gdb/testsuite] Fix gdb.opt/solib-intra-step.exp with -m32 and gcc-10 To: Simon Marchi , gdb-patches@sourceware.org References: <20210126180312.GA7860@delia> From: Tom de Vries Message-ID: <8713098d-e196-bf9d-3b8f-a8d2920e7caa@suse.de> Date: Thu, 28 Jan 2021 18:50:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------7179DA8922AC743425AF37AC" Content-Language: en-US X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" This is a multi-part message in MIME format. --------------7179DA8922AC743425AF37AC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 1/28/21 4:03 PM, Simon Marchi wrote: > > > On 2021-01-26 1:03 p.m., Tom de Vries wrote: >> Hi, >> >> When running test-case gdb.opt/solib-intra-step.exp with target board >> unix/-m32 and gcc-10, I run into: >> ... >> (gdb) step^M >> __x86.get_pc_thunk.bx () at ../sysdeps/i386/crti.S:68^M >> 68 ../sysdeps/i386/crti.S: No such file or directory.^M >> (gdb) step^M >> shlib_second (dummy=0) at solib-intra-step-lib.c:23^M >> 23 abort (); /* second-hit */^M >> (gdb) FAIL: gdb.opt/solib-intra-step.exp: second-hit >> ... >> >> The problem is that the test-case expects to step past the retry line, >> which is optional. >> >> Fix this by make the retry line step optional, both for shlib_first and >> shlib_second. >> >> Any comments? >> >> Thanks, >> - Tom >> >> [gdb/testsuite] Fix gdb.opt/solib-intra-step.exp with -m32 and gcc-10 >> >> gdb/testsuite/ChangeLog: >> >> 2021-01-26 Tom de Vries >> >> * gdb.opt/solib-intra-step.exp: Make step into retry line optional. >> >> --- >> gdb/testsuite/gdb.opt/solib-intra-step.exp | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/gdb/testsuite/gdb.opt/solib-intra-step.exp b/gdb/testsuite/gdb.opt/solib-intra-step.exp >> index ad19895d890..13e0cf04c7a 100644 >> --- a/gdb/testsuite/gdb.opt/solib-intra-step.exp >> +++ b/gdb/testsuite/gdb.opt/solib-intra-step.exp >> @@ -63,7 +63,7 @@ gdb_test_multiple "step" $test { >> exp_continue >> } >> -re -wrap "get_pc_thunk.*" { >> - if { $state != 1 } { >> + if { $state != 0 && $state != 1 } { >> set state -1 >> } else { >> set state 2 >> @@ -89,7 +89,7 @@ gdb_test_multiple "step" $test { >> exp_continue >> } >> -re -wrap "get_pc_thunk.*" { >> - if { $state != 1 } { >> + if { $state != 0 && $state != 1 } { >> set state -1 >> } else { >> set state 2 >> > > I don't really understand what happens here, what state value means what. > > A bit of commenting would help. I tried to add comments but didn't manage to come up with something sensible. Instead, I simplified gdb_test_multiple to just track the order of events, and then added a few asserts about order of events. I hope this clarifies what the test is trying to do. WDYT? Thanks, - Tom --------------7179DA8922AC743425AF37AC Content-Type: text/x-patch; charset=UTF-8; name="0005-gdb-testsuite-Fix-gdb.opt-solib-intra-step.exp-with-m32-and-gcc-10.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename*0="0005-gdb-testsuite-Fix-gdb.opt-solib-intra-step.exp-with-m32"; filename*1="-and-gcc-10.patch" [gdb/testsuite] Fix gdb.opt/solib-intra-step.exp with -m32 and gcc-10 When running test-case gdb.opt/solib-intra-step.exp with target board unix/-m32 and gcc-10, I run into: =2E.. (gdb) step^M __x86.get_pc_thunk.bx () at ../sysdeps/i386/crti.S:68^M 68 ../sysdeps/i386/crti.S: No such file or directory.^M (gdb) step^M shlib_second (dummy=3D0) at solib-intra-step-lib.c:23^M 23 abort (); /* second-hit */^M (gdb) FAIL: gdb.opt/solib-intra-step.exp: second-hit =2E.. The problem is that the test-case expects to step past the retry line, which is optional. Fix this by make the retry line step optional, both for shlib_first and shlib_second. gdb/testsuite/ChangeLog: 2021-01-26 Tom de Vries * gdb.opt/solib-intra-step.exp: Make step into retry line optional. Rewrite state machine to make it clear what order conditions need checking. --- gdb/testsuite/gdb.opt/solib-intra-step.exp | 63 +++++++++++++++++++-----= ------ 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/gdb/testsuite/gdb.opt/solib-intra-step.exp b/gdb/testsuite/g= db.opt/solib-intra-step.exp index ad19895d890..5c78e07772e 100644 --- a/gdb/testsuite/gdb.opt/solib-intra-step.exp +++ b/gdb/testsuite/gdb.opt/solib-intra-step.exp @@ -47,58 +47,77 @@ if ![runto_main] then { return 0 } =20 +proc check_before { a b } { + eval global $a $b + eval set val_a $$a + eval set val_b $$b + if { $val_a =3D=3D -1 || $val_b =3D=3D -1 } { + return + } + gdb_assert { $val_a < $val_b } "$a before $b" +} + set test "first-hit" +set hit_state -1 +set retry_state -1 +set thunk_state -1 set state 0 gdb_test_multiple "step" $test { -re -wrap " first-hit .*" { - gdb_assert { $state !=3D -1 } $test + set hit_state $state + pass $gdb_test_name } -re -wrap " first-retry .*" { - if { $state !=3D 0 } { - set state -1 - } else { - set state 1 - } + set retry_state $state + incr state send_gdb "step\n" exp_continue } -re -wrap "get_pc_thunk.*" { - if { $state !=3D 1 } { - set state -1 - } else { - set state 2 - } + set thunk_state $state + incr state send_gdb "step\n" exp_continue } } =20 +with_test_prefix $test { + check_before retry_state hit_state + check_before thunk_state hit_state + check_before retry_state thunk_state +} + set test "second-hit" +set hit_state -1 +set retry_state -1 +set thunk_state -1 +set state 0 set state 0 gdb_test_multiple "step" $test { -re -wrap " second-hit .*" { - gdb_assert { $state !=3D -1 } $test + set hit_state $state + pass $gdb_test_name } -re -wrap " second-retry .*" { - if { $state !=3D 0 } { - set state -1 - } else { - set state 1 - } + set retry_state $state + incr state send_gdb "step\n" exp_continue } -re -wrap "get_pc_thunk.*" { - if { $state !=3D 1 } { - set state -1 - } else { - set state 2 - } + set thunk_state $state + incr state send_gdb "step\n" exp_continue } } =20 +with_test_prefix $test { + check_before retry_state hit_state + check_before thunk_state hit_state + check_before retry_state thunk_state +} + if ![runto_main] then { return 0 } --------------7179DA8922AC743425AF37AC--