From e04ee09e24563f013c35cdebd7e9de3092b99b83 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Wed, 4 May 2016 15:21:12 -0700 Subject: 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. --- gdb/target.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gdb/target.c') diff --git a/gdb/target.c b/gdb/target.c index 55ff99e..5a2c087 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2244,6 +2244,15 @@ target_thread_name (struct thread_info *info) return current_target.to_thread_name (¤t_target, info); } +struct thread_info * +target_thread_handle_to_thread_info (const gdb_byte *thread_handle, + int handle_len, + struct inferior *inf) +{ + return current_target.to_thread_handle_to_thread_info + (¤t_target, thread_handle, handle_len, inf); +} + void target_resume (ptid_t ptid, int step, enum gdb_signal signal) { -- cgit v1.1