aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2023-03-27 12:53:54 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-04-04 21:05:30 -0400
commit3c8af02fa0b140edcde2a65d016f565aad1a699b (patch)
tree7d738cf49a90ef27a9b700b5e914f6d91b765e73 /gdb/thread.c
parent91385d13a8820bf3e6274ec51d4da613bae67554 (diff)
downloadgdb-3c8af02fa0b140edcde2a65d016f565aad1a699b.zip
gdb-3c8af02fa0b140edcde2a65d016f565aad1a699b.tar.gz
gdb-3c8af02fa0b140edcde2a65d016f565aad1a699b.tar.bz2
gdb: make find_thread_ptid an inferior method
Make find_thread_ptid (the overload that takes an inferior) a method of struct inferior. Change-Id: Ie5b9fa623ff35aa7ddb45e2805254fc8e83c9cd4 Reviewed-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 25d97cd6..38afdff 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -221,7 +221,7 @@ set_thread_exited (thread_info *tp, bool silent)
clear_thread_inferior_resources (tp);
/* Remove from the ptid_t map. We don't want for
- find_thread_ptid to find exited threads. Also, the target
+ inferior::find_thread to find exited threads. Also, the target
may reuse the ptid for a new thread, and there can only be
one value per key; adding a new thread with the same ptid_t
would overwrite the exited thread's ptid entry. */
@@ -275,7 +275,7 @@ add_thread_silent (process_stratum_target *targ, ptid_t ptid)
If we do, it must be dead, otherwise we wouldn't be adding a new
thread with the same id. The OS is reusing this id --- delete
the old thread, and create a new one. */
- thread_info *tp = find_thread_ptid (inf, ptid);
+ thread_info *tp = inf->find_thread (ptid);
if (tp != nullptr)
delete_thread (tp);
@@ -520,21 +520,7 @@ find_thread_ptid (process_stratum_target *targ, ptid_t ptid)
inferior *inf = find_inferior_ptid (targ, ptid);
if (inf == NULL)
return NULL;
- return find_thread_ptid (inf, ptid);
-}
-
-/* See gdbthread.h. */
-
-struct thread_info *
-find_thread_ptid (inferior *inf, ptid_t ptid)
-{
- gdb_assert (inf != nullptr);
-
- auto it = inf->ptid_thread_map.find (ptid);
- if (it != inf->ptid_thread_map.end ())
- return it->second;
- else
- return nullptr;
+ return inf->find_thread (ptid);
}
/* See gdbthread.h. */
@@ -802,7 +788,7 @@ thread_change_ptid (process_stratum_target *targ,
inf = find_inferior_ptid (targ, old_ptid);
inf->pid = new_ptid.pid ();
- tp = find_thread_ptid (inf, old_ptid);
+ tp = inf->find_thread (old_ptid);
gdb_assert (tp != nullptr);
int num_erased = inf->ptid_thread_map.erase (old_ptid);