aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Khouzam <marc.khouzam@ericsson.com>2011-04-19 15:28:52 +0000
committerMarc Khouzam <marc.khouzam@ericsson.com>2011-04-19 15:28:52 +0000
commite6e53b4014d4974d749e1afad3b3216ef5a1caf0 (patch)
treee17aeafff476e7bb6d74ee397f274ca338be6e9c
parent9b427d9912f7dfdb630065204ecb8d6cc297ddbd (diff)
downloadgdb-e6e53b4014d4974d749e1afad3b3216ef5a1caf0.zip
gdb-e6e53b4014d4974d749e1afad3b3216ef5a1caf0.tar.gz
gdb-e6e53b4014d4974d749e1afad3b3216ef5a1caf0.tar.bz2
2011-04-19 Marc Khouzam <marc.khouzam@ericsson.com>
* thread.c (any_live_thread_of_process): Prioritize threads that are not executing. * gdbthread.h (any_live_thread_of_process): Update comment as per above change.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/gdbthread.h2
-rw-r--r--gdb/thread.c12
3 files changed, 14 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ac5a8be..6334187 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-19 Marc Khouzam <marc.khouzam@ericsson.com>
+
+ * thread.c (any_live_thread_of_process): Prioritize threads
+ that are not executing.
+ * gdbthread.h (any_live_thread_of_process): Update comment
+ as per above change.
+
2011-03-18 Kwok Cheung Yeung <kcy@codesourcery.com>
* MAINTAINERS: Add myself as a write-after-approval maintainer.
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index cd24eaf..217f9b9 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -251,7 +251,7 @@ struct thread_info *first_thread_of_process (int pid);
extern struct thread_info *any_thread_of_process (int pid);
/* Returns any non-exited thread of process PID, giving preference for
- already stopped threads. */
+ not executing threads. */
extern struct thread_info *any_live_thread_of_process (int pid);
/* Change the ptid of thread OLD_PTID to NEW_PTID. */
diff --git a/gdb/thread.c b/gdb/thread.c
index 0b291ba..4b86599 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -448,18 +448,18 @@ struct thread_info *
any_live_thread_of_process (int pid)
{
struct thread_info *tp;
- struct thread_info *tp_running = NULL;
+ struct thread_info *tp_executing = NULL;
for (tp = thread_list; tp; tp = tp->next)
- if (ptid_get_pid (tp->ptid) == pid)
+ if (tp->state_ != THREAD_EXITED && ptid_get_pid (tp->ptid) == pid)
{
- if (tp->state_ == THREAD_STOPPED)
+ if (tp->executing_)
+ tp_executing = tp;
+ else
return tp;
- else if (tp->state_ == THREAD_RUNNING)
- tp_running = tp;
}
- return tp_running;
+ return tp_executing;
}
/* Print a list of thread ids currently known, and the total number of