Add target method for converting thread handle to thread_info struct pointer
This patch adds a target method named `to_thread_handle_to_thread_info'. It is intended to map a thread library specific thread handle (such as pthread_t for the pthread library) to the corresponding GDB internal thread_info struct (pointer). An implementation is provided for Linux pthreads; see linux-thread-db.c. gdb/ChangeLog: * target.h (struct target_ops): Add to_thread_handle_to_thread_info. (target_thread_handle_to_thread_info): Declare. * target.c (target_thread_handle_to_thread_info): New function. * target-delegates.c: Regenerate. * gdbthread.h (find_thread_by_handle): Declare. * thread.c (find_thread_by_handle): New function. * linux-thread-db.c (thread_db_thread_handle_to_thread_info): New function. (init_thread_db_ops): Register thread_db_thread_handle_to_thread_info.
This commit is contained in:
parent
f557a88ab1
commit
e04ee09e24
7 changed files with 117 additions and 0 deletions
12
gdb/thread.c
12
gdb/thread.c
|
@ -519,6 +519,7 @@ find_thread_id (struct inferior *inf, int thr_num)
|
|||
}
|
||||
|
||||
/* Find a thread_info by matching PTID. */
|
||||
|
||||
struct thread_info *
|
||||
find_thread_ptid (ptid_t ptid)
|
||||
{
|
||||
|
@ -531,6 +532,17 @@ find_thread_ptid (ptid_t ptid)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* See gdbthread.h. */
|
||||
|
||||
struct thread_info *
|
||||
find_thread_by_handle (struct value *thread_handle, struct inferior *inf)
|
||||
{
|
||||
return target_thread_handle_to_thread_info
|
||||
(value_contents_all (thread_handle),
|
||||
TYPE_LENGTH (value_type (thread_handle)),
|
||||
inf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Thread iterator function.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue