thread = add_thread_with_info (proc_target,
ptid_t (pid, 0, pbuf[pi].pthid),
- priv);
+ private_thread_info_up (priv));
pi++;
}
pti->msg_state = DARWIN_RUNNING;
/* Add the new thread. */
- add_thread_with_info (this, ptid_t (inf->pid, 0, new_id), pti);
+ add_thread_with_info (this, ptid_t (inf->pid, 0, new_id),
+ private_thread_info_up (pti));
new_thread_vec.push_back (pti);
new_ix++;
continue;
virtual ~private_thread_info () = 0;
};
+/* Unique pointer wrapper for private_thread_info. */
+using private_thread_info_up = std::unique_ptr<private_thread_info>;
+
/* Threads are intrusively refcounted objects. Being the
user-selected thread is normally considered an implicit strong
reference and is thus not accounted in the refcount, unlike
struct frame_id initiating_frame = null_frame_id;
/* Private data used by the target vector implementation. */
- std::unique_ptr<private_thread_info> priv;
+ private_thread_info_up priv;
/* Branch trace information for this thread. */
struct btrace_thread_info btrace {};
/* Same as add_thread, and sets the private info. */
extern struct thread_info *add_thread_with_info (process_stratum_target *targ,
ptid_t ptid,
- private_thread_info *);
+ private_thread_info_up);
/* Delete thread THREAD and notify of thread exit. If the thread is
currently not deletable, don't actually delete it but still tag it
thread with this PTID, but it's marked exited, then the kernel
reused the tid of an old thread. */
if (tp == NULL || tp->state == THREAD_EXITED)
- tp = add_thread_with_info (info->process_target, ptid, priv);
+ tp = add_thread_with_info (info->process_target, ptid,
+ private_thread_info_up (priv));
else
tp->priv.reset (priv);
struct thread_info *
add_thread_with_info (process_stratum_target *targ, ptid_t ptid,
- private_thread_info *priv)
+ private_thread_info_up priv)
{
thread_info *result = add_thread_silent (targ, ptid);
- result->priv.reset (priv);
+ result->priv = std::move (priv);
if (print_thread_events)
gdb_printf (_("[New %s]\n"), target_pid_to_str (ptid).c_str ());