From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kkjkKtrBR2PVigsAWB0awg (envelope-from ) for ; Thu, 13 Oct 2022 03:44:26 -0400 Received: by simark.ca (Postfix, from userid 112) id 9FCA81E112; Thu, 13 Oct 2022 03:44: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=uECwezbo; 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 CE25C1E0D5 for ; Thu, 13 Oct 2022 03:44:25 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CCB1C3858C56 for ; Thu, 13 Oct 2022 07:44:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCB1C3858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665647064; bh=Odvayv50NkItvI9b7gxeBAU4hEoWvoR5aUMvZTZjXA8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=uECwezboPcs0v/Cvv+a0kGdG8YynEjOeobQva1HTlpmdm1lNi0aUfroj7PrF8bXhK RbNKX3jRPQ3o5oaY0gbJG173/ppM2R6/5gyRkTvgXsNDHOkLBd7ESCmHuZg7d2ZKPC Qgi/NdneKulZZQ6jScMXR8ltpEvV1cJepXz033Hg= Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 50AF13858404 for ; Thu, 13 Oct 2022 07:44:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 50AF13858404 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-out2.suse.de (Postfix) with ESMTPS id 319661F461 for ; Thu, 13 Oct 2022 07:44:04 +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 F3A9C139F3 for ; Thu, 13 Oct 2022 07:44:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id TVQsOsPBR2N0TwAAMHmgww (envelope-from ) for ; Thu, 13 Oct 2022 07:44:03 +0000 Date: Thu, 13 Oct 2022 09:44:02 +0200 To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix gdb.mi/mi-disassemble.exp with -m32 Message-ID: <20221013074400.GA6454@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, With target board unix/-m32 and test-case gdb.mi/mi-disassemble.exp we have: ... (gdb) ^M print/x *((unsigned char *) 0x8048485)^M &"print/x *((unsigned char *) 0x8048485)\n"^M ~"$9 = 0x83\n"^M ^done^M (gdb) ^M PASS: gdb.mi/mi-disassemble.exp: get valueof "*((unsigned char *) 0x8048485)" FAIL: gdb.mi/mi-disassemble.exp: byte at 0x8048485 matches ... The test-case passes with native. With native we see in gdb.log that variable longest_insn_bytes is: ... Longest instruction at 0x0000000000400549 with bytes '48 8b 05 20 01 00 00' ... and variable split_bytes (added debug puts) ends up as: ... SPLIT_BYTES: 48 8b 05 20 01 00 00 ... But with unix/-m32 we have longest_insn_byte: ... Longest instruction at 0x08048481 with bytes '8d 4c 24 04 ' ... and split_bytes ends up as: ... SPLIT_BYTES: 8d 4c 24 04 {} {} {} {} {} {} {} {} ... so the trailing whitespace is translated by split to empty bytes, and the mismatch FAILs are generated for those. Fix this by stripping the whitespace, which makes us end up with a different and indeed longer insn: ... Longest instruction at 0x08048492 with bytes 'dd 05 98 85 04 08' ... Tested on x86_64-linux, with native and target board unix/-m32. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix gdb.mi/mi-disassemble.exp with -m32 --- gdb/testsuite/gdb.mi/mi-disassemble.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.mi/mi-disassemble.exp b/gdb/testsuite/gdb.mi/mi-disassemble.exp index 4d7c2f2e6e7..cac3689071c 100644 --- a/gdb/testsuite/gdb.mi/mi-disassemble.exp +++ b/gdb/testsuite/gdb.mi/mi-disassemble.exp @@ -284,7 +284,7 @@ proc test_disassembly_opcode_format {} { -re "^~\".. ($::hex) <\[^>\]+>:\\\\t(\[^\\\\\]+)\\\\t\[^\r\n\]+\r\n" { set addr $expect_out(1,string) - set bytes $expect_out(2,string) + set bytes [string trim $expect_out(2,string)] if { [string length $bytes] > [string length $longest_insn_bytes] } { set longest_insn_addr $addr set longest_insn_bytes $bytes