aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-thread-db.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-09-13 19:27:01 +0000
committerPedro Alves <palves@redhat.com>2011-09-13 19:27:01 +0000
commitc65b3e0d43b7b64febc4a1b7192e13f7be3a94fa (patch)
treeec3f3b1125e7695cf506dce2bef174ada4fbe796 /gdb/linux-thread-db.c
parenta1398e0c5690d181307a819fbe9cc4e08e518fbc (diff)
downloadgdb-c65b3e0d43b7b64febc4a1b7192e13f7be3a94fa.zip
gdb-c65b3e0d43b7b64febc4a1b7192e13f7be3a94fa.tar.gz
gdb-c65b3e0d43b7b64febc4a1b7192e13f7be3a94fa.tar.bz2
2011-09-13 Pedro Alves <pedro@codesourcery.com>
* inferior.h (ALL_INFERIORS): New. * linux-thread-db.c (thread_db_find_new_threads_2): Remove check for a stopped thread. (thread_db_find_new_threads): Look for threads in all inferiors.
Diffstat (limited to 'gdb/linux-thread-db.c')
-rw-r--r--gdb/linux-thread-db.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 8141b20..8dd766b 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1552,20 +1552,6 @@ thread_db_find_new_threads_2 (ptid_t ptid, int until_no_new)
int pid = ptid_get_pid (ptid);
int i, loop;
- if (target_has_execution)
- {
- struct lwp_info *lp;
-
- /* In linux, we can only read memory through a stopped lwp. */
- ALL_LWPS (lp, ptid)
- if (lp->stopped && ptid_get_pid (lp->ptid) == pid)
- break;
-
- if (!lp)
- /* There is no stopped thread. Bail out. */
- return;
- }
-
info = get_thread_db_info (GET_PID (ptid));
/* Access an lwp we know is stopped. */
@@ -1607,13 +1593,25 @@ static void
thread_db_find_new_threads (struct target_ops *ops)
{
struct thread_db_info *info;
+ struct inferior *inf;
- info = get_thread_db_info (GET_PID (inferior_ptid));
+ ALL_INFERIORS (inf)
+ {
+ struct thread_info *thread;
- if (info == NULL)
- return;
+ if (inf->pid == 0)
+ continue;
- thread_db_find_new_threads_1 (inferior_ptid);
+ info = get_thread_db_info (inf->pid);
+ if (info == NULL)
+ continue;
+
+ thread = any_live_thread_of_process (inf->pid);
+ if (thread == NULL || thread->executing)
+ continue;
+
+ thread_db_find_new_threads_1 (thread->ptid);
+ }
if (target_has_execution)
iterate_over_lwps (minus_one_ptid /* iterate over all */,