Make the field private, change the free function to be a method.
Change-Id: I05010e7d1bd58ce3895802eb263c029528427758
Approved-By: Tom Tromey <tom@tromey.com>
struct thread_info : public intrusive_list_node<thread_info>
{
thread_info (ptid_t id, process_info *process, void *target_data)
- : id (id), target_data (target_data), m_process (process)
+ : id (id), m_process (process), m_target_data (target_data)
{}
~thread_info ()
void set_regcache (struct regcache *regcache)
{ m_regcache = regcache; }
+ void *target_data ()
+ { return m_target_data; }
+
/* The id of this thread. */
ptid_t id;
- void *target_data;
-
/* The last resume GDB requested on this thread. */
enum resume_kind last_resume_kind = resume_continue;
private:
process_info *m_process;
struct regcache *m_regcache = nullptr;
+ void *m_target_data;
};
/* Return a pointer to the first thread, or NULL if there isn't one. */
m_thread_list.erase (m_thread_list.iterator_to (*thread));
}
-void *
-thread_target_data (struct thread_info *thread)
-{
- return thread->target_data;
-}
-
void
clear_inferiors (void)
{
void clear_inferiors (void);
-void *thread_target_data (struct thread_info *);
-
/* Set the inferior current working directory. If CWD is empty, unset
the directory. */
void set_inferior_cwd (std::string cwd);
static inline lwp_info *
get_thread_lwp (thread_info *thr)
{
- return static_cast<lwp_info *> (thread_target_data (thr));
+ return static_cast<lwp_info *> (thr->target_data ());
}
/* Information about a signal that is to be delivered to a thread. */
static void
update_debug_registers (thread_info *thread)
{
- windows_thread_info *th = (windows_thread_info *) thread_target_data (thread);
+ auto th = static_cast<windows_thread_info *> (thread->target_data ());
/* The actual update is done later just before resuming the lwp,
we just mark that the registers need updating. */
static DWORD64
win32_get_current_dr (int dr)
{
- windows_thread_info *th
- = (windows_thread_info *) thread_target_data (current_thread);
+ auto th
+ = static_cast<windows_thread_info *> (current_thread->target_data ());
win32_require_context (th);
if (thread == NULL)
return NULL;
- windows_thread_info *th = (windows_thread_info *) thread_target_data (thread);
+ auto th = static_cast<windows_thread_info *> (thread->target_data ());
if (disposition != DONT_INVALIDATE_CONTEXT)
win32_require_context (th);
return th;
static void
delete_thread_info (thread_info *thread)
{
- windows_thread_info *th = (windows_thread_info *) thread_target_data (thread);
+ auto th = static_cast<windows_thread_info *> (thread->target_data ());
thread->process ()->remove_thread (thread);
delete th;
static void
continue_one_thread (thread_info *thread, int thread_id)
{
- windows_thread_info *th = (windows_thread_info *) thread_target_data (thread);
+ auto th = static_cast<windows_thread_info *> (thread->target_data ());
if (thread_id == -1 || thread_id == th->tid)
{
static void
suspend_one_thread (thread_info *thread)
{
- windows_thread_info *th = (windows_thread_info *) thread_target_data (thread);
+ auto th = static_cast<windows_thread_info *> (thread->target_data ());
th->suspend ();
}