Remove defaulted 'tid' parameter to ptid_t constructor

I wanted to find, and potentially modify, all the spots where the
'tid' parameter to the ptid_t constructor was used.  So, I temporarily
removed this parameter and then rebuilt.

In order to make it simpler to search through the "real" (nonzero)
uses of this parameter, something I knew I'd have to do multiple
times, I removed any ", 0" from constructor calls.

Co-Authored-By: John Baldwin <jhb@FreeBSD.org>
This commit is contained in:
Tom Tromey 2021-09-16 13:06:27 -06:00
parent 334381ea46
commit 184ea2f731
12 changed files with 32 additions and 33 deletions

View File

@ -890,7 +890,7 @@ fbsd_add_threads (fbsd_nat_target *target, pid_t pid)
for (i = 0; i < nlwps; i++)
{
ptid_t ptid = ptid_t (pid, lwps[i], 0);
ptid_t ptid = ptid_t (pid, lwps[i]);
if (!in_thread_list (target, ptid))
{
@ -1191,7 +1191,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
if (ptrace (PT_LWPINFO, pid, (caddr_t) &pl, sizeof pl) == -1)
perror_with_name (("ptrace"));
wptid = ptid_t (pid, pl.pl_lwpid, 0);
wptid = ptid_t (pid, pl.pl_lwpid);
if (debug_fbsd_nat)
{
@ -1287,7 +1287,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
perror_with_name (("ptrace"));
gdb_assert (pl.pl_flags & PL_FLAG_CHILD);
child_ptid = ptid_t (child, pl.pl_lwpid, 0);
child_ptid = ptid_t (child, pl.pl_lwpid);
}
/* Enable additional events on the child process. */

View File

@ -41,7 +41,7 @@
struct fork_info
{
explicit fork_info (pid_t pid)
: ptid (pid, pid, 0)
: ptid (pid, pid)
{
}

View File

@ -929,7 +929,7 @@ find_lwp_pid (ptid_t ptid)
else
lwp = ptid.pid ();
dummy.ptid = ptid_t (0, lwp, 0);
dummy.ptid = ptid_t (0, lwp);
lp = (struct lwp_info *) htab_find (lwp_lwpid_htab, &dummy);
return lp;
}
@ -1176,8 +1176,7 @@ linux_nat_target::attach (const char *args, int from_tty)
/* The ptrace base target adds the main thread with (pid,0,0)
format. Decorate it with lwp info. */
ptid = ptid_t (inferior_ptid.pid (),
inferior_ptid.pid (),
0);
inferior_ptid.pid ());
thread_change_ptid (linux_target, inferior_ptid, ptid);
/* Add the initial process as the first LWP to the list. */
@ -1901,7 +1900,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
_("wait returned unexpected status 0x%x"), status);
}
ourstatus->value.related_pid = ptid_t (new_pid, new_pid, 0);
ourstatus->value.related_pid = ptid_t (new_pid, new_pid);
if (event == PTRACE_EVENT_FORK || event == PTRACE_EVENT_VFORK)
{
@ -1924,7 +1923,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
/* This won't actually modify the breakpoint list, but will
physically remove the breakpoints from the child. */
detach_breakpoints (ptid_t (new_pid, new_pid, 0));
detach_breakpoints (ptid_t (new_pid, new_pid));
/* Retain child fork in ptrace (stopped) state. */
if (!find_fork_pid (new_pid))
@ -1952,7 +1951,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
linux_nat_debug_printf
("Got clone event from LWP %d, new child is LWP %ld", pid, new_pid);
new_lp = add_lwp (ptid_t (lp->ptid.pid (), new_pid, 0));
new_lp = add_lwp (ptid_t (lp->ptid.pid (), new_pid));
new_lp->stopped = 1;
new_lp->resumed = 1;
@ -2840,7 +2839,7 @@ linux_nat_filter_event (int lwpid, int status)
/* A multi-thread exec after we had seen the leader exiting. */
linux_nat_debug_printf ("Re-adding thread group leader LWP %d.", lwpid);
lp = add_lwp (ptid_t (lwpid, lwpid, 0));
lp = add_lwp (ptid_t (lwpid, lwpid));
lp->stopped = 1;
lp->resumed = 1;
add_thread (linux_target, lp->ptid);
@ -4101,7 +4100,7 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid)
int pid = inferior_ptid.pid ();
std::vector<static_tracepoint_marker> markers;
const char *p = s;
ptid_t ptid = ptid_t (pid, 0, 0);
ptid_t ptid = ptid_t (pid, 0);
static_tracepoint_marker marker;
/* Pause all */

View File

@ -687,7 +687,7 @@ check_thread_db_callback (const td_thrhandle_t *th, void *arg)
calls are made, we just assume they were; future changes
to how GDB accesses TLS could result in this passing
without exercising the calls it's supposed to. */
ptid_t ptid = ptid_t (tdb_testinfo->info->pid, ti.ti_lid, 0);
ptid_t ptid = ptid_t (tdb_testinfo->info->pid, ti.ti_lid);
thread_info *thread_info = find_thread_ptid (linux_target, ptid);
if (thread_info != NULL && thread_info->priv != NULL)
{
@ -1842,7 +1842,7 @@ ptid_t
thread_db_target::get_ada_task_ptid (long lwp, long thread)
{
/* NPTL uses a 1:1 model, so the LWP id suffices. */
return ptid_t (inferior_ptid.pid (), lwp, 0);
return ptid_t (inferior_ptid.pid (), lwp);
}
void

View File

@ -266,7 +266,7 @@ get_cores_used_by_process (PID_T pid, int *cores, const int num_cores)
sscanf (dp->d_name, "%lld", &tid);
core = linux_common_core_of_thread (ptid_t ((pid_t) pid,
(pid_t) tid, 0));
(pid_t) tid));
if (core >= 0 && core < num_cores)
{
@ -521,7 +521,7 @@ linux_xfer_osdata_threads (struct buffer *buffer)
continue;
tid = atoi (dp2->d_name);
core = linux_common_core_of_thread (ptid_t (pid, tid, 0));
core = linux_common_core_of_thread (ptid_t (pid, tid));
buffer_xml_printf
(buffer,

View File

@ -308,7 +308,7 @@ linux_proc_attach_tgid_threads (pid_t pid,
lwp = strtoul (dp->d_name, NULL, 10);
if (lwp != 0)
{
ptid_t ptid = ptid_t (pid, lwp, 0);
ptid_t ptid = ptid_t (pid, lwp);
if (attach_lwp (ptid))
new_threads_found = 1;

View File

@ -251,7 +251,7 @@ ravenscar_thread_target::get_base_thread_from_ravenscar_task (ptid_t ptid)
return ptid;
base_cpu = get_thread_base_cpu (ptid);
return ptid_t (ptid.pid (), base_cpu, 0);
return ptid_t (ptid.pid (), base_cpu);
}
/* Fetch the ravenscar running thread from target memory, make sure

View File

@ -3101,7 +3101,7 @@ read_ptid (const char *buf, const char **obuf)
pp = unpack_varlen_hex (p + 1, &tid);
if (obuf)
*obuf = pp;
return ptid_t (pid, tid, 0);
return ptid_t (pid, tid);
}
/* No multi-process. Just a tid. */
@ -3126,7 +3126,7 @@ read_ptid (const char *buf, const char **obuf)
if (obuf)
*obuf = pp;
return ptid_t (pid, tid, 0);
return ptid_t (pid, tid);
}
static int
@ -4138,7 +4138,7 @@ remote_target::static_tracepoint_markers_by_strid (const char *strid)
ptid_t
remote_target::get_ada_task_ptid (long lwp, long thread)
{
return ptid_t (inferior_ptid.pid (), lwp, 0);
return ptid_t (inferior_ptid.pid (), lwp);
}
@ -6242,7 +6242,7 @@ remote_target::append_resumption (char *p, char *endp,
ptid_t nptid;
/* All (-1) threads of process. */
nptid = ptid_t (ptid.pid (), -1, 0);
nptid = ptid_t (ptid.pid (), -1);
p += xsnprintf (p, endp - p, ":");
p = write_ptid (p, endp, nptid);
@ -6959,7 +6959,7 @@ remote_target::remote_stop_ns (ptid_t ptid)
if (ptid.is_pid ())
/* All (-1) threads of process. */
nptid = ptid_t (ptid.pid (), -1, 0);
nptid = ptid_t (ptid.pid (), -1);
else
{
/* Small optimization: if we already have a stop reply for

View File

@ -491,7 +491,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
struct lwp_info *child_lwp;
struct thread_info *child_thr;
ptid = ptid_t (new_pid, new_pid, 0);
ptid = ptid_t (new_pid, new_pid);
if (debug_threads)
{
@ -597,7 +597,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
"from LWP %ld, new child is LWP %ld\n",
lwpid_of (event_thr), new_pid);
ptid = ptid_t (pid_of (event_thr), new_pid, 0);
ptid = ptid_t (pid_of (event_thr), new_pid);
new_lwp = add_lwp (ptid);
/* Either we're going to immediately resume the new thread
@ -974,7 +974,7 @@ linux_process_target::create_inferior (const char *program,
add_linux_process (pid, 0);
ptid = ptid_t (pid, pid, 0);
ptid = ptid_t (pid, pid);
new_lwp = add_lwp (ptid);
new_lwp->must_set_ptrace_flags = 1;
@ -1139,7 +1139,7 @@ linux_process_target::attach (unsigned long pid)
{
struct process_info *proc;
struct thread_info *initial_thread;
ptid_t ptid = ptid_t (pid, pid, 0);
ptid_t ptid = ptid_t (pid, pid);
int err;
proc = add_linux_process (pid, 1);
@ -1157,7 +1157,7 @@ linux_process_target::attach (unsigned long pid)
/* Don't ignore the initial SIGSTOP if we just attached to this
process. It will be collected by wait shortly. */
initial_thread = find_thread_ptid (ptid_t (pid, pid, 0));
initial_thread = find_thread_ptid (ptid_t (pid, pid));
initial_thread->last_resume_kind = resume_stop;
/* We must attach to every LWP. If /proc is mounted, use that to
@ -2272,7 +2272,7 @@ linux_process_target::filter_event (int lwpid, int wstat)
"after exec.\n", lwpid);
}
child_ptid = ptid_t (lwpid, lwpid, 0);
child_ptid = ptid_t (lwpid, lwpid);
child = add_lwp (child_ptid);
child->stopped = 1;
current_thread = child->thread;

View File

@ -581,7 +581,7 @@ read_ptid (const char *buf, const char **obuf)
if (obuf)
*obuf = pp;
return ptid_t (pid, tid, 0);
return ptid_t (pid, tid);
}
/* No multi-process. Just a tid. */
@ -594,7 +594,7 @@ read_ptid (const char *buf, const char **obuf)
if (obuf)
*obuf = pp;
return ptid_t (pid, tid, 0);
return ptid_t (pid, tid);
}
/* Write COUNT bytes in BUF to the client.

View File

@ -214,7 +214,7 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
{
struct process_info *proc = current_process ();
int pid = pid_of (proc);
ptid_t ptid = ptid_t (pid, ti_p->ti_lid, 0);
ptid_t ptid = ptid_t (pid, ti_p->ti_lid);
struct lwp_info *lwp;
int err;

View File

@ -190,7 +190,7 @@ agent_run_command (int pid, const char *cmd, int len)
{
int fd;
int tid = agent_get_helper_thread_id ();
ptid_t ptid = ptid_t (pid, tid, 0);
ptid_t ptid = ptid_t (pid, tid);
int ret = target_write_memory (ipa_sym_addrs.addr_cmd_buf,
(gdb_byte *) cmd, len);