aboutsummaryrefslogtreecommitdiff
path: root/gdb/target-delegates.c
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2019-02-07 19:16:04 -0700
committerKevin Buettner <kevinb@redhat.com>2019-04-08 20:09:37 -0700
commit3d6c62048d8408fbfb6c66830e0c650e36259637 (patch)
treedc8bd93aae61f80fab0ea589241021691a733035 /gdb/target-delegates.c
parent462cac5884ed4c38e6180b2e2769aaa5225e695b (diff)
downloadgdb-3d6c62048d8408fbfb6c66830e0c650e36259637.zip
gdb-3d6c62048d8408fbfb6c66830e0c650e36259637.tar.gz
gdb-3d6c62048d8408fbfb6c66830e0c650e36259637.tar.bz2
Introduce target_ops method thread_info_to_thread_handle
This patch adds a thread_info_to_thread_handle method to the target_ops struct. It also implements this functionality for remote targets and linux native threads. gdb/ChangeLog: * gdbthread.h (thread_to_thread_handle): Declare. * thread.c (gdbtypes.h): Include. (thread_to_thread_handle): New function. * target.h (struct target_ops): Add thread_info_to_thread_handle. (target_thread_info_to_thread_handle): Declare. * target.c (target_thread_info_to_thread_handle): New function. * target-debug.h (target_debug_print_gdb_byte_vector): Define. * target-delegates.c: Regenerate. * linux-thread-db.c (class thread_db_target): Add method thread_info_to_thread_handle. (thread_db_target::thread_info_to_thread_handle): Define. * remote.c (class remote_target): Add new method thread_info_to_thread_handle. (remote_target::thread_info_to_thread_handle): Define.
Diffstat (limited to 'gdb/target-delegates.c')
-rw-r--r--gdb/target-delegates.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 3654f02..cfc0ce0 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -70,6 +70,7 @@ struct dummy_target : public target_ops
const char *extra_thread_info (thread_info *arg0) override;
const char *thread_name (thread_info *arg0) override;
thread_info *thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, inferior *arg2) override;
+ gdb::byte_vector thread_info_to_thread_handle (struct thread_info *arg0) override;
void stop (ptid_t arg0) override;
void interrupt () override;
void pass_ctrlc () override;
@@ -237,6 +238,7 @@ struct debug_target : public target_ops
const char *extra_thread_info (thread_info *arg0) override;
const char *thread_name (thread_info *arg0) override;
thread_info *thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, inferior *arg2) override;
+ gdb::byte_vector thread_info_to_thread_handle (struct thread_info *arg0) override;
void stop (ptid_t arg0) override;
void interrupt () override;
void pass_ctrlc () override;
@@ -1854,6 +1856,32 @@ debug_target::thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, infe
return result;
}
+gdb::byte_vector
+target_ops::thread_info_to_thread_handle (struct thread_info *arg0)
+{
+ return this->beneath ()->thread_info_to_thread_handle (arg0);
+}
+
+gdb::byte_vector
+dummy_target::thread_info_to_thread_handle (struct thread_info *arg0)
+{
+ return gdb::byte_vector ();
+}
+
+gdb::byte_vector
+debug_target::thread_info_to_thread_handle (struct thread_info *arg0)
+{
+ gdb::byte_vector result;
+ fprintf_unfiltered (gdb_stdlog, "-> %s->thread_info_to_thread_handle (...)\n", this->beneath ()->shortname ());
+ result = this->beneath ()->thread_info_to_thread_handle (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->thread_info_to_thread_handle (", this->beneath ()->shortname ());
+ target_debug_print_struct_thread_info_p (arg0);
+ fputs_unfiltered (") = ", gdb_stdlog);
+ target_debug_print_gdb_byte_vector (result);
+ fputs_unfiltered ("\n", gdb_stdlog);
+ return result;
+}
+
void
target_ops::stop (ptid_t arg0)
{