[binutils-gdb] Fix usage of inferior_ptid in two thread_alive implementations

Simon Marchi simark@sourceware.org
Thu Feb 23 15:40:00 GMT 2017


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

commit 8eaf53202ea60191162d5f1069cd08ebd9f38f6c
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Thu Feb 23 10:36:20 2017 -0500

    Fix usage of inferior_ptid in two thread_alive implementations
    
    While inspecting some target code, I noticed that in these two
    implementations of thread_alive, inferior_ptid is referenced directly
    instead of using the ptid passed as parameters.  I guess that it is
    wrong, although I can't really test it in both cases.
    
    gdb/ChangeLog:
    
    	* bsd-uthread.c (bsd_uthread_thread_alive): Use ptid instead of
    	inferior_ptid.
    	* go32-nat.c (go32_thread_alive): Likewise.

Diff:
---
 gdb/ChangeLog     | 6 ++++++
 gdb/bsd-uthread.c | 2 +-
 gdb/go32-nat.c    | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6cc163b..30cd576 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-23  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* bsd-uthread.c (bsd_uthread_thread_alive): Use ptid instead of
+	inferior_ptid.
+	* go32-nat.c (go32_thread_alive): Likewise.
+
 2017-02-23  Yao Qi  <yao.qi@linaro.org>
 
 	* varobj-iter.h (varobj_iter_delete): Call xfree instead of
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 41c7d59..20eecd3 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -401,7 +401,7 @@ bsd_uthread_thread_alive (struct target_ops *ops, ptid_t ptid)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
   struct target_ops *beneath = find_target_beneath (ops);
-  CORE_ADDR addr = ptid_get_tid (inferior_ptid);
+  CORE_ADDR addr = ptid_get_tid (ptid);
 
   if (addr != 0)
     {
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 3e9e99f..1fca8e2 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -938,7 +938,7 @@ go32_terminal_ours (struct target_ops *self)
 static int
 go32_thread_alive (struct target_ops *ops, ptid_t ptid)
 {
-  return !ptid_equal (inferior_ptid, null_ptid);
+  return !ptid_equal (ptid, null_ptid);
 }
 
 static char *



More information about the Gdb-cvs mailing list