From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 427D9385383C; Thu, 13 Oct 2022 07:43:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 427D9385383C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665647007; bh=atv/FKdUDoyh6PozNbQ9II43/Ighxmf0ehnWHLOgpAE=; h=From:To:Subject:Date:From; b=vJiJYbpmNiajYf11GR0gadNgs109rvjgdbCC1tj1P52juylJ4ciOvlq0qmqsZHdQf Z9jIuV7H5Ks8BOG/9pbqXnMgsrUDXSELN1g2UIo30Xg29pppLrxGn0BQUPlSc+fiNQ vCdY3PQJX5ilsP+gnvOwAIr6M+l5YH+988eMFiKs= 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 gdb.mi/mi-disassemble.exp with -m32 X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 1d4e62f498b1340569fd58c401f98c287cb5d071 X-Git-Newrev: 0ffa92773a25042d97a6df74062270a03cb84982 Message-Id: <20221013074327.427D9385383C@sourceware.org> Date: Thu, 13 Oct 2022 07:43:27 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D0ffa92773a25= 042d97a6df74062270a03cb84982 commit 0ffa92773a25042d97a6df74062270a03cb84982 Author: Tom de Vries Date: Thu Oct 13 09:43:23 2022 +0200 [gdb/testsuite] Fix gdb.mi/mi-disassemble.exp with -m32 =20 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 =3D 0x83\n"^M ^done^M (gdb) ^M PASS: gdb.mi/mi-disassemble.exp: get valueof "*((unsigned char *) 0x804= 8485)" FAIL: gdb.mi/mi-disassemble.exp: byte at 0x8048485 matches ... The test-case passes with native. =20 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 ... =20 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 t= he mismatch FAILs are generated for those. =20 Fix this by stripping the whitespace, which makes us end up with a diff= erent and indeed longer insn: ... Longest instruction at 0x08048492 with bytes 'dd 05 98 85 04 08' ... =20 Tested on x86_64-linux, with native and target board unix/-m32. Diff: --- 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 {} { =20 -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