aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 6d410fb..b47d990 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -236,8 +236,17 @@ new_thread (ptid_t ptid)
tp->ptid = ptid;
tp->num = ++highest_thread_num;
- tp->next = thread_list;
- thread_list = tp;
+
+ if (thread_list == NULL)
+ thread_list = tp;
+ else
+ {
+ struct thread_info *last;
+
+ for (last = thread_list; last->next != NULL; last = last->next)
+ ;
+ last->next = tp;
+ }
/* Nothing to follow yet. */
tp->pending_follow.kind = TARGET_WAITKIND_SPURIOUS;