From patchwork Mon Jul 24 16:38:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 21744 Received: (qmail 76297 invoked by alias); 24 Jul 2017 16:38:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 76280 invoked by uid 89); 24 Jul 2017 16:38:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Jul 2017 16:38:41 +0000 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6OGcaq3022629 for ; Mon, 24 Jul 2017 12:38:40 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 2bwm4v98c7-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 24 Jul 2017 12:38:40 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 24 Jul 2017 17:38:38 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 24 Jul 2017 17:38:36 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6OGca8j35913788; Mon, 24 Jul 2017 16:38:36 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DCE8B4C04A; Mon, 24 Jul 2017 17:36:09 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B3EC74C044; Mon, 24 Jul 2017 17:36:09 +0100 (BST) Received: from oc1027705133.ibm.com (unknown [9.152.212.202]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 24 Jul 2017 17:36:09 +0100 (BST) From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [pushed] s390-vregs.exp: Fix Tcl error after non-zero-pad patch Date: Mon, 24 Jul 2017 18:38:31 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17072416-0020-0000-0000-000003A46512 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17072416-0021-0000-0000-0000422D107E Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-24_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707240255 X-IsSubscribed: yes s390-vregs.exp yields a Tcl error: ERROR: can't read "i": no such variable while executing "expr $a_high * ($i + 1) * $a_high " (procedure "hex128" line 2) invoked from within "hex128 $a_high $a_low $b_high $b_low" ... This is a regression, caused by commit 30a254669b16b8 -- "Don't always zero pad in print_*_chars". That patch introduced a new procedure "hex128" for formatting a 128-bit value as hex, but it accidentally moved the calculation of the 128-bit value into that new procedure as well instead of leaving it in the original context. This is fixed. gdb/testsuite/ChangeLog: * gdb.arch/s390-vregs.exp: Calculate parameters to hex128 in the calling context. (hex128): Drop erroneous calculation of parameters. --- gdb/testsuite/gdb.arch/s390-vregs.exp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/gdb.arch/s390-vregs.exp b/gdb/testsuite/gdb.arch/s390-vregs.exp index 078c153..d2c31e1 100644 --- a/gdb/testsuite/gdb.arch/s390-vregs.exp +++ b/gdb/testsuite/gdb.arch/s390-vregs.exp @@ -147,14 +147,12 @@ gdb_continue_to_breakpoint "change vrs" set vregs [capture_command_output "info registers vector" ""] # Format a 128-bit value, given individual 4-byte values, as hex. -# Leading zeros are suppressed. +# Suppress leading zeros. proc hex128 {a_high a_low b_high b_low} { - set result [format %08x%08x%08x%08x \ - [expr $a_high * ($i + 1) * $a_high ] \ - [expr $a_low * ($i + 1) * $a_low ] \ - [expr $b_high * (32 - $i) * $b_high * 32] \ - [expr $b_low * (32 - $i) * $b_low * 32] ] - return [regsub -- "^0*" $result ""] + set result [format "%x%08x%08x%08x" $a_high $a_low $b_high $b_low] + regsub -- "^0*" $result "" result + if { $result eq "" } { set result 0 } + return $result } set j 1 @@ -162,7 +160,11 @@ foreach {- r i val} [regexp -all -inline -line \ {^(\D*)(\d+)\s+.*?uint128 = 0x([0-9a-f]+?)} $vregs] { if { $r ne "v" } { fail "info registers vector: bad line $j" - } elseif { $val ne [hex128 $a_high $a_low $b_high $b_low] } { + } elseif { $val ne [hex128 \ + [expr $a_high * ($i + 1) * $a_high ] \ + [expr $a_low * ($i + 1) * $a_low ] \ + [expr $b_high * (32 - $i) * $b_high * 32] \ + [expr $b_low * (32 - $i) * $b_low * 32] ] } { fail "compare \$v$i" } incr j 1