From patchwork Mon Dec 12 14:21:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 61790 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A86A3385C647 for ; Mon, 12 Dec 2022 14:22:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A86A3385C647 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670854934; bh=g/ffapQVL3vvenWcihAvhaaCnd22cCm+8C82knBNSq8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=li1hWDvgl5yI17i3OEItHZUgqLv6aEBLDxOAJOzIXe+NxVtF87IoDRadwlkKA/Evi YdG+it3YKCwgmUlVaVcbV3yRsvlG2P+vLxQoPt80cqWQammotsew7r+8EA9Nf1JSLu g1X/plO0igMu3LbvtBEPW0g0lovIe9gHLLhA2Gxc= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 694603856975 for ; Mon, 12 Dec 2022 14:21:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 694603856975 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 97EC133977; Mon, 12 Dec 2022 14:21:50 +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 7E980138F3; Mon, 12 Dec 2022 14:21:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Ck2wHf44l2N0QAAAMHmgww (envelope-from ); Mon, 12 Dec 2022 14:21:50 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [pushed] [gdb/testsuite] Fix PR20630 regression test in gdb.base/printcmds.exp Date: Mon, 12 Dec 2022 15:21:50 +0100 Message-Id: <20221212142150.9532-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" On s390x-linux, I run into: ... (gdb) print {unsigned char}{65}^M $749 = 0 '\000'^M (gdb) FAIL: gdb.base/printcmds.exp: print {unsigned char}{65} ... In contrast, on x86_64-linux, we have: ... (gdb) print {unsigned char}{65}^M $749 = 65 'A'^M (gdb) PASS: gdb.base/printcmds.exp: print {unsigned char}{65} ... The first problem here is that the test is supposed to be a regression test for PR20630, which can be reproduced (for an unfixed gdb) like this: ... (gdb) p {unsigned char[]}{0x17} gdbtypes.c:4641: internal-error: copy_type: \ Assertion `TYPE_OBJFILE_OWNED (type)' failed. ... but it's not due to insufficient quoting (note the dropped '[]'). That's easy to fix, but after that we have on s390 (big endian): ... (gdb) print {unsigned char[]}{65}^M $749 = ""^M ... and on x86_64 (little endian): ... (gdb) print {unsigned char[]}{65}^M $749 = "A"^M ... Fix this by using 0xffffffff, such that in both cases we have: ... (gdb) print {unsigned char[]}{0xffffffff}^M $749 = "\377\377\377\377"^M ... Tested on x86_64-linux and s390x-linux. --- gdb/testsuite/gdb.base/printcmds.exp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) base-commit: c8628c770bc9055cfd42cfc2e3c416495653f5f8 diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 13479ab3ca8..8aaf6d2def3 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -785,6 +785,7 @@ proc test_print_string_constants {} { } proc test_print_array_constants {} { + global hex if [target_info exists gdb,cannot_call_functions] { unsupported "this target can not call functions" @@ -803,7 +804,8 @@ proc test_print_array_constants {} { gdb_test "print *&{4,5,6}\[1\]" "Attempt to take address of value not located in memory." # This used to cause a crash. - gdb_test "print {unsigned char[]}{65}" " = 65 'A'" + set val [string_to_regexp {"\377\377\377\377"}] + gdb_test "print {unsigned char\[\]}{0xffffffff}" " = $val" } proc test_print_enums {} {