From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wNA8GS4glmKrfgkAWB0awg (envelope-from ) for ; Tue, 31 May 2022 10:03:26 -0400 Received: by simark.ca (Postfix, from userid 112) id 644D41E221; Tue, 31 May 2022 10:03:26 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=FWgKirOl; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [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 AD55E1E00D for ; Tue, 31 May 2022 10:03:25 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1F5F53954441 for ; Tue, 31 May 2022 14:03:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F5F53954441 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1654005805; bh=+RqWzpjhlAtEnTXoYsGVzxQkRpsmDTLf0OCH8UKRW9Q=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=FWgKirOleHM8zmOzI43pJDWGwQPk6QLYekOfpu4GTjjMri5rYKKDBGbO3+9Brv2Nm Er4wBwVG+gwWDwfiRM3bfMXE79OP1io5AoEYyFeMsMjzSTPW0A9461XvWLXBKc3+WL lxVuWPyK2FCjmpNs8mJcUWUdVNYsClD9gzKQNW6g= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 2CF873857BB1 for ; Tue, 31 May 2022 14:03:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2CF873857BB1 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 358CA21BE3 for ; Tue, 31 May 2022 14:03:03 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2265B132F9 for ; Tue, 31 May 2022 14:03:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id q302BxcglmLGIQAAMHmgww (envelope-from ) for ; Tue, 31 May 2022 14:03:03 +0000 Date: Tue, 31 May 2022 16:03:01 +0200 To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Detect change instead of init in gdb.mi/mi-var-block.exp Message-ID: <20220531140300.GA2627@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, On openSUSE Tumbleweed with target board unix/-m32, I run into: ... PASS: gdb.mi/mi-var-block.exp: step at do_block_test 2 Expecting: ^(-var-update \*[^M ]+)?(\^done,changelist=\[{name="foo",in_scope="true",type_changed="false",has_more="0"}, {name="cb",in_scope="true",type_changed="false",has_more="0"}\][^M ]+[(]gdb[)] ^M [ ]*) -var-update *^M ^done,changelist=[{name="foo",in_scope="true",type_changed="false",has_more="0"}]^M (gdb) ^M FAIL: gdb.mi/mi-var-block.exp: update all vars: cb foo changed (unexpected output) ... The problem is that the test-case attempts to detect a change in the cb variable caused by this initialization: ... void do_block_tests () { int cb = 12; ... but that only works if the stack location happens to be unequal to 12 before the initialization. Fix this by first initializing to 0, and then changing the value to 12: ... - int cb = 12; + int cb = 0; + cb = 12; ... and detecting that change. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29195 Any comments? Thanks, - Tom [gdb/testsuite] Detect change instead of init in gdb.mi/mi-var-block.exp --- gdb/testsuite/gdb.mi/mi-var-block.exp | 5 +++++ gdb/testsuite/gdb.mi/var-cmd.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.mi/mi-var-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp index 2f8d39a6acd..a1ef2d1ad52 100644 --- a/gdb/testsuite/gdb.mi/mi-var-block.exp +++ b/gdb/testsuite/gdb.mi/mi-var-block.exp @@ -40,6 +40,11 @@ mi_gdb_load ${binfile} mi_runto do_block_tests +# step to "cb = 12;" +mi_step_to "do_block_tests" "" "var-cmd.c" \ + [gdb_get_line_number "cb = 12;"] \ + "step at do_block_test 0" + # Test: c_variable-3.2 # Desc: create cb and foo mi_create_varobj "cb" "cb" "create local variable cb" diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c index fddb0d39a5e..f3312788a80 100644 --- a/gdb/testsuite/gdb.mi/var-cmd.c +++ b/gdb/testsuite/gdb.mi/var-cmd.c @@ -207,7 +207,8 @@ subroutine1 (int i, long *l) void do_block_tests () { - int cb = 12; + int cb = 0; + cb = 12; { int foo;