aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-nat.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-06-11 12:05:27 -0600
committerTom Tromey <tom@tromey.com>2018-07-03 11:36:42 -0600
commite99b03dcf42606425eab8bd12eadb8aa4007f35a (patch)
treecce56508804d9ac552ebb678811b19008085fba7 /gdb/linux-nat.c
parentf2907e49910853edf3c1aec995b3c44b3bba8999 (diff)
downloadgdb-e99b03dcf42606425eab8bd12eadb8aa4007f35a.zip
gdb-e99b03dcf42606425eab8bd12eadb8aa4007f35a.tar.gz
gdb-e99b03dcf42606425eab8bd12eadb8aa4007f35a.tar.bz2
Remove ptid_get_pid
This removes ptid_get_pid in favor of calling the ptid_t::pid method. gdb/ChangeLog 2018-07-03 Tom Tromey <tom@tromey.com> * common/ptid.c (ptid_get_pid): Remove. * common/ptid.h (ptid_get_pid): Don't declare. * aarch64-linux-nat.c: Update. * ada-lang.c: Update. * aix-thread.c: Update. * alpha-bsd-nat.c: Update. * amd64-fbsd-nat.c: Update. * amd64-linux-nat.c: Update. * arm-linux-nat.c: Update. * arm-nbsd-nat.c: Update. * auxv.c: Update. * break-catch-syscall.c: Update. * breakpoint.c: Update. * bsd-uthread.c: Update. * corelow.c: Update. * ctf.c: Update. * darwin-nat.c: Update. * fbsd-nat.c: Update. * fbsd-tdep.c: Update. * gcore.c: Update. * gnu-nat.c: Update. * hppa-nbsd-nat.c: Update. * hppa-obsd-nat.c: Update. * i386-fbsd-nat.c: Update. * ia64-linux-nat.c: Update. * inf-ptrace.c: Update. * infcmd.c: Update. * inferior.c: Update. * inferior.h: Update. * inflow.c: Update. * infrun.c: Update. * linux-fork.c: Update. * linux-nat.c: Update. * linux-tdep.c: Update. * linux-thread-db.c: Update. * m68k-bsd-nat.c: Update. * mi/mi-interp.c: Update. * mi/mi-main.c: Update. * mips-linux-nat.c: Update. * mips-nbsd-nat.c: Update. * mips64-obsd-nat.c: Update. * nat/aarch64-linux-hw-point.c: Update. * nat/aarch64-linux.c: Update. * nat/linux-btrace.c: Update. * nat/linux-osdata.c: Update. * nat/linux-procfs.c: Update. * nat/x86-linux-dregs.c: Update. * nto-procfs.c: Update. * obsd-nat.c: Update. * ppc-linux-nat.c: Update. * ppc-nbsd-nat.c: Update. * ppc-obsd-nat.c: Update. * proc-service.c: Update. * procfs.c: Update. * python/py-inferior.c: Update. * python/py-infthread.c: Update. * ravenscar-thread.c: Update. * record.c: Update. * remote-sim.c: Update. * remote.c: Update. * rs6000-nat.c: Update. * s390-linux-nat.c: Update. * sh-nbsd-nat.c: Update. * sol-thread.c: Update. * sparc-nat.c: Update. * sparc64-tdep.c: Update. * spu-linux-nat.c: Update. * spu-tdep.c: Update. * target-debug.h: Update. * target.c: Update. * thread.c: Update. * tid-parse.c: Update. * tracefile-tfile.c: Update. * vax-bsd-nat.c: Update. * windows-nat.c: Update. * x86-linux-nat.c: Update. * x86-nat.c: Update. gdb/gdbserver/ChangeLog 2018-07-03 Tom Tromey <tom@tromey.com> * linux-low.c: Update. * linux-mips-low.c: Update. * lynx-low.c: Update. * mem-break.c: Update. * nto-low.c: Update. * remote-utils.c: Update. * server.c: Update. * spu-low.c: Update. * target.c: Update. * tracepoint.c: Update.
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r--gdb/linux-nat.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index f62910c..cc03a5d 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -410,7 +410,7 @@ linux_nat_target::post_attach (int pid)
void
linux_nat_target::post_startup_inferior (ptid_t ptid)
{
- linux_init_ptrace (ptid_get_pid (ptid), 0);
+ linux_init_ptrace (ptid.pid (), 0);
}
/* Return the number of known LWPs in the tgid given by PID. */
@@ -422,7 +422,7 @@ num_lwps (int pid)
struct lwp_info *lp;
for (lp = lwp_list; lp; lp = lp->next)
- if (ptid_get_pid (lp->ptid) == pid)
+ if (lp->ptid.pid () == pid)
count++;
return count;
@@ -821,7 +821,7 @@ lwp_lwpid_htab_remove_pid (void **slot, void *info)
struct lwp_info *lp = (struct lwp_info *) *slot;
int pid = *(int *) info;
- if (ptid_get_pid (lp->ptid) == pid)
+ if (lp->ptid.pid () == pid)
{
htab_clear_slot (lwp_lwpid_htab, slot);
lwp_list_remove (lp);
@@ -938,7 +938,7 @@ find_lwp_pid (ptid_t ptid)
if (ptid_lwp_p (ptid))
lwp = ptid_get_lwp (ptid);
else
- lwp = ptid_get_pid (ptid);
+ lwp = ptid.pid ();
dummy.ptid = ptid_t (0, lwp, 0);
lp = (struct lwp_info *) htab_find (lwp_lwpid_htab, &dummy);
@@ -978,7 +978,7 @@ linux_nat_switch_fork (ptid_t new_ptid)
{
struct lwp_info *lp;
- purge_lwp_list (ptid_get_pid (inferior_ptid));
+ purge_lwp_list (inferior_ptid.pid ());
lp = add_lwp (new_ptid);
lp->stopped = 1;
@@ -1196,8 +1196,8 @@ 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 (ptid_get_pid (inferior_ptid),
- ptid_get_pid (inferior_ptid),
+ ptid = ptid_t (inferior_ptid.pid (),
+ inferior_ptid.pid (),
0);
thread_change_ptid (inferior_ptid, ptid);
@@ -1245,7 +1245,7 @@ linux_nat_target::attach (const char *args, int from_tty)
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LNA: waitpid %ld, saving status %s\n",
- (long) ptid_get_pid (lp->ptid), status_to_str (status));
+ (long) lp->ptid.pid (), status_to_str (status));
lp->status = status;
@@ -1256,7 +1256,7 @@ linux_nat_target::attach (const char *args, int from_tty)
of threads/LWPs, and those structures may well be corrupted.
Note that once thread_db is loaded, we'll still use it to list
threads and associate pthread info with each LWP. */
- linux_proc_attach_tgid_threads (ptid_get_pid (lp->ptid),
+ linux_proc_attach_tgid_threads (lp->ptid.pid (),
attach_proc_task_lwp_callback);
if (target_can_async_p ())
@@ -1450,7 +1450,7 @@ detach_callback (struct lwp_info *lp, void *data)
/* We don't actually detach from the thread group leader just yet.
If the thread group exits, we must reap the zombie clone lwps
before we're able to reap the leader. */
- if (ptid_get_lwp (lp->ptid) != ptid_get_pid (lp->ptid))
+ if (ptid_get_lwp (lp->ptid) != lp->ptid.pid ())
detach_one_lwp (lp, NULL);
return 0;
}
@@ -1969,7 +1969,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
}
if (event == PTRACE_EVENT_FORK
- && linux_fork_checkpointing_p (ptid_get_pid (lp->ptid)))
+ && linux_fork_checkpointing_p (lp->ptid.pid ()))
{
/* Handle checkpointing by linux-fork.c here as a special
case. We don't want the follow-fork-mode or 'catch fork'
@@ -2008,7 +2008,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
"from LWP %d, new child is LWP %ld\n",
pid, new_pid);
- new_lp = add_lwp (ptid_t (ptid_get_pid (lp->ptid), new_pid, 0));
+ new_lp = add_lwp (ptid_t (lp->ptid.pid (), new_pid, 0));
new_lp->stopped = 1;
new_lp->resumed = 1;
@@ -2181,7 +2181,7 @@ wait_lwp (struct lwp_info *lp)
Therefore always use WNOHANG with sigsuspend - it is equivalent to
waiting waitpid but linux_proc_pid_is_zombie is safe this way. */
- if (ptid_get_pid (lp->ptid) == ptid_get_lwp (lp->ptid)
+ if (lp->ptid.pid () == ptid_get_lwp (lp->ptid)
&& linux_proc_pid_is_zombie (ptid_get_lwp (lp->ptid)))
{
thread_dead = 1;
@@ -2219,11 +2219,11 @@ wait_lwp (struct lwp_info *lp)
if (WIFEXITED (status) || WIFSIGNALED (status))
{
if (report_thread_events
- || ptid_get_pid (lp->ptid) == ptid_get_lwp (lp->ptid))
+ || lp->ptid.pid () == ptid_get_lwp (lp->ptid))
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog, "WL: LWP %d exited.\n",
- ptid_get_pid (lp->ptid));
+ lp->ptid.pid ());
/* If this is the leader exiting, it means the whole
process is gone. Store the status to report to the
@@ -2251,7 +2251,7 @@ wait_lwp (struct lwp_info *lp)
if (lp->must_set_ptrace_flags)
{
- struct inferior *inf = find_inferior_pid (ptid_get_pid (lp->ptid));
+ struct inferior *inf = find_inferior_pid (lp->ptid.pid ());
int options = linux_nat_ptrace_options (inf->attach_flag);
linux_enable_event_reporting (ptid_get_lwp (lp->ptid), options);
@@ -2973,7 +2973,7 @@ linux_nat_filter_event (int lwpid, int status)
if (WIFSTOPPED (status) && lp->must_set_ptrace_flags)
{
- struct inferior *inf = find_inferior_pid (ptid_get_pid (lp->ptid));
+ struct inferior *inf = find_inferior_pid (lp->ptid.pid ());
int options = linux_nat_ptrace_options (inf->attach_flag);
linux_enable_event_reporting (ptid_get_lwp (lp->ptid), options);
@@ -3014,7 +3014,7 @@ linux_nat_filter_event (int lwpid, int status)
if (WIFEXITED (status) || WIFSIGNALED (status))
{
if (!report_thread_events
- && num_lwps (ptid_get_pid (lp->ptid)) > 1)
+ && num_lwps (lp->ptid.pid ()) > 1)
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
@@ -3125,7 +3125,7 @@ linux_nat_filter_event (int lwpid, int status)
will receive it - unless they're using CLONE_THREAD to
share signals. Since we only want to report it once, we
mark it as ignored for all LWPs except this one. */
- iterate_over_lwps (ptid_t (ptid_get_pid (lp->ptid)),
+ iterate_over_lwps (ptid_t (lp->ptid.pid ()),
set_ignore_sigint, NULL);
lp->ignore_sigint = 0;
}
@@ -3227,7 +3227,7 @@ filter_exit_event (struct lwp_info *event_child,
{
ptid_t ptid = event_child->ptid;
- if (num_lwps (ptid_get_pid (ptid)) > 1)
+ if (num_lwps (ptid.pid ()) > 1)
{
if (report_thread_events)
ourstatus->kind = TARGET_WAITKIND_THREAD_EXITED;
@@ -3259,8 +3259,8 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
{
/* Upgrade the main thread's ptid. */
thread_change_ptid (inferior_ptid,
- ptid_t (ptid_get_pid (inferior_ptid),
- ptid_get_pid (inferior_ptid), 0));
+ ptid_t (inferior_ptid.pid (),
+ inferior_ptid.pid (), 0));
lp = add_initial_lwp (inferior_ptid);
lp->resumed = 1;
@@ -3688,7 +3688,7 @@ kill_unfollowed_fork_children (struct inferior *inf)
|| ws->kind == TARGET_WAITKIND_VFORKED)
{
ptid_t child_ptid = ws->value.related_pid;
- int child_pid = ptid_get_pid (child_ptid);
+ int child_pid = child_ptid.pid ();
int child_lwp = ptid_get_lwp (child_ptid);
kill_one_lwp (child_lwp);
@@ -3713,7 +3713,7 @@ linux_nat_target::kill ()
linux_fork_killall ();
else
{
- ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid));
+ ptid_t ptid = ptid_t (inferior_ptid.pid ());
/* Stop all threads before killing them, since ptrace requires
that the thread is stopped to sucessfully PTRACE_KILL. */
@@ -3735,7 +3735,7 @@ linux_nat_target::kill ()
void
linux_nat_target::mourn_inferior ()
{
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
purge_lwp_list (pid);
@@ -3784,7 +3784,7 @@ linux_xfer_siginfo (enum target_object object,
pid = ptid_get_lwp (inferior_ptid);
if (pid == 0)
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
if (offset > sizeof (siginfo))
return TARGET_XFER_E_IO;
@@ -3934,8 +3934,8 @@ linux_nat_target::pid_to_str (ptid_t ptid)
static char buf[64];
if (ptid_lwp_p (ptid)
- && (ptid_get_pid (ptid) != ptid_get_lwp (ptid)
- || num_lwps (ptid_get_pid (ptid)) > 1))
+ && (ptid.pid () != ptid_get_lwp (ptid)
+ || num_lwps (ptid.pid ()) > 1))
{
snprintf (buf, sizeof (buf), "LWP %ld", ptid_get_lwp (ptid));
return buf;
@@ -4238,7 +4238,7 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid)
{
char s[IPA_CMD_BUF_SIZE];
struct cleanup *old_chain;
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
std::vector<static_tracepoint_marker> markers;
const char *p = s;
ptid_t ptid = ptid_t (pid, 0, 0);
@@ -4503,12 +4503,12 @@ linux_nat_target::thread_address_space (ptid_t ptid)
/* An (lwpid,0,0) ptid. Look up the lwp object to get at the
tgid. */
lwp = find_lwp_pid (ptid);
- pid = ptid_get_pid (lwp->ptid);
+ pid = lwp->ptid.pid ();
}
else
{
/* A (pid,lwpid,0) ptid. */
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
}
inf = find_inferior_pid (pid);
@@ -4646,7 +4646,7 @@ linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
pid = ptid_get_lwp (ptid);
if (pid == 0)
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
errno = 0;
ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, siginfo);