diff options
author | Pedro Alves <palves@redhat.com> | 2011-09-02 21:03:06 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2011-09-02 21:03:06 +0000 |
commit | 84636d2874122cf547b3eaee494544636931c083 (patch) | |
tree | 43ae5da76ce278cf91de24e84ce530ffef93f7a2 /gdb/linux-thread-db.c | |
parent | 68e77c9e3085a638cc14b0b76c592441f99261f7 (diff) | |
download | gdb-84636d2874122cf547b3eaee494544636931c083.zip gdb-84636d2874122cf547b3eaee494544636931c083.tar.gz gdb-84636d2874122cf547b3eaee494544636931c083.tar.bz2 |
2011-09-02 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (in_pid_list_p): New.
(linux_record_stopped_pid): Delete.
(lin_lwp_attach_lwp): Check if PTRACE_ATTACH failed because we're
already attached to the LWP. Return an indication if so.
(linux_nat_filter_event): Adjust.
* linux-thread-db.c (attach_thread): Handle lin_lwp_attach_lwp
returning an indication to ignore this thread.
Diffstat (limited to 'gdb/linux-thread-db.c')
-rw-r--r-- | gdb/linux-thread-db.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index dda2bff..8141b20 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -1140,9 +1140,25 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p, /* Under GNU/Linux, we have to attach to each and every thread. */ if (target_has_execution - && tp == NULL - && lin_lwp_attach_lwp (BUILD_LWP (ti_p->ti_lid, GET_PID (ptid))) < 0) - return 0; + && tp == NULL) + { + int res; + + res = lin_lwp_attach_lwp (BUILD_LWP (ti_p->ti_lid, GET_PID (ptid))); + if (res < 0) + { + /* Error, stop iterating. */ + return 0; + } + else if (res > 0) + { + /* Pretend this thread doesn't exist yet, and keep + iterating. */ + return 1; + } + + /* Otherwise, we sucessfully attached to the thread. */ + } /* Construct the thread's private data. */ private = xmalloc (sizeof (struct private_thread_info)); |