From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Fix order of inferiors in "thread apply all"
Date: Thu, 15 Sep 2016 11:54:00 -0000 [thread overview]
Message-ID: <1473940399-2891-2-git-send-email-arnez@linux.vnet.ibm.com> (raw)
In-Reply-To: <1473940399-2891-1-git-send-email-arnez@linux.vnet.ibm.com>
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));
}
--
2.5.0
next prev parent reply other threads:[~2016-09-15 11:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-15 11:53 [PATCH 0/6] S390: Watchpoint enhancements and hardware breakpoints Andreas Arnez
2016-09-15 11:54 ` Andreas Arnez [this message]
2016-09-15 12:03 ` [PATCH] Fix order of inferiors in "thread apply all" Andreas Arnez
2016-09-15 11:59 ` [PATCH 1/6] S390: Avoid direct access to lwp_info structure Andreas Arnez
2016-09-15 12:01 ` [PATCH 3/6] S390: Multi-inferior watchpoint support Andreas Arnez
2016-09-15 12:02 ` [PATCH 5/6] linux-nat: Add function lwp_is_stepping Andreas Arnez
2016-09-15 15:08 ` Yao Qi
2016-09-15 12:02 ` [PATCH 4/6] S390: Enable "maint set show-debug-regs" Andreas Arnez
2016-09-15 12:02 ` [PATCH 2/6] S390: Migrate watch areas from list to VEC type Andreas Arnez
2016-09-15 12:02 ` [PATCH 6/6] S390: Hardware breakpoint support Andreas Arnez
2016-09-15 14:11 ` [PATCH 0/6] S390: Watchpoint enhancements and hardware breakpoints Pedro Alves
2016-09-16 12:43 ` Ulrich Weigand
2016-09-16 15:43 ` Pedro Alves
2016-09-16 17:30 ` Andreas Arnez
2016-09-15 14:58 ` Yao Qi
2016-09-15 17:14 ` Andreas Arnez
-- strict thread matches above, loose matches on Subject: below --
2016-08-30 14:36 [PATCH] Fix order of inferiors in "thread apply all" Andreas Arnez
2016-08-30 14:44 ` Pedro Alves
2016-08-30 15:09 ` Andreas Arnez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1473940399-2891-2-git-send-email-arnez@linux.vnet.ibm.com \
--to=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox