diff options
author | Tom Tromey <tromey@adacore.com> | 2021-09-16 13:06:27 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-09-23 09:30:54 -0600 |
commit | 184ea2f7316c54dd5e0fa84f1fe07a222e8fb44c (patch) | |
tree | cb5f9fe2478d4c3e2233b7a575933c024fcbcb96 | |
parent | 334381ea466c4735fe533a9864991b862c094b60 (diff) | |
download | fsf-binutils-gdb-184ea2f7316c54dd5e0fa84f1fe07a222e8fb44c.zip fsf-binutils-gdb-184ea2f7316c54dd5e0fa84f1fe07a222e8fb44c.tar.gz fsf-binutils-gdb-184ea2f7316c54dd5e0fa84f1fe07a222e8fb44c.tar.bz2 |
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>
-rw-r--r-- | gdb/fbsd-nat.c | 6 | ||||
-rw-r--r-- | gdb/linux-fork.c | 2 | ||||
-rw-r--r-- | gdb/linux-nat.c | 15 | ||||
-rw-r--r-- | gdb/linux-thread-db.c | 4 | ||||
-rw-r--r-- | gdb/nat/linux-osdata.c | 4 | ||||
-rw-r--r-- | gdb/nat/linux-procfs.c | 2 | ||||
-rw-r--r-- | gdb/ravenscar-thread.c | 2 | ||||
-rw-r--r-- | gdb/remote.c | 10 | ||||
-rw-r--r-- | gdbserver/linux-low.cc | 12 | ||||
-rw-r--r-- | gdbserver/remote-utils.cc | 4 | ||||
-rw-r--r-- | gdbserver/thread-db.cc | 2 | ||||
-rw-r--r-- | gdbsupport/agent.cc | 2 |
12 files changed, 32 insertions, 33 deletions
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index e0ab3f0..181d344 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -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. */ diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index 1559ad9..83a124b 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -41,7 +41,7 @@ struct fork_info { explicit fork_info (pid_t pid) - : ptid (pid, pid, 0) + : ptid (pid, pid) { } diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 29ca62d..0492cc0 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -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 */ diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 245939b..3929589 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -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 diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c index 12f66d3..9746d12 100644 --- a/gdb/nat/linux-osdata.c +++ b/gdb/nat/linux-osdata.c @@ -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, diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c index 25d36c1..76e62fc 100644 --- a/gdb/nat/linux-procfs.c +++ b/gdb/nat/linux-procfs.c @@ -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; diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 490af3a..634af46 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -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 diff --git a/gdb/remote.c b/gdb/remote.c index b6da6b0..49ed209 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -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 diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index fc7a995..d27a216 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -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; diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc index 198a75a..b79c2aa 100644 --- a/gdbserver/remote-utils.cc +++ b/gdbserver/remote-utils.cc @@ -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. diff --git a/gdbserver/thread-db.cc b/gdbserver/thread-db.cc index 055a0fa..9a70cdf 100644 --- a/gdbserver/thread-db.cc +++ b/gdbserver/thread-db.cc @@ -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; diff --git a/gdbsupport/agent.cc b/gdbsupport/agent.cc index 086b08d..7a2c646 100644 --- a/gdbsupport/agent.cc +++ b/gdbsupport/agent.cc @@ -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); |