diff options
author | Daniel Jacobowitz <drow@false.org> | 2005-07-13 15:02:49 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2005-07-13 15:02:49 +0000 |
commit | a06660f79997c37a351afbce6ce75bd0c3de1276 (patch) | |
tree | b65b5cbc4f7cd4d3c25bba690da003c6605be6af /gdb/gdbserver/inferiors.c | |
parent | 5a1f5858d43f5e99d8faa000263051a89ede63d4 (diff) | |
download | gdb-a06660f79997c37a351afbce6ce75bd0c3de1276.zip gdb-a06660f79997c37a351afbce6ce75bd0c3de1276.tar.gz gdb-a06660f79997c37a351afbce6ce75bd0c3de1276.tar.bz2 |
* inferiors.c (struct thread_info): Add gdb_id.
(add_thread): Add gdb_id argument.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): New.
* linux-low.c (linux_create_inferior, linux_attach_lwp): Update
calls to add_thread.
* remote-utils.c (prepare_resume_reply: Use thread_to_gdb_id.
* server.c (handle_query): Use thread_to_gdb_id.
(handle_v_cont, main): Use gdb_id_to_thread_id.
* server.h (add_thread): Update prototype.
(thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): New
prototypes.
Diffstat (limited to 'gdb/gdbserver/inferiors.c')
-rw-r--r-- | gdb/gdbserver/inferiors.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c index 65e5a82..cbfede7 100644 --- a/gdb/gdbserver/inferiors.c +++ b/gdb/gdbserver/inferiors.c @@ -30,6 +30,7 @@ struct thread_info struct inferior_list_entry entry; void *target_data; void *regcache_data; + unsigned int gdb_id; }; struct inferior_list all_threads; @@ -102,7 +103,7 @@ remove_inferior (struct inferior_list *list, } void -add_thread (unsigned long thread_id, void *target_data) +add_thread (unsigned long thread_id, void *target_data, unsigned int gdb_id) { struct thread_info *new_thread = (struct thread_info *) malloc (sizeof (*new_thread)); @@ -118,6 +119,45 @@ add_thread (unsigned long thread_id, void *target_data) new_thread->target_data = target_data; set_inferior_regcache_data (new_thread, new_register_cache ()); + new_thread->gdb_id = gdb_id; +} + +unsigned int +thread_id_to_gdb_id (unsigned long thread_id) +{ + struct inferior_list_entry *inf = all_threads.head; + + while (inf != NULL) + { + struct thread_info *thread = get_thread (inf); + if (inf->id == thread_id) + return thread->gdb_id; + inf = inf->next; + } + + return 0; +} + +unsigned int +thread_to_gdb_id (struct thread_info *thread) +{ + return thread->gdb_id; +} + +unsigned long +gdb_id_to_thread_id (unsigned int gdb_id) +{ + struct inferior_list_entry *inf = all_threads.head; + + while (inf != NULL) + { + struct thread_info *thread = get_thread (inf); + if (thread->gdb_id == gdb_id) + return inf->id; + inf = inf->next; + } + + return 0; } static void |