std::unordered_map<ptid_t, thread_info *> m_ptid_thread_map;
};
-/* Get the pid of PROC. */
-
-static inline int
-pid_of (const process_info *proc)
-{
- return proc->pid;
-}
-
/* Return a pointer to the current process. Note that the current
process may be non-null while the current thread (current_thread)
is null. */
for_each_process ([&] (process_info *proc)
{
- pid_t leader_pid = pid_of (proc);
+ pid_t leader_pid = proc->pid;
lwp_info *leader_lp = find_lwp_pid (ptid_t (leader_pid));
threads_debug_printf ("leader_pid=%d, leader_lp!=NULL=%d, "
{
const char *p = buf;
const char *pp;
- ULONGEST pid = 0, tid = 0;
if (*p == 'p')
{
+ ULONGEST pid;
+
/* Multi-process ptid. */
pp = unpack_varlen_hex (p + 1, &pid);
if (*pp != '.')
p = pp + 1;
- tid = hex_or_minus_one (p, &pp);
+ ULONGEST tid = hex_or_minus_one (p, &pp);
if (obuf)
*obuf = pp;
+
return ptid_t (pid, tid);
}
/* No multi-process. Just a tid. */
- tid = hex_or_minus_one (p, &pp);
+ ULONGEST tid = hex_or_minus_one (p, &pp);
/* Since GDB is not sending a process id (multi-process extensions
are off), then there's only one process. Default to the first in
the list. */
- pid = pid_of (get_first_process ());
+ int pid = get_first_process ()->pid;
if (obuf)
*obuf = pp;
+
return ptid_t (pid, tid);
}
attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
{
struct process_info *proc = current_process ();
- int pid = pid_of (proc);
+ int pid = proc->pid;
ptid_t ptid = ptid_t (pid, ti_p->ti_lid);
struct lwp_info *lwp;
int err;
find_one_thread then. That uses thread_db entry points that
do not walk libpthread's thread list, so should be safe, as
well as more efficient. */
- if (!linux_proc_task_list_dir_exists (pid_of (proc)))
+ if (!linux_proc_task_list_dir_exists (proc->pid))
thread_db_find_new_threads ();
thread_db_look_up_symbols ();
return 1;