aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorMarc Khouzam <marc.khouzam@ericsson.com>2011-04-19 15:16:14 +0000
committerMarc Khouzam <marc.khouzam@ericsson.com>2011-04-19 15:16:14 +0000
commit9941e0c5c123c37b55ff77cb4caa78e87b95823e (patch)
tree8dadb10884370182b36c5fd40e52f7d18f65d639 /gdb/thread.c
parented4b0e6a5218948292b2a22e28537a3b0e1c9bd8 (diff)
downloadgdb-9941e0c5c123c37b55ff77cb4caa78e87b95823e.zip
gdb-9941e0c5c123c37b55ff77cb4caa78e87b95823e.tar.gz
gdb-9941e0c5c123c37b55ff77cb4caa78e87b95823e.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.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 6ad1807..5f07c83 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -470,18 +470,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