From patchwork Tue Aug 30 14:36:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 15068 Received: (qmail 126048 invoked by alias); 30 Aug 2016 14:36:30 -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 126029 invoked by uid 89); 30 Aug 2016 14:36:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=2.3, 2246, H*m:fsf, 1.3 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; Tue, 30 Aug 2016 14:36:28 +0000 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7UEYIqR010494 for ; Tue, 30 Aug 2016 10:36:26 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 25536kgchj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 30 Aug 2016 10:36:26 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 Aug 2016 15:36:24 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 30 Aug 2016 15:36:21 +0100 X-IBM-Helo: d06dlp01.portsmouth.uk.ibm.com X-IBM-MailFrom: arnez@linux.vnet.ibm.com X-IBM-RcptTo: gdb-patches@sourceware.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id E297A17D8042 for ; Tue, 30 Aug 2016 15:38:09 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u7UEaKrO19267966 for ; Tue, 30 Aug 2016 14:36:21 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u7UEaK1k011582 for ; Tue, 30 Aug 2016 08:36:20 -0600 Received: from oc1027705133.ibm.com (dyn-9-152-212-133.boeblingen.de.ibm.com [9.152.212.133]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u7UEaKed011562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Aug 2016 08:36:20 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Philipp Rudo Subject: [PATCH] Fix order of inferiors in "thread apply all" Date: Tue, 30 Aug 2016 16:36:20 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16083014-0012-0000-0000-0000044DB675 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16083014-0013-0000-0000-000015331F80 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-30_07:, , 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-1604210000 definitions=main-1608300141 X-IsSubscribed: yes This inserts missing parentheses in the calculation of the comparison result between two different inferior numbers. The problem was found by Philipp Rudo. gdb/ChangeLog: * thread.c (tp_array_compar): Insert missing parentheses. gdb/testsuite/ChangeLog: * gdb.multi/tids.exp: Test "thread apply all". --- gdb/testsuite/gdb.multi/tids.exp | 6 ++++++ gdb/thread.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp index 5d8701e..12ce98a 100644 --- a/gdb/testsuite/gdb.multi/tids.exp +++ b/gdb/testsuite/gdb.multi/tids.exp @@ -224,6 +224,12 @@ with_test_prefix "two inferiors" { thr_apply_info_thr "1.1-2 2.2-3" \ "1.1 1.2 2.2 2.3" + # All threads. + thread_apply "all" \ + "2.3 2.2 2.1 1.3 1.2 1.1" + thread_apply "all -ascending" \ + "1.1 1.2 1.3 2.1 2.2 2.3" + # Now test using GDB convenience variables. gdb_test "p \$inf = 1" " = 1" diff --git a/gdb/thread.c b/gdb/thread.c index ab98777..a66a2b5 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -1725,7 +1725,7 @@ tp_array_compar (const void *ap_voidp, const void *bp_voidp) if (a->inf->num != b->inf->num) { - return ((a->inf->num > b->inf->num) - (a->inf->num < b->inf->num) + return (((a->inf->num > b->inf->num) - (a->inf->num < b->inf->num)) * (tp_array_compar_ascending ? +1 : -1)); }