mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-05 15:15:42 +00:00
gdbserver: add thread -> process backlink
In a few spots, we need to get to a process from a thread. Having a backlink from thread to process is cheap and makes the operation trivial, add it. Change-Id: I8a94b2919494b1dcaf954de2246386794308aa82 Reviewed-By: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
This commit is contained in:
committed by
Simon Marchi
parent
3470a0e144
commit
dceb3cd436
@@ -27,8 +27,8 @@ struct regcache;
|
|||||||
|
|
||||||
struct thread_info : public intrusive_list_node<thread_info>
|
struct thread_info : public intrusive_list_node<thread_info>
|
||||||
{
|
{
|
||||||
thread_info (ptid_t id, void *target_data)
|
thread_info (ptid_t id, process_info *process, void *target_data)
|
||||||
: id (id), target_data (target_data)
|
: id (id), target_data (target_data), m_process (process)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~thread_info ()
|
~thread_info ()
|
||||||
@@ -36,6 +36,10 @@ struct thread_info : public intrusive_list_node<thread_info>
|
|||||||
free_register_cache (this->regcache_data);
|
free_register_cache (this->regcache_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return the process owning this thread. */
|
||||||
|
process_info *process () const
|
||||||
|
{ return m_process; }
|
||||||
|
|
||||||
/* The id of this thread. */
|
/* The id of this thread. */
|
||||||
ptid_t id;
|
ptid_t id;
|
||||||
|
|
||||||
@@ -81,6 +85,9 @@ struct thread_info : public intrusive_list_node<thread_info>
|
|||||||
|
|
||||||
/* Thread options GDB requested with QThreadOptions. */
|
/* Thread options GDB requested with QThreadOptions. */
|
||||||
gdb_thread_options thread_options = 0;
|
gdb_thread_options thread_options = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
process_info *m_process;
|
||||||
};
|
};
|
||||||
|
|
||||||
void remove_thread (struct thread_info *thread);
|
void remove_thread (struct thread_info *thread);
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ add_thread (ptid_t thread_id, void *target_data)
|
|||||||
process_info *process = find_process_pid (thread_id.pid ());
|
process_info *process = find_process_pid (thread_id.pid ());
|
||||||
gdb_assert (process != nullptr);
|
gdb_assert (process != nullptr);
|
||||||
|
|
||||||
auto &new_thread = process->thread_list ().emplace_back (thread_id,
|
auto &new_thread
|
||||||
target_data);
|
= process->thread_list ().emplace_back (thread_id, process, target_data);
|
||||||
bool inserted
|
bool inserted
|
||||||
= process->thread_map ().insert ({thread_id, &new_thread}).second;
|
= process->thread_map ().insert ({thread_id, &new_thread}).second;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user