mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2025-02-01 06:25:50 +00:00
Tru64: Dead threads are never deleted.
* dec-thread.c (dec_thread_ptid_is_alive): New function. (dec_thread_count_gdb_threads): Fix counter increment. (dec_thread_add_gdb_thread): Fix *listp increment. (resync_thread_list): Fix bug in deletion of dead threads that caused all threads to be deleted, instead of just the dead ones.
This commit is contained in:
parent
60a0e0e75c
commit
1596ad2368
@ -1,3 +1,12 @@
|
||||
2010-01-14 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
Tru64: Dead threads are never deleted.
|
||||
* dec-thread.c (dec_thread_ptid_is_alive): New function.
|
||||
(dec_thread_count_gdb_threads): Fix counter increment.
|
||||
(dec_thread_add_gdb_thread): Fix *listp increment.
|
||||
(resync_thread_list): Fix bug in deletion of dead threads that
|
||||
caused all threads to be deleted, instead of just the dead ones.
|
||||
|
||||
2010-01-13 Phil Muldoon <pmuldoon@redhat.com>
|
||||
|
||||
PR python/10705
|
||||
|
@ -311,6 +311,30 @@ ptid_build_from_info (struct dec_thread_info info)
|
||||
return ptid_build (pid, 0, (long) info.thread);
|
||||
}
|
||||
|
||||
/* Return non-zero if PTID is still alive.
|
||||
|
||||
Assumes that DEC_THREAD_LIST is up to date. */
|
||||
static int
|
||||
dec_thread_ptid_is_alive (ptid_t ptid)
|
||||
{
|
||||
pthreadDebugId_t tid = ptid_get_tid (ptid);
|
||||
int i;
|
||||
struct dec_thread_info *info;
|
||||
|
||||
if (tid == 0)
|
||||
/* This is the thread corresponding to the process. This ptid
|
||||
is always alive until the program exits. */
|
||||
return 1;
|
||||
|
||||
/* Search whether an entry with the same tid exists in the dec-thread
|
||||
list of threads. If it does, then the thread is still alive.
|
||||
No match found means that the thread must be dead, now. */
|
||||
for (i = 0; VEC_iterate (dec_thread_info_s, dec_thread_list, i, info); i++)
|
||||
if (info->thread == tid)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Recompute the list of user threads and store the result in
|
||||
DEC_THREAD_LIST. */
|
||||
|
||||
@ -352,7 +376,7 @@ dec_thread_count_gdb_threads (struct thread_info *ignored, void *context)
|
||||
{
|
||||
int *count = (int *) context;
|
||||
|
||||
(void) *count++; /* The cast to void is to prevent a -Wunused warning. */
|
||||
*count = *count + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -366,7 +390,7 @@ dec_thread_add_gdb_thread (struct thread_info *info, void *context)
|
||||
struct thread_info ***listp = (struct thread_info ***) context;
|
||||
|
||||
**listp = info;
|
||||
(void) *listp++; /* The cast to void is to prevent a -Wunused warning. */
|
||||
*listp = *listp + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -386,8 +410,7 @@ resync_thread_list (void)
|
||||
|
||||
/* Add new threads. */
|
||||
|
||||
for (i = 0; VEC_iterate (dec_thread_info_s, dec_thread_list, i, info);
|
||||
i++)
|
||||
for (i = 0; VEC_iterate (dec_thread_info_s, dec_thread_list, i, info); i++)
|
||||
{
|
||||
ptid_t ptid = ptid_build_from_info (*info);
|
||||
|
||||
@ -404,17 +427,10 @@ resync_thread_list (void)
|
||||
gdb_thread_list = alloca (num_gdb_threads * sizeof (struct thread_info *));
|
||||
next_thread_info = gdb_thread_list;
|
||||
iterate_over_threads (dec_thread_add_gdb_thread, (void *) &next_thread_info);
|
||||
for (i = 0; i < num_gdb_threads; i++)
|
||||
{
|
||||
int j;
|
||||
|
||||
for (j = 0; VEC_iterate (dec_thread_info_s, dec_thread_list, j, info);
|
||||
j++)
|
||||
if (ptid_equal (gdb_thread_list[i]->ptid,
|
||||
ptid_build_from_info (*info)))
|
||||
break;
|
||||
for (i = 0; i < num_gdb_threads; i++)
|
||||
if (!dec_thread_ptid_is_alive (gdb_thread_list[i]->ptid))
|
||||
delete_thread (gdb_thread_list[i]->ptid);
|
||||
}
|
||||
}
|
||||
|
||||
/* The "to_detach" method of the dec_thread_ops. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user