This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/gdb-7.12-branch] Fix order of inferiors in "thread apply all"


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bb109f2e48adf783a861eb0d1de6f495e6b5288a

commit bb109f2e48adf783a861eb0d1de6f495e6b5288a
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date:   Tue Aug 30 18:25:40 2016 +0200

    Fix order of inferiors in "thread apply all"
    
    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".

Diff:
---
 gdb/ChangeLog                    | 4 ++++
 gdb/testsuite/ChangeLog          | 4 ++++
 gdb/testsuite/gdb.multi/tids.exp | 6 ++++++
 gdb/thread.c                     | 2 +-
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4022b91..aba4666 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2016-08-30  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+	* thread.c (tp_array_compar): Insert missing parentheses.
+
 2016-08-26  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
 	* xtensa-tdep.h (XTENSA_GDBARCH_TDEP_INSTANTIATE): Replace
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 48a938d..78f8788 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2016-08-30  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+	* gdb.multi/tids.exp: Test "thread apply all".
+
 2016-08-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	* gdb.base/default.exp (tty): Remove.
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));
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]