From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id AO8jObvGhGLB4gYAWB0awg (envelope-from ) for ; Wed, 18 May 2022 06:13:15 -0400 Received: by simark.ca (Postfix, from userid 112) id DA24F1E220; Wed, 18 May 2022 06:13:15 -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=NiFYM8nN; 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 75F5B1E00D for ; Wed, 18 May 2022 06:13:15 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0E58E385780F for ; Wed, 18 May 2022 10:13:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0E58E385780F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1652868795; bh=5XiQ8YIGHd/CJ6c8yOrTi6xyuiVbkDZHcNYwe82tbio=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=NiFYM8nNeKK8fslzDkg2VJEPE4jAwqXimePdaH2TltltvqOQrOK5sl2KurlJKpHEB 4+4YfpJNebrQZ26531uuB1fVpnToVnPiuhsCZ44fHx1IS8yB0VSgRTYzaD4Mtzeqzx Aa5TumiYswpLUIKxT+KO6tAFx1SBJsi1NhOR0mp0= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 0C0F83858C52 for ; Wed, 18 May 2022 10:12:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0C0F83858C52 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 481CD21B4E for ; Wed, 18 May 2022 10:12:55 +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 35287133F5 for ; Wed, 18 May 2022 10:12:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VbnFC6fGhGJgJwAAMHmgww (envelope-from ) for ; Wed, 18 May 2022 10:12:55 +0000 Date: Wed, 18 May 2022 12:12:53 +0200 To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Use hex_for_lang in gdb.base/parse_number.exp Message-ID: <20220518101251.GA4915@delia> 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, In gdb.base/parse_number.exp, add a new proc hex_for_lang that formats a hex number appropriately for a given language. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Use hex_for_lang in gdb.base/parse_number.exp --- gdb/testsuite/gdb.base/parse_number.exp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/parse_number.exp b/gdb/testsuite/gdb.base/parse_number.exp index ccef3f09655..9668099bd82 100644 --- a/gdb/testsuite/gdb.base/parse_number.exp +++ b/gdb/testsuite/gdb.base/parse_number.exp @@ -13,6 +13,18 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# Format hex value VAL for language LANG. + +proc hex_for_lang { lang val } { + set val [regsub ^0x $val ""] + if { $lang == "modula-2" } { + set val 0[string toupper $val]H + } else { + set val 0x$val + } + return $val +} + # Test parsing numbers. Several language parsers had the same bug # around parsing large 64-bit numbers, hitting undefined behavior, and # thus crashing a GDB built with UBSan. This testcase goes over all @@ -53,11 +65,12 @@ proc test_parse_numbers {arch} { gdb_test_no_output "set language $lang" set val "0xffffffffffffffff" + set val [hex_for_lang $lang $val] if {$lang == "fortran"} { gdb_test "p/x $val" " = $fortran_value" gdb_test "ptype $val" " = $fortran_type" } elseif {$lang == "modula-2"} { - gdb_test "p/x 0FFFFFFFFFFFFFFFFH" "Overflow on numeric constant\\." + gdb_test "p/x $val" "Overflow on numeric constant\\." } elseif {$lang == "unknown"} { gdb_test "p/x $val" \ "expression parsing not implemented for language \"Unknown\""