Remove ptid_get_lwp

This removes ptid_get_lwp in favor of calling the ptid_t::lwp method.

gdb/ChangeLog
2018-07-03  Tom Tromey  <tom@tromey.com>

	* common/ptid.c (ptid_get_lwp): Remove.
	* common/ptid.h (ptid_get_lwp): Don't declare.
	* aarch64-linux-nat.c: Update.
	* ada-tasks.c: Update.
	* aix-thread.c: Update.
	* amd64-linux-nat.c: Update.
	* arm-linux-nat.c: Update.
	* corelow.c: Update.
	* fbsd-nat.c: Update.
	* fbsd-tdep.c: Update.
	* gnu-nat.c: Update.
	* i386-cygwin-tdep.c: Update.
	* i386-gnu-nat.c: Update.
	* i386-linux-nat.c: Update.
	* ia64-linux-nat.c: Update.
	* inf-ptrace.c: Update.
	* infrun.c: Update.
	* linux-fork.c: Update.
	* linux-nat.c: Update.
	* linux-tdep.c: Update.
	* linux-thread-db.c: Update.
	* mips-linux-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.
	* obsd-nat.c: Update.
	* ppc-fbsd-nat.c: Update.
	* ppc-linux-nat.c: Update.
	* procfs.c: Update.
	* python/py-infthread.c: Update.
	* ravenscar-thread.c: Update.
	* remote.c: Update.
	* s390-linux-nat.c: Update.
	* sol-thread.c: Update.
	* sol2-tdep.c: Update.
	* spu-linux-nat.c: Update.
	* x86-linux-nat.c: Update.
	* xtensa-linux-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.
	* nto-low.c: Update.
	* remote-utils.c: Update.
	* server.c: Update.
	* spu-low.c: Update.
	* target.c: Update.
	* thread-db.c: Update.
This commit is contained in:
Tom Tromey 2018-06-11 12:10:09 -06:00
parent e99b03dcf4
commit e38504b392
52 changed files with 263 additions and 219 deletions

View File

@ -1,3 +1,47 @@
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_lwp): Remove.
* common/ptid.h (ptid_get_lwp): Don't declare.
* aarch64-linux-nat.c: Update.
* ada-tasks.c: Update.
* aix-thread.c: Update.
* amd64-linux-nat.c: Update.
* arm-linux-nat.c: Update.
* corelow.c: Update.
* fbsd-nat.c: Update.
* fbsd-tdep.c: Update.
* gnu-nat.c: Update.
* i386-cygwin-tdep.c: Update.
* i386-gnu-nat.c: Update.
* i386-linux-nat.c: Update.
* ia64-linux-nat.c: Update.
* inf-ptrace.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-tdep.c: Update.
* linux-thread-db.c: Update.
* mips-linux-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.
* obsd-nat.c: Update.
* ppc-fbsd-nat.c: Update.
* ppc-linux-nat.c: Update.
* procfs.c: Update.
* python/py-infthread.c: Update.
* ravenscar-thread.c: Update.
* remote.c: Update.
* s390-linux-nat.c: Update.
* sol-thread.c: Update.
* sol2-tdep.c: Update.
* spu-linux-nat.c: Update.
* x86-linux-nat.c: Update.
* xtensa-linux-nat.c: Update.
2018-07-03 Tom Tromey <tom@tromey.com> 2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_pid): Remove. * common/ptid.c (ptid_get_pid): Remove.

View File

@ -212,7 +212,7 @@ fetch_gregs_from_thread (struct regcache *regcache)
and arm. */ and arm. */
gdb_static_assert (sizeof (regs) >= 18 * 4); gdb_static_assert (sizeof (regs) >= 18 * 4);
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
iovec.iov_base = &regs; iovec.iov_base = &regs;
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
@ -249,7 +249,7 @@ store_gregs_to_thread (const struct regcache *regcache)
/* Make sure REGS can hold all registers contents on both aarch64 /* Make sure REGS can hold all registers contents on both aarch64
and arm. */ and arm. */
gdb_static_assert (sizeof (regs) >= 18 * 4); gdb_static_assert (sizeof (regs) >= 18 * 4);
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
iovec.iov_base = &regs; iovec.iov_base = &regs;
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
@ -292,7 +292,7 @@ fetch_fpregs_from_thread (struct regcache *regcache)
and arm. */ and arm. */
gdb_static_assert (sizeof regs >= VFP_REGS_SIZE); gdb_static_assert (sizeof regs >= VFP_REGS_SIZE);
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
iovec.iov_base = &regs; iovec.iov_base = &regs;
@ -338,7 +338,7 @@ store_fpregs_to_thread (const struct regcache *regcache)
/* Make sure REGS can hold all VFP registers contents on both aarch64 /* Make sure REGS can hold all VFP registers contents on both aarch64
and arm. */ and arm. */
gdb_static_assert (sizeof regs >= VFP_REGS_SIZE); gdb_static_assert (sizeof regs >= VFP_REGS_SIZE);
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
iovec.iov_base = &regs; iovec.iov_base = &regs;
@ -394,7 +394,7 @@ static void
fetch_sveregs_from_thread (struct regcache *regcache) fetch_sveregs_from_thread (struct regcache *regcache)
{ {
std::unique_ptr<gdb_byte[]> base std::unique_ptr<gdb_byte[]> base
= aarch64_sve_get_sveregs (ptid_get_lwp (regcache->ptid ())); = aarch64_sve_get_sveregs (regcache->ptid ().lwp ());
aarch64_sve_regs_copy_to_reg_buf (regcache, base.get ()); aarch64_sve_regs_copy_to_reg_buf (regcache, base.get ());
} }
@ -406,7 +406,7 @@ store_sveregs_to_thread (struct regcache *regcache)
{ {
int ret; int ret;
struct iovec iovec; struct iovec iovec;
int tid = ptid_get_lwp (regcache->ptid ()); int tid = regcache->ptid ().lwp ();
/* Obtain a dump of SVE registers from ptrace. */ /* Obtain a dump of SVE registers from ptrace. */
std::unique_ptr<gdb_byte[]> base = aarch64_sve_get_sveregs (tid); std::unique_ptr<gdb_byte[]> base = aarch64_sve_get_sveregs (tid);
@ -597,7 +597,7 @@ aarch64_linux_nat_target::read_description ()
gdb_byte regbuf[VFP_REGS_SIZE]; gdb_byte regbuf[VFP_REGS_SIZE];
struct iovec iovec; struct iovec iovec;
tid = ptid_get_lwp (inferior_ptid); tid = inferior_ptid.lwp ();
iovec.iov_base = regbuf; iovec.iov_base = regbuf;
iovec.iov_len = VFP_REGS_SIZE; iovec.iov_len = VFP_REGS_SIZE;

View File

@ -1204,7 +1204,7 @@ info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf)
/* Print the TID and LWP. */ /* Print the TID and LWP. */
printf_filtered (_("Thread: %#lx\n"), ptid_get_tid (task_info->ptid)); printf_filtered (_("Thread: %#lx\n"), ptid_get_tid (task_info->ptid));
printf_filtered (_("LWP: %#lx\n"), ptid_get_lwp (task_info->ptid)); printf_filtered (_("LWP: %#lx\n"), task_info->ptid.lwp ());
/* If set, print the base CPU. */ /* If set, print the base CPU. */
if (task_info->base_cpu != 0) if (task_info->base_cpu != 0)

View File

@ -681,9 +681,9 @@ ptid_cmp (ptid_t ptid1, ptid_t ptid2)
return -1; return -1;
else if (ptid_get_tid (ptid1) > ptid_get_tid (ptid2)) else if (ptid_get_tid (ptid1) > ptid_get_tid (ptid2))
return 1; return 1;
else if (ptid_get_lwp (ptid1) < ptid_get_lwp (ptid2)) else if (ptid1.lwp () < ptid2.lwp ())
return -1; return -1;
else if (ptid_get_lwp (ptid1) > ptid_get_lwp (ptid2)) else if (ptid1.lwp () > ptid2.lwp ())
return 1; return 1;
else else
return 0; return 0;
@ -1050,14 +1050,14 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
thread = find_thread_ptid (ptid); thread = find_thread_ptid (ptid);
if (!thread) if (!thread)
error (_("aix-thread resume: unknown pthread %ld"), error (_("aix-thread resume: unknown pthread %ld"),
ptid_get_lwp (ptid)); ptid.lwp ());
aix_thread_info *priv = get_aix_thread_info (thread); aix_thread_info *priv = get_aix_thread_info (thread);
tid[0] = priv->tid; tid[0] = priv->tid;
if (tid[0] == PTHDB_INVALID_TID) if (tid[0] == PTHDB_INVALID_TID)
error (_("aix-thread resume: no tid for pthread %ld"), error (_("aix-thread resume: no tid for pthread %ld"),
ptid_get_lwp (ptid)); ptid.lwp ());
tid[1] = 0; tid[1] = 0;
if (arch64) if (arch64)

View File

@ -148,7 +148,7 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
int tid; int tid;
/* GNU/Linux LWP ID's are process ID's. */ /* GNU/Linux LWP ID's are process ID's. */
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
if (tid == 0) if (tid == 0)
tid = regcache->ptid ().pid (); /* Not a threaded program. */ tid = regcache->ptid ().pid (); /* Not a threaded program. */
@ -226,7 +226,7 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
int tid; int tid;
/* GNU/Linux LWP ID's are process ID's. */ /* GNU/Linux LWP ID's are process ID's. */
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
if (tid == 0) if (tid == 0)
tid = regcache->ptid ().pid (); /* Not a threaded program. */ tid = regcache->ptid ().pid (); /* Not a threaded program. */

View File

@ -119,7 +119,7 @@ fetch_fpregs (struct regcache *regcache)
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE]; gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
/* Get the thread id for the ptrace call. */ /* Get the thread id for the ptrace call. */
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
/* Read the floating point state. */ /* Read the floating point state. */
if (have_ptrace_getregset == TRIBOOL_TRUE) if (have_ptrace_getregset == TRIBOOL_TRUE)
@ -155,7 +155,7 @@ store_fpregs (const struct regcache *regcache)
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE]; gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
/* Get the thread id for the ptrace call. */ /* Get the thread id for the ptrace call. */
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
/* Read the floating point state. */ /* Read the floating point state. */
if (have_ptrace_getregset == TRIBOOL_TRUE) if (have_ptrace_getregset == TRIBOOL_TRUE)
@ -209,7 +209,7 @@ fetch_regs (struct regcache *regcache)
elf_gregset_t regs; elf_gregset_t regs;
/* Get the thread id for the ptrace call. */ /* Get the thread id for the ptrace call. */
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
if (have_ptrace_getregset == TRIBOOL_TRUE) if (have_ptrace_getregset == TRIBOOL_TRUE)
{ {
@ -236,7 +236,7 @@ store_regs (const struct regcache *regcache)
elf_gregset_t regs; elf_gregset_t regs;
/* Get the thread id for the ptrace call. */ /* Get the thread id for the ptrace call. */
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
/* Fetch the general registers. */ /* Fetch the general registers. */
if (have_ptrace_getregset == TRIBOOL_TRUE) if (have_ptrace_getregset == TRIBOOL_TRUE)
@ -284,7 +284,7 @@ fetch_wmmx_regs (struct regcache *regcache)
int ret, regno, tid; int ret, regno, tid;
/* Get the thread id for the ptrace call. */ /* Get the thread id for the ptrace call. */
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf); ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
if (ret < 0) if (ret < 0)
@ -309,7 +309,7 @@ store_wmmx_regs (const struct regcache *regcache)
int ret, regno, tid; int ret, regno, tid;
/* Get the thread id for the ptrace call. */ /* Get the thread id for the ptrace call. */
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf); ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
if (ret < 0) if (ret < 0)
@ -344,7 +344,7 @@ fetch_vfp_regs (struct regcache *regcache)
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Get the thread id for the ptrace call. */ /* Get the thread id for the ptrace call. */
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
if (have_ptrace_getregset == TRIBOOL_TRUE) if (have_ptrace_getregset == TRIBOOL_TRUE)
{ {
@ -373,7 +373,7 @@ store_vfp_regs (const struct regcache *regcache)
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Get the thread id for the ptrace call. */ /* Get the thread id for the ptrace call. */
tid = ptid_get_lwp (regcache->ptid ()); tid = regcache->ptid ().lwp ();
if (have_ptrace_getregset == TRIBOOL_TRUE) if (have_ptrace_getregset == TRIBOOL_TRUE)
{ {
@ -539,7 +539,7 @@ arm_linux_nat_target::read_description ()
{ {
elf_gregset_t gpregs; elf_gregset_t gpregs;
struct iovec iov; struct iovec iov;
int tid = ptid_get_lwp (inferior_ptid); int tid = inferior_ptid.lwp ();
iov.iov_base = &gpregs; iov.iov_base = &gpregs;
iov.iov_len = sizeof (gpregs); iov.iov_len = sizeof (gpregs);
@ -576,7 +576,7 @@ arm_linux_nat_target::read_description ()
/* Now make sure that the kernel supports reading these /* Now make sure that the kernel supports reading these
registers. Support was added in 2.6.30. */ registers. Support was added in 2.6.30. */
pid = ptid_get_lwp (inferior_ptid); pid = inferior_ptid.lwp ();
errno = 0; errno = 0;
buf = (char *) alloca (VFP_REGS_SIZE); buf = (char *) alloca (VFP_REGS_SIZE);
if (ptrace (PTRACE_GETVFPREGS, pid, 0, buf) < 0 if (ptrace (PTRACE_GETVFPREGS, pid, 0, buf) < 0
@ -622,7 +622,7 @@ arm_linux_get_hwbp_cap (void)
int tid; int tid;
unsigned int val; unsigned int val;
tid = ptid_get_lwp (inferior_ptid); tid = inferior_ptid.lwp ();
if (ptrace (PTRACE_GETHBPREGS, tid, 0, &val) < 0) if (ptrace (PTRACE_GETHBPREGS, tid, 0, &val) < 0)
available = 0; available = 0;
else else
@ -1250,7 +1250,7 @@ arm_linux_nat_target::low_prepare_to_resume (struct lwp_info *lwp)
struct arm_linux_hw_breakpoint *bpts, *wpts; struct arm_linux_hw_breakpoint *bpts, *wpts;
struct arch_lwp_info *arm_lwp_info = lwp->arch_private; struct arch_lwp_info *arm_lwp_info = lwp->arch_private;
pid = ptid_get_lwp (lwp->ptid); pid = lwp->ptid.lwp ();
bpts = arm_linux_get_debug_reg_state (lwp->ptid.pid ())->bpts; bpts = arm_linux_get_debug_reg_state (lwp->ptid.pid ())->bpts;
wpts = arm_linux_get_debug_reg_state (lwp->ptid.pid ())->wpts; wpts = arm_linux_get_debug_reg_state (lwp->ptid.pid ())->wpts;

View File

@ -27,14 +27,6 @@ ptid_t minus_one_ptid = ptid_t::make_minus_one ();
/* See ptid.h. */ /* See ptid.h. */
long
ptid_get_lwp (const ptid_t &ptid)
{
return ptid.lwp ();
}
/* See ptid.h. */
long long
ptid_get_tid (const ptid_t &ptid) ptid_get_tid (const ptid_t &ptid)
{ {

View File

@ -156,10 +156,6 @@ extern ptid_t minus_one_ptid;
/* The following functions are kept for backwards compatibility. The use of /* The following functions are kept for backwards compatibility. The use of
the ptid_t methods is preferred. */ the ptid_t methods is preferred. */
/* See ptid_t::lwp. */
extern long ptid_get_lwp (const ptid_t &ptid);
/* See ptid_t::tid. */ /* See ptid_t::tid. */
extern long ptid_get_tid (const ptid_t &ptid); extern long ptid_get_tid (const ptid_t &ptid);

View File

@ -1005,7 +1005,7 @@ core_target::pid_to_str (ptid_t ptid)
"process", with normal_pid_to_str. */ "process", with normal_pid_to_str. */
/* Try the LWPID field first. */ /* Try the LWPID field first. */
pid = ptid_get_lwp (ptid); pid = ptid.lwp ();
if (pid != 0) if (pid != 0)
return normal_pid_to_str (ptid_t (pid)); return normal_pid_to_str (ptid_t (pid));

View File

@ -814,7 +814,7 @@ fbsd_nat_target::thread_alive (ptid_t ptid)
{ {
struct ptrace_lwpinfo pl; struct ptrace_lwpinfo pl;
if (ptrace (PT_LWPINFO, ptid_get_lwp (ptid), (caddr_t) &pl, sizeof pl) if (ptrace (PT_LWPINFO, ptid.lwp (), (caddr_t) &pl, sizeof pl)
== -1) == -1)
return false; return false;
#ifdef PL_FLAG_EXITED #ifdef PL_FLAG_EXITED
@ -834,7 +834,7 @@ fbsd_nat_target::pid_to_str (ptid_t ptid)
{ {
lwpid_t lwp; lwpid_t lwp;
lwp = ptid_get_lwp (ptid); lwp = ptid.lwp ();
if (lwp != 0) if (lwp != 0)
{ {
static char buf[64]; static char buf[64];
@ -857,7 +857,7 @@ fbsd_nat_target::thread_name (struct thread_info *thr)
struct ptrace_lwpinfo pl; struct ptrace_lwpinfo pl;
struct kinfo_proc kp; struct kinfo_proc kp;
int pid = thr->ptid.pid (); int pid = thr->ptid.pid ();
long lwp = ptid_get_lwp (thr->ptid); long lwp = thr->ptid.lwp ();
static char buf[sizeof pl.pl_tdname + 1]; static char buf[sizeof pl.pl_tdname + 1];
/* Note that ptrace_lwpinfo returns the process command in pl_tdname /* Note that ptrace_lwpinfo returns the process command in pl_tdname
@ -1100,7 +1100,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
if (debug_fbsd_lwp) if (debug_fbsd_lwp)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n", "FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n",
ptid.pid (), ptid_get_lwp (ptid), ptid.pid (), ptid.lwp (),
ptid_get_tid (ptid)); ptid_get_tid (ptid));
if (ptid_lwp_p (ptid)) if (ptid_lwp_p (ptid))
{ {
@ -1113,12 +1113,12 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
if (tp->ptid.pid () != ptid.pid ()) if (tp->ptid.pid () != ptid.pid ())
continue; continue;
if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (ptid)) if (tp->ptid.lwp () == ptid.lwp ())
request = PT_RESUME; request = PT_RESUME;
else else
request = PT_SUSPEND; request = PT_SUSPEND;
if (ptrace (request, ptid_get_lwp (tp->ptid), NULL, 0) == -1) if (ptrace (request, tp->ptid.lwp (), NULL, 0) == -1)
perror_with_name (("ptrace")); perror_with_name (("ptrace"));
} }
} }
@ -1133,7 +1133,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
if (!ptid_match (tp->ptid, ptid)) if (!ptid_match (tp->ptid, ptid))
continue; continue;
if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1) if (ptrace (PT_RESUME, tp->ptid.lwp (), NULL, 0) == -1)
perror_with_name (("ptrace")); perror_with_name (("ptrace"));
} }
ptid = inferior_ptid; ptid = inferior_ptid;

View File

@ -301,9 +301,9 @@ fbsd_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
{ {
static char buf[80]; static char buf[80];
if (ptid_get_lwp (ptid) != 0) if (ptid.lwp () != 0)
{ {
xsnprintf (buf, sizeof buf, "LWP %ld", ptid_get_lwp (ptid)); xsnprintf (buf, sizeof buf, "LWP %ld", ptid.lwp ());
return buf; return buf;
} }
@ -320,7 +320,7 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
struct bfd_section *section; struct bfd_section *section;
bfd_size_type size; bfd_size_type size;
if (ptid_get_lwp (thr->ptid) != 0) if (thr->ptid.lwp () != 0)
{ {
/* FreeBSD includes a NT_FREEBSD_THRMISC note for each thread /* FreeBSD includes a NT_FREEBSD_THRMISC note for each thread
whose contents are defined by a "struct thrmisc" declared in whose contents are defined by a "struct thrmisc" declared in
@ -477,7 +477,7 @@ fbsd_collect_thread_registers (const struct regcache *regcache,
data.note_size = note_size; data.note_size = note_size;
data.stop_signal = stop_signal; data.stop_signal = stop_signal;
data.abort_iteration = 0; data.abort_iteration = 0;
data.lwp = ptid_get_lwp (ptid); data.lwp = ptid.lwp ();
gdbarch_iterate_over_regset_sections (gdbarch, gdbarch_iterate_over_regset_sections (gdbarch,
fbsd_collect_regset_section_cb, fbsd_collect_regset_section_cb,

View File

@ -1,3 +1,15 @@
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* linux-mips-low.c: Update.
* lynx-low.c: Update.
* nto-low.c: Update.
* remote-utils.c: Update.
* server.c: Update.
* spu-low.c: Update.
* target.c: Update.
* thread-db.c: Update.
2018-07-03 Tom Tromey <tom@tromey.com> 2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update. * linux-low.c: Update.

View File

@ -529,7 +529,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
{ {
debug_printf ("HEW: Got fork event from LWP %ld, " debug_printf ("HEW: Got fork event from LWP %ld, "
"new child is %d\n", "new child is %d\n",
ptid_get_lwp (ptid_of (event_thr)), ptid_of (event_thr).lwp (),
ptid.pid ()); ptid.pid ());
} }
@ -1052,7 +1052,7 @@ int
linux_attach_lwp (ptid_t ptid) linux_attach_lwp (ptid_t ptid)
{ {
struct lwp_info *new_lwp; struct lwp_info *new_lwp;
int lwpid = ptid_get_lwp (ptid); int lwpid = ptid.lwp ();
if (ptrace (PTRACE_ATTACH, lwpid, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0) if (ptrace (PTRACE_ATTACH, lwpid, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0)
!= 0) != 0)
@ -1140,7 +1140,7 @@ attach_proc_task_lwp_callback (ptid_t ptid)
/* Is this a new thread? */ /* Is this a new thread? */
if (find_thread_ptid (ptid) == NULL) if (find_thread_ptid (ptid) == NULL)
{ {
int lwpid = ptid_get_lwp (ptid); int lwpid = ptid.lwp ();
int err; int err;
if (debug_threads) if (debug_threads)
@ -1324,7 +1324,7 @@ kill_wait_lwp (struct lwp_info *lwp)
{ {
struct thread_info *thr = get_lwp_thread (lwp); struct thread_info *thr = get_lwp_thread (lwp);
int pid = ptid_of (thr).pid (); int pid = ptid_of (thr).pid ();
int lwpid = ptid_get_lwp (ptid_of (thr)); int lwpid = ptid_of (thr).lwp ();
int wstat; int wstat;
int res; int res;
@ -4548,7 +4548,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
of PID'. */ of PID'. */
|| (ptid.pid () == pid_of (thread) || (ptid.pid () == pid_of (thread)
&& (ptid_is_pid (ptid) && (ptid_is_pid (ptid)
|| ptid_get_lwp (ptid) == -1))) || ptid.lwp () == -1)))
{ {
if (resume[ndx].kind == resume_stop if (resume[ndx].kind == resume_stop
&& thread->last_resume_kind == resume_stop) && thread->last_resume_kind == resume_stop)

View File

@ -450,7 +450,7 @@ mips_linux_prepare_to_resume (struct lwp_info *lwp)
if (mips_linux_watch_get_num_valid (&priv->watch_mirror) > 0) if (mips_linux_watch_get_num_valid (&priv->watch_mirror) > 0)
{ {
/* Write the mirrored watch register values. */ /* Write the mirrored watch register values. */
int tid = ptid_get_lwp (ptid); int tid = ptid.lwp ();
if (-1 == ptrace (PTRACE_SET_WATCH_REGS, tid, if (-1 == ptrace (PTRACE_SET_WATCH_REGS, tid,
&priv->watch_mirror, NULL)) &priv->watch_mirror, NULL))

View File

@ -93,7 +93,7 @@ lynx_ptid_get_tid (ptid_t ptid)
{ {
/* See lynx_ptid_t: The LynxOS tid is stored inside the lwp field /* See lynx_ptid_t: The LynxOS tid is stored inside the lwp field
of the ptid. */ of the ptid. */
return ptid_get_lwp (ptid); return ptid.lwp ();
} }
/* For a given PTID, return the associated PID as known by the LynxOS /* For a given PTID, return the associated PID as known by the LynxOS

View File

@ -92,12 +92,12 @@ nto_set_thread (ptid_t ptid)
int res = 0; int res = 0;
TRACE ("%s pid: %d tid: %ld\n", __func__, ptid.pid (), TRACE ("%s pid: %d tid: %ld\n", __func__, ptid.pid (),
ptid_get_lwp (ptid)); ptid.lwp ());
if (nto_inferior.ctl_fd != -1 if (nto_inferior.ctl_fd != -1
&& !ptid_equal (ptid, null_ptid) && !ptid_equal (ptid, null_ptid)
&& !ptid_equal (ptid, minus_one_ptid)) && !ptid_equal (ptid, minus_one_ptid))
{ {
pthread_t tid = ptid_get_lwp (ptid); pthread_t tid = ptid.lwp ();
if (EOK == devctl (nto_inferior.ctl_fd, DCMD_PROC_CURTHREAD, &tid, if (EOK == devctl (nto_inferior.ctl_fd, DCMD_PROC_CURTHREAD, &tid,
sizeof (tid), 0)) sizeof (tid), 0))
@ -213,7 +213,7 @@ do_attach (pid_t pid)
proc = add_process (status.pid, 1); proc = add_process (status.pid, 1);
proc->tdesc = nto_tdesc; proc->tdesc = nto_tdesc;
TRACE ("Adding thread: pid=%d tid=%ld\n", status.pid, TRACE ("Adding thread: pid=%d tid=%ld\n", status.pid,
ptid_get_lwp (ptid)); ptid.lwp ());
nto_find_new_threads (&nto_inferior); nto_find_new_threads (&nto_inferior);
} }
else else
@ -431,8 +431,8 @@ nto_thread_alive (ptid_t ptid)
int res; int res;
TRACE ("%s pid:%d tid:%d\n", __func__, ptid.pid (), TRACE ("%s pid:%d tid:%d\n", __func__, ptid.pid (),
ptid_get_lwp (ptid)); ptid.lwp ());
if (SignalKill (0, ptid.pid (), ptid_get_lwp (ptid), if (SignalKill (0, ptid.pid (), ptid.lwp (),
0, 0, 0) == -1) 0, 0, 0) == -1)
res = 0; res = 0;
else else

View File

@ -492,7 +492,7 @@ write_ptid (char *buf, ptid_t ptid)
else else
buf += sprintf (buf, "p%x.", pid); buf += sprintf (buf, "p%x.", pid);
} }
tid = ptid_get_lwp (ptid); tid = ptid.lwp ();
if (tid < 0) if (tid < 0)
buf += sprintf (buf, "-%x", -tid); buf += sprintf (buf, "-%x", -tid);
else else

View File

@ -2700,7 +2700,7 @@ visit_actioned_threads (thread_info *thread,
|| ptid_equal (action->thread, thread->id) || ptid_equal (action->thread, thread->id)
|| ((action->thread.pid () || ((action->thread.pid ()
== thread->id.pid ()) == thread->id.pid ())
&& ptid_get_lwp (action->thread) == -1)) && action->thread.lwp () == -1))
{ {
if ((*callback) (action, thread)) if ((*callback) (action, thread))
return true; return true;

View File

@ -66,7 +66,7 @@ fetch_ppc_register (int regno)
{ {
PTRACE_TYPE_RET res; PTRACE_TYPE_RET res;
int tid = ptid_get_lwp (current_ptid); int tid = current_ptid.lwp ();
#ifndef __powerpc64__ #ifndef __powerpc64__
/* If running as a 32-bit process on a 64-bit system, we attempt /* If running as a 32-bit process on a 64-bit system, we attempt
@ -151,7 +151,7 @@ fetch_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len)
/ sizeof (PTRACE_TYPE_RET)); / sizeof (PTRACE_TYPE_RET));
PTRACE_TYPE_RET *buffer; PTRACE_TYPE_RET *buffer;
int tid = ptid_get_lwp (current_ptid); int tid = current_ptid.lwp ();
buffer = XALLOCAVEC (PTRACE_TYPE_RET, count); buffer = XALLOCAVEC (PTRACE_TYPE_RET, count);
for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET)) for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
@ -176,7 +176,7 @@ store_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len)
/ sizeof (PTRACE_TYPE_RET)); / sizeof (PTRACE_TYPE_RET));
PTRACE_TYPE_RET *buffer; PTRACE_TYPE_RET *buffer;
int tid = ptid_get_lwp (current_ptid); int tid = current_ptid.lwp ();
buffer = XALLOCAVEC (PTRACE_TYPE_RET, count); buffer = XALLOCAVEC (PTRACE_TYPE_RET, count);
@ -241,7 +241,7 @@ spu_proc_xfer_spu (const char *annex, unsigned char *readbuf,
if (!annex) if (!annex)
return 0; return 0;
sprintf (buf, "/proc/%ld/fd/%s", ptid_get_lwp (current_ptid), annex); sprintf (buf, "/proc/%ld/fd/%s", current_ptid.lwp (), annex);
fd = open (buf, writebuf? O_WRONLY : O_RDONLY); fd = open (buf, writebuf? O_WRONLY : O_RDONLY);
if (fd <= 0) if (fd <= 0)
return -1; return -1;
@ -409,7 +409,7 @@ spu_resume (struct thread_resume *resume_info, size_t n)
regcache_invalidate (); regcache_invalidate ();
errno = 0; errno = 0;
ptrace (PTRACE_CONT, ptid_get_lwp (ptid_of (thr)), 0, resume_info[i].sig); ptrace (PTRACE_CONT, ptid_of (thr).lwp (), 0, resume_info[i].sig);
if (errno) if (errno)
perror_with_name ("ptrace"); perror_with_name ("ptrace");
} }

View File

@ -321,9 +321,9 @@ target_pid_to_str (ptid_t ptid)
else if (ptid_get_tid (ptid) != 0) else if (ptid_get_tid (ptid) != 0)
xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx", xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx",
ptid.pid (), ptid_get_tid (ptid)); ptid.pid (), ptid_get_tid (ptid));
else if (ptid_get_lwp (ptid) != 0) else if (ptid.lwp () != 0)
xsnprintf (buf, sizeof (buf), "LWP %d.%ld", xsnprintf (buf, sizeof (buf), "LWP %d.%ld",
ptid.pid (), ptid_get_lwp (ptid)); ptid.pid (), ptid.lwp ());
else else
xsnprintf (buf, sizeof (buf), "Process %d", xsnprintf (buf, sizeof (buf), "Process %d",
ptid.pid ()); ptid.pid ());

View File

@ -167,7 +167,7 @@ find_one_thread (ptid_t ptid)
td_err_e err; td_err_e err;
struct lwp_info *lwp; struct lwp_info *lwp;
struct thread_db *thread_db = current_process ()->priv->thread_db; struct thread_db *thread_db = current_process ()->priv->thread_db;
int lwpid = ptid_get_lwp (ptid); int lwpid = ptid.lwp ();
thread_info *thread = find_thread_ptid (ptid); thread_info *thread = find_thread_ptid (ptid);
lwp = get_thread_lwp (thread); lwp = get_thread_lwp (thread);

View File

@ -1620,7 +1620,7 @@ rewait:
else if (ptid_equal (ptid, minus_one_ptid)) else if (ptid_equal (ptid, minus_one_ptid))
thread = inf_tid_to_thread (inf, -1); thread = inf_tid_to_thread (inf, -1);
else else
thread = inf_tid_to_thread (inf, ptid_get_lwp (ptid)); thread = inf_tid_to_thread (inf, ptid.lwp ());
if (!thread || thread->port == MACH_PORT_NULL) if (!thread || thread->port == MACH_PORT_NULL)
{ {
@ -2049,7 +2049,7 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
else else
/* Just allow a single thread to run. */ /* Just allow a single thread to run. */
{ {
struct proc *thread = inf_tid_to_thread (inf, ptid_get_lwp (ptid)); struct proc *thread = inf_tid_to_thread (inf, ptid.lwp ());
if (!thread) if (!thread)
error (_("Can't run single thread id %s: no such thread!"), error (_("Can't run single thread id %s: no such thread!"),
@ -2060,7 +2060,7 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
if (step) if (step)
{ {
step_thread = inf_tid_to_thread (inf, ptid_get_lwp (ptid)); step_thread = inf_tid_to_thread (inf, ptid.lwp ());
if (!step_thread) if (!step_thread)
warning (_("Can't step thread id %s: no such thread."), warning (_("Can't step thread id %s: no such thread."),
target_pid_to_str (ptid)); target_pid_to_str (ptid));
@ -2293,7 +2293,7 @@ gnu_nat_target::thread_alive (ptid_t ptid)
{ {
inf_update_procs (gnu_current_inf); inf_update_procs (gnu_current_inf);
return !!inf_tid_to_thread (gnu_current_inf, return !!inf_tid_to_thread (gnu_current_inf,
ptid_get_lwp (ptid)); ptid.lwp ());
} }
@ -2716,7 +2716,7 @@ const char *
gnu_nat_target::pid_to_str (ptid_t ptid) gnu_nat_target::pid_to_str (ptid_t ptid)
{ {
struct inf *inf = gnu_current_inf; struct inf *inf = gnu_current_inf;
int tid = ptid_get_lwp (ptid); int tid = ptid.lwp ();
struct proc *thread = inf_tid_to_thread (inf, tid); struct proc *thread = inf_tid_to_thread (inf, tid);
if (thread) if (thread)
@ -2818,7 +2818,7 @@ cur_thread (void)
{ {
struct inf *inf = cur_inf (); struct inf *inf = cur_inf ();
struct proc *thread = inf_tid_to_thread (inf, struct proc *thread = inf_tid_to_thread (inf,
ptid_get_lwp (inferior_ptid)); inferior_ptid.lwp ());
if (!thread) if (!thread)
error (_("No current thread.")); error (_("No current thread."));
return thread; return thread;
@ -3018,7 +3018,7 @@ set_sig_thread_cmd (const char *args, int from_tty)
else else
{ {
struct thread_info *tp = parse_thread_id (args, NULL); struct thread_info *tp = parse_thread_id (args, NULL);
inf->signal_thread = inf_tid_to_thread (inf, ptid_get_lwp (tp->ptid)); inf->signal_thread = inf_tid_to_thread (inf, tp->ptid.lwp ());
} }
} }

View File

@ -183,9 +183,9 @@ i386_windows_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
{ {
static char buf[80]; static char buf[80];
if (ptid_get_lwp (ptid) != 0) if (ptid.lwp () != 0)
{ {
snprintf (buf, sizeof (buf), "Thread 0x%lx", ptid_get_lwp (ptid)); snprintf (buf, sizeof (buf), "Thread 0x%lx", ptid.lwp ());
return buf; return buf;
} }

View File

@ -113,7 +113,7 @@ gnu_fetch_registers (struct target_ops *ops,
/* Make sure we know about new threads. */ /* Make sure we know about new threads. */
inf_update_procs (gnu_current_inf); inf_update_procs (gnu_current_inf);
thread = inf_tid_to_thread (gnu_current_inf, ptid_get_lwp (ptid)); thread = inf_tid_to_thread (gnu_current_inf, ptid.lwp ());
if (!thread) if (!thread)
error (_("Can't fetch registers from thread %s: No such thread"), error (_("Can't fetch registers from thread %s: No such thread"),
target_pid_to_str (ptid)); target_pid_to_str (ptid));
@ -205,7 +205,7 @@ gnu_store_registers (struct target_ops *ops,
/* Make sure we know about new threads. */ /* Make sure we know about new threads. */
inf_update_procs (gnu_current_inf); inf_update_procs (gnu_current_inf);
thread = inf_tid_to_thread (gnu_current_inf, ptid_get_lwp (ptid)); thread = inf_tid_to_thread (gnu_current_inf, ptid.lwp ());
if (!thread) if (!thread)
error (_("Couldn't store registers into thread %s: No such thread"), error (_("Couldn't store registers into thread %s: No such thread"),
target_pid_to_str (ptid)); target_pid_to_str (ptid));
@ -392,7 +392,7 @@ i386_gnu_dr_get_reg (ptid_t ptid, int regnum)
/* Make sure we know about new threads. */ /* Make sure we know about new threads. */
inf_update_procs (gnu_current_inf); inf_update_procs (gnu_current_inf);
thread = inf_tid_to_thread (gnu_current_inf, ptid_get_lwp (ptid)); thread = inf_tid_to_thread (gnu_current_inf, ptid.lwp ());
i386_gnu_dr_get (&regs, thread); i386_gnu_dr_get (&regs, thread);
return regs.dr[regnum]; return regs.dr[regnum];

View File

@ -647,7 +647,7 @@ static const unsigned char linux_syscall[] = { 0xcd, 0x80 };
void void
i386_linux_nat_target::low_resume (ptid_t ptid, int step, enum gdb_signal signal) i386_linux_nat_target::low_resume (ptid_t ptid, int step, enum gdb_signal signal)
{ {
int pid = ptid_get_lwp (ptid); int pid = ptid.lwp ();
int request; int request;
if (catch_syscall_enabled () > 0) if (catch_syscall_enabled () > 0)

View File

@ -553,7 +553,7 @@ store_debug_register (ptid_t ptid, int idx, long val)
{ {
int tid; int tid;
tid = ptid_get_lwp (ptid); tid = ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = ptid.pid (); tid = ptid.pid ();

View File

@ -325,7 +325,7 @@ get_ptrace_pid (ptid_t ptid)
/* If we have an LWPID to work with, use it. Otherwise, we're /* If we have an LWPID to work with, use it. Otherwise, we're
dealing with a non-threaded program/target. */ dealing with a non-threaded program/target. */
pid = ptid_get_lwp (ptid); pid = ptid.lwp ();
if (pid == 0) if (pid == 0)
pid = ptid.pid (); pid = ptid.pid ();
return pid; return pid;

View File

@ -3423,14 +3423,14 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
stb.printf ("infrun: target_wait (%d.%ld.%ld", stb.printf ("infrun: target_wait (%d.%ld.%ld",
waiton_ptid.pid (), waiton_ptid.pid (),
ptid_get_lwp (waiton_ptid), waiton_ptid.lwp (),
ptid_get_tid (waiton_ptid)); ptid_get_tid (waiton_ptid));
if (waiton_ptid.pid () != -1) if (waiton_ptid.pid () != -1)
stb.printf (" [%s]", target_pid_to_str (waiton_ptid)); stb.printf (" [%s]", target_pid_to_str (waiton_ptid));
stb.printf (", status) =\n"); stb.printf (", status) =\n");
stb.printf ("infrun: %d.%ld.%ld [%s],\n", stb.printf ("infrun: %d.%ld.%ld [%s],\n",
result_ptid.pid (), result_ptid.pid (),
ptid_get_lwp (result_ptid), result_ptid.lwp (),
ptid_get_tid (result_ptid), ptid_get_tid (result_ptid),
target_pid_to_str (result_ptid)); target_pid_to_str (result_ptid));
stb.printf ("infrun: %s\n", status_string.c_str ()); stb.printf ("infrun: %s\n", status_string.c_str ());
@ -4377,7 +4377,7 @@ save_waitstatus (struct thread_info *tp, struct target_waitstatus *ws)
"infrun: saving status %s for %d.%ld.%ld\n", "infrun: saving status %s for %d.%ld.%ld\n",
statstr.c_str (), statstr.c_str (),
tp->ptid.pid (), tp->ptid.pid (),
ptid_get_lwp (tp->ptid), tp->ptid.lwp (),
ptid_get_tid (tp->ptid)); ptid_get_tid (tp->ptid));
} }
@ -4614,7 +4614,7 @@ stop_all_threads (void)
"status for %d.%ld.%ld\n", "status for %d.%ld.%ld\n",
statstr.c_str (), statstr.c_str (),
t->ptid.pid (), t->ptid.pid (),
ptid_get_lwp (t->ptid), t->ptid.lwp (),
ptid_get_tid (t->ptid)); ptid_get_tid (t->ptid));
} }

View File

@ -723,7 +723,7 @@ checkpoint_command (const char *args, int from_tty)
fp != NULL ? fp->num : -1, (long) retpid); fp != NULL ? fp->num : -1, (long) retpid);
if (info_verbose) if (info_verbose)
{ {
parent_pid = ptid_get_lwp (last_target_ptid); parent_pid = last_target_ptid.lwp ();
if (parent_pid == 0) if (parent_pid == 0)
parent_pid = last_target_ptid.pid (); parent_pid = last_target_ptid.pid ();
printf_filtered (_(" gdb says parent = %ld.\n"), printf_filtered (_(" gdb says parent = %ld.\n"),

View File

@ -457,8 +457,8 @@ linux_nat_target::follow_fork (int follow_child, int detach_fork)
== TARGET_WAITKIND_VFORKED); == TARGET_WAITKIND_VFORKED);
parent_ptid = inferior_ptid; parent_ptid = inferior_ptid;
child_ptid = inferior_thread ()->pending_follow.value.related_pid; child_ptid = inferior_thread ()->pending_follow.value.related_pid;
parent_pid = ptid_get_lwp (parent_ptid); parent_pid = parent_ptid.lwp ();
child_pid = ptid_get_lwp (child_ptid); child_pid = child_ptid.lwp ();
/* We're already attached to the parent, by default. */ /* We're already attached to the parent, by default. */
child_lp = add_lwp (child_ptid); child_lp = add_lwp (child_ptid);
@ -668,7 +668,7 @@ static hashval_t
lwp_info_hash (const void *ap) lwp_info_hash (const void *ap)
{ {
const struct lwp_info *lp = (struct lwp_info *) ap; const struct lwp_info *lp = (struct lwp_info *) ap;
pid_t pid = ptid_get_lwp (lp->ptid); pid_t pid = lp->ptid.lwp ();
return iterative_hash_object (pid, 0); return iterative_hash_object (pid, 0);
} }
@ -682,7 +682,7 @@ lwp_lwpid_htab_eq (const void *a, const void *b)
const struct lwp_info *entry = (const struct lwp_info *) a; const struct lwp_info *entry = (const struct lwp_info *) a;
const struct lwp_info *element = (const struct lwp_info *) b; const struct lwp_info *element = (const struct lwp_info *) b;
return ptid_get_lwp (entry->ptid) == ptid_get_lwp (element->ptid); return entry->ptid.lwp () == element->ptid.lwp ();
} }
/* Create the lwp_lwpid_htab hash table. */ /* Create the lwp_lwpid_htab hash table. */
@ -936,7 +936,7 @@ find_lwp_pid (ptid_t ptid)
struct lwp_info dummy; struct lwp_info dummy;
if (ptid_lwp_p (ptid)) if (ptid_lwp_p (ptid))
lwp = ptid_get_lwp (ptid); lwp = ptid.lwp ();
else else
lwp = ptid.pid (); lwp = ptid.pid ();
@ -1018,7 +1018,7 @@ exit_lwp (struct lwp_info *lp)
static int static int
linux_nat_post_attach_wait (ptid_t ptid, int *signalled) linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
{ {
pid_t new_pid, pid = ptid_get_lwp (ptid); pid_t new_pid, pid = ptid.lwp ();
int status; int status;
if (linux_proc_pid_is_stopped (pid)) if (linux_proc_pid_is_stopped (pid))
@ -1104,7 +1104,7 @@ attach_proc_task_lwp_callback (ptid_t ptid)
lp = find_lwp_pid (ptid); lp = find_lwp_pid (ptid);
if (lp == NULL) if (lp == NULL)
{ {
int lwpid = ptid_get_lwp (ptid); int lwpid = ptid.lwp ();
if (ptrace (PTRACE_ATTACH, lwpid, 0, 0) < 0) if (ptrace (PTRACE_ATTACH, lwpid, 0, 0) < 0)
{ {
@ -1235,7 +1235,7 @@ linux_nat_target::attach (const char *args, int from_tty)
internal_error (__FILE__, __LINE__, internal_error (__FILE__, __LINE__,
_("unexpected status %d for PID %ld"), _("unexpected status %d for PID %ld"),
status, (long) ptid_get_lwp (ptid)); status, (long) ptid.lwp ());
} }
lp->stopped = 1; lp->stopped = 1;
@ -1316,7 +1316,7 @@ get_detach_signal (struct lwp_info *lp)
get_last_target_status (&last_ptid, &last); get_last_target_status (&last_ptid, &last);
if (ptid_get_lwp (lp->ptid) == ptid_get_lwp (last_ptid)) if (lp->ptid.lwp () == last_ptid.lwp ())
signo = tp->suspend.stop_signal; signo = tp->suspend.stop_signal;
} }
} }
@ -1358,7 +1358,7 @@ get_detach_signal (struct lwp_info *lp)
static void static void
detach_one_lwp (struct lwp_info *lp, int *signo_p) detach_one_lwp (struct lwp_info *lp, int *signo_p)
{ {
int lwpid = ptid_get_lwp (lp->ptid); int lwpid = lp->ptid.lwp ();
int signo; int signo;
gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status)); gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
@ -1450,7 +1450,7 @@ detach_callback (struct lwp_info *lp, void *data)
/* We don't actually detach from the thread group leader just yet. /* We don't actually detach from the thread group leader just yet.
If the thread group exits, we must reap the zombie clone lwps If the thread group exits, we must reap the zombie clone lwps
before we're able to reap the leader. */ before we're able to reap the leader. */
if (ptid_get_lwp (lp->ptid) != lp->ptid.pid ()) if (lp->ptid.lwp () != lp->ptid.pid ())
detach_one_lwp (lp, NULL); detach_one_lwp (lp, NULL);
return 0; return 0;
} }
@ -1557,7 +1557,7 @@ check_ptrace_stopped_lwp_gone (struct lwp_info *lp)
other than ptrace-stopped. */ other than ptrace-stopped. */
/* Don't assume anything if /proc/PID/status can't be read. */ /* Don't assume anything if /proc/PID/status can't be read. */
if (linux_proc_pid_is_trace_stopped_nowarn (ptid_get_lwp (lp->ptid)) == 0) if (linux_proc_pid_is_trace_stopped_nowarn (lp->ptid.lwp ()) == 0)
{ {
lp->stop_reason = TARGET_STOPPED_BY_NO_REASON; lp->stop_reason = TARGET_STOPPED_BY_NO_REASON;
lp->status = 0; lp->status = 0;
@ -1831,10 +1831,10 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
"for LWP %ld (stopping threads), " "for LWP %ld (stopping threads), "
"resuming with PTRACE_CONT for SIGSTOP\n", "resuming with PTRACE_CONT for SIGSTOP\n",
syscall_number, syscall_number,
ptid_get_lwp (lp->ptid)); lp->ptid.lwp ());
lp->syscall_state = TARGET_WAITKIND_IGNORE; lp->syscall_state = TARGET_WAITKIND_IGNORE;
ptrace (PTRACE_CONT, ptid_get_lwp (lp->ptid), 0, 0); ptrace (PTRACE_CONT, lp->ptid.lwp (), 0, 0);
lp->stopped = 0; lp->stopped = 0;
return 1; return 1;
} }
@ -1864,7 +1864,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
== TARGET_WAITKIND_SYSCALL_ENTRY == TARGET_WAITKIND_SYSCALL_ENTRY
? "entry" : "return", ? "entry" : "return",
syscall_number, syscall_number,
ptid_get_lwp (lp->ptid)); lp->ptid.lwp ());
return 0; return 0;
} }
@ -1875,7 +1875,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
lp->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY lp->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY
? "entry" : "return", ? "entry" : "return",
syscall_number, syscall_number,
ptid_get_lwp (lp->ptid)); lp->ptid.lwp ());
} }
else else
{ {
@ -1901,7 +1901,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
"with no syscall catchpoints." "with no syscall catchpoints."
" %d for LWP %ld, ignoring\n", " %d for LWP %ld, ignoring\n",
syscall_number, syscall_number,
ptid_get_lwp (lp->ptid)); lp->ptid.lwp ());
lp->syscall_state = TARGET_WAITKIND_IGNORE; lp->syscall_state = TARGET_WAITKIND_IGNORE;
} }
@ -1925,7 +1925,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
static int static int
linux_handle_extended_wait (struct lwp_info *lp, int status) linux_handle_extended_wait (struct lwp_info *lp, int status)
{ {
int pid = ptid_get_lwp (lp->ptid); int pid = lp->ptid.lwp ();
struct target_waitstatus *ourstatus = &lp->waitstatus; struct target_waitstatus *ourstatus = &lp->waitstatus;
int event = linux_ptrace_get_extended_event (status); int event = linux_ptrace_get_extended_event (status);
@ -2019,7 +2019,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
{ {
/* The process is not using thread_db. Add the LWP to /* The process is not using thread_db. Add the LWP to
GDB's list. */ GDB's list. */
target_post_attach (ptid_get_lwp (new_lp->ptid)); target_post_attach (new_lp->ptid.lwp ());
add_thread (new_lp->ptid); add_thread (new_lp->ptid);
} }
@ -2049,7 +2049,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"LHEW: waitpid of new LWP %ld, " "LHEW: waitpid of new LWP %ld, "
"saving status %s\n", "saving status %s\n",
(long) ptid_get_lwp (new_lp->ptid), (long) new_lp->ptid.lwp (),
status_to_str (status)); status_to_str (status));
new_lp->status = status; new_lp->status = status;
} }
@ -2070,7 +2070,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
if (debug_linux_nat) if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"LHEW: Got exec event from LWP %ld\n", "LHEW: Got exec event from LWP %ld\n",
ptid_get_lwp (lp->ptid)); lp->ptid.lwp ());
ourstatus->kind = TARGET_WAITKIND_EXECD; ourstatus->kind = TARGET_WAITKIND_EXECD;
ourstatus->value.execd_pathname ourstatus->value.execd_pathname
@ -2091,7 +2091,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"LHEW: Got expected PTRACE_EVENT_" "LHEW: Got expected PTRACE_EVENT_"
"VFORK_DONE from LWP %ld: stopping\n", "VFORK_DONE from LWP %ld: stopping\n",
ptid_get_lwp (lp->ptid)); lp->ptid.lwp ());
ourstatus->kind = TARGET_WAITKIND_VFORK_DONE; ourstatus->kind = TARGET_WAITKIND_VFORK_DONE;
return 0; return 0;
@ -2101,7 +2101,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"LHEW: Got PTRACE_EVENT_VFORK_DONE " "LHEW: Got PTRACE_EVENT_VFORK_DONE "
"from LWP %ld: ignoring\n", "from LWP %ld: ignoring\n",
ptid_get_lwp (lp->ptid)); lp->ptid.lwp ());
return 1; return 1;
} }
@ -2152,7 +2152,7 @@ wait_lwp (struct lwp_info *lp)
for (;;) for (;;)
{ {
pid = my_waitpid (ptid_get_lwp (lp->ptid), &status, __WALL | WNOHANG); pid = my_waitpid (lp->ptid.lwp (), &status, __WALL | WNOHANG);
if (pid == -1 && errno == ECHILD) if (pid == -1 && errno == ECHILD)
{ {
/* The thread has previously exited. We need to delete it /* The thread has previously exited. We need to delete it
@ -2181,8 +2181,8 @@ wait_lwp (struct lwp_info *lp)
Therefore always use WNOHANG with sigsuspend - it is equivalent to Therefore always use WNOHANG with sigsuspend - it is equivalent to
waiting waitpid but linux_proc_pid_is_zombie is safe this way. */ waiting waitpid but linux_proc_pid_is_zombie is safe this way. */
if (lp->ptid.pid () == ptid_get_lwp (lp->ptid) if (lp->ptid.pid () == lp->ptid.lwp ()
&& linux_proc_pid_is_zombie (ptid_get_lwp (lp->ptid))) && linux_proc_pid_is_zombie (lp->ptid.lwp ()))
{ {
thread_dead = 1; thread_dead = 1;
if (debug_linux_nat) if (debug_linux_nat)
@ -2205,7 +2205,7 @@ wait_lwp (struct lwp_info *lp)
if (!thread_dead) if (!thread_dead)
{ {
gdb_assert (pid == ptid_get_lwp (lp->ptid)); gdb_assert (pid == lp->ptid.lwp ());
if (debug_linux_nat) if (debug_linux_nat)
{ {
@ -2219,7 +2219,7 @@ wait_lwp (struct lwp_info *lp)
if (WIFEXITED (status) || WIFSIGNALED (status)) if (WIFEXITED (status) || WIFSIGNALED (status))
{ {
if (report_thread_events if (report_thread_events
|| lp->ptid.pid () == ptid_get_lwp (lp->ptid)) || lp->ptid.pid () == lp->ptid.lwp ())
{ {
if (debug_linux_nat) if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog, "WL: LWP %d exited.\n", fprintf_unfiltered (gdb_stdlog, "WL: LWP %d exited.\n",
@ -2254,7 +2254,7 @@ wait_lwp (struct lwp_info *lp)
struct inferior *inf = find_inferior_pid (lp->ptid.pid ()); struct inferior *inf = find_inferior_pid (lp->ptid.pid ());
int options = linux_nat_ptrace_options (inf->attach_flag); int options = linux_nat_ptrace_options (inf->attach_flag);
linux_enable_event_reporting (ptid_get_lwp (lp->ptid), options); linux_enable_event_reporting (lp->ptid.lwp (), options);
lp->must_set_ptrace_flags = 0; lp->must_set_ptrace_flags = 0;
} }
@ -2307,7 +2307,7 @@ stop_callback (struct lwp_info *lp, void *data)
target_pid_to_str (lp->ptid)); target_pid_to_str (lp->ptid));
} }
errno = 0; errno = 0;
ret = kill_lwp (ptid_get_lwp (lp->ptid), SIGSTOP); ret = kill_lwp (lp->ptid.lwp (), SIGSTOP);
if (debug_linux_nat) if (debug_linux_nat)
{ {
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
@ -2397,7 +2397,7 @@ maybe_clear_ignore_sigint (struct lwp_info *lp)
if (!lp->ignore_sigint) if (!lp->ignore_sigint)
return; return;
if (!linux_nat_has_pending_sigint (ptid_get_lwp (lp->ptid))) if (!linux_nat_has_pending_sigint (lp->ptid.lwp ()))
{ {
if (debug_linux_nat) if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
@ -2496,7 +2496,7 @@ stop_wait_callback (struct lwp_info *lp, void *data)
lp->ignore_sigint = 0; lp->ignore_sigint = 0;
errno = 0; errno = 0;
ptrace (PTRACE_CONT, ptid_get_lwp (lp->ptid), 0, 0); ptrace (PTRACE_CONT, lp->ptid.lwp (), 0, 0);
lp->stopped = 0; lp->stopped = 0;
if (debug_linux_nat) if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
@ -2976,7 +2976,7 @@ linux_nat_filter_event (int lwpid, int status)
struct inferior *inf = find_inferior_pid (lp->ptid.pid ()); struct inferior *inf = find_inferior_pid (lp->ptid.pid ());
int options = linux_nat_ptrace_options (inf->attach_flag); int options = linux_nat_ptrace_options (inf->attach_flag);
linux_enable_event_reporting (ptid_get_lwp (lp->ptid), options); linux_enable_event_reporting (lp->ptid.lwp (), options);
lp->must_set_ptrace_flags = 0; lp->must_set_ptrace_flags = 0;
} }
@ -3035,7 +3035,7 @@ linux_nat_filter_event (int lwpid, int status)
if (debug_linux_nat) if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"LWP %ld exited (resumed=%d)\n", "LWP %ld exited (resumed=%d)\n",
ptid_get_lwp (lp->ptid), lp->resumed); lp->ptid.lwp (), lp->resumed);
/* Dead LWP's aren't expected to reported a pending sigstop. */ /* Dead LWP's aren't expected to reported a pending sigstop. */
lp->signalled = 0; lp->signalled = 0;
@ -3658,7 +3658,7 @@ kill_wait_one_lwp (pid_t pid)
static int static int
kill_callback (struct lwp_info *lp, void *data) kill_callback (struct lwp_info *lp, void *data)
{ {
kill_one_lwp (ptid_get_lwp (lp->ptid)); kill_one_lwp (lp->ptid.lwp ());
return 0; return 0;
} }
@ -3667,7 +3667,7 @@ kill_callback (struct lwp_info *lp, void *data)
static int static int
kill_wait_callback (struct lwp_info *lp, void *data) kill_wait_callback (struct lwp_info *lp, void *data)
{ {
kill_wait_one_lwp (ptid_get_lwp (lp->ptid)); kill_wait_one_lwp (lp->ptid.lwp ());
return 0; return 0;
} }
@ -3689,7 +3689,7 @@ kill_unfollowed_fork_children (struct inferior *inf)
{ {
ptid_t child_ptid = ws->value.related_pid; ptid_t child_ptid = ws->value.related_pid;
int child_pid = child_ptid.pid (); int child_pid = child_ptid.pid ();
int child_lwp = ptid_get_lwp (child_ptid); int child_lwp = child_ptid.lwp ();
kill_one_lwp (child_lwp); kill_one_lwp (child_lwp);
kill_wait_one_lwp (child_lwp); kill_wait_one_lwp (child_lwp);
@ -3782,7 +3782,7 @@ linux_xfer_siginfo (enum target_object object,
gdb_assert (object == TARGET_OBJECT_SIGNAL_INFO); gdb_assert (object == TARGET_OBJECT_SIGNAL_INFO);
gdb_assert (readbuf || writebuf); gdb_assert (readbuf || writebuf);
pid = ptid_get_lwp (inferior_ptid); pid = inferior_ptid.lwp ();
if (pid == 0) if (pid == 0)
pid = inferior_ptid.pid (); pid = inferior_ptid.pid ();
@ -3934,10 +3934,10 @@ linux_nat_target::pid_to_str (ptid_t ptid)
static char buf[64]; static char buf[64];
if (ptid_lwp_p (ptid) if (ptid_lwp_p (ptid)
&& (ptid.pid () != ptid_get_lwp (ptid) && (ptid.pid () != ptid.lwp ()
|| num_lwps (ptid.pid ()) > 1)) || num_lwps (ptid.pid ()) > 1))
{ {
snprintf (buf, sizeof (buf), "LWP %ld", ptid_get_lwp (ptid)); snprintf (buf, sizeof (buf), "LWP %ld", ptid.lwp ());
return buf; return buf;
} }
@ -3983,7 +3983,7 @@ linux_proc_xfer_partial (enum target_object object,
/* We could keep this file open and cache it - possibly one per /* We could keep this file open and cache it - possibly one per
thread. That requires some juggling, but is even faster. */ thread. That requires some juggling, but is even faster. */
xsnprintf (filename, sizeof filename, "/proc/%ld/mem", xsnprintf (filename, sizeof filename, "/proc/%ld/mem",
ptid_get_lwp (inferior_ptid)); inferior_ptid.lwp ());
fd = gdb_open_cloexec (filename, ((readbuf ? O_RDONLY : O_WRONLY) fd = gdb_open_cloexec (filename, ((readbuf ? O_RDONLY : O_WRONLY)
| O_LARGEFILE), 0); | O_LARGEFILE), 0);
if (fd == -1) if (fd == -1)
@ -4076,7 +4076,7 @@ linux_proc_xfer_spu (enum target_object object,
char buf[128]; char buf[128];
int fd = 0; int fd = 0;
int ret = -1; int ret = -1;
int pid = ptid_get_lwp (inferior_ptid); int pid = inferior_ptid.lwp ();
if (!annex) if (!annex)
{ {
@ -4441,7 +4441,7 @@ linux_nat_stop_lwp (struct lwp_info *lwp, void *data)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"linux-nat: already stopping LWP %ld at " "linux-nat: already stopping LWP %ld at "
"GDB's request\n", "GDB's request\n",
ptid_get_lwp (lwp->ptid)); lwp->ptid.lwp ());
return 0; return 0;
} }
@ -4498,7 +4498,7 @@ linux_nat_target::thread_address_space (ptid_t ptid)
struct inferior *inf; struct inferior *inf;
int pid; int pid;
if (ptid_get_lwp (ptid) == 0) if (ptid.lwp () == 0)
{ {
/* An (lwpid,0,0) ptid. Look up the lwp object to get at the /* An (lwpid,0,0) ptid. Look up the lwp object to get at the
tgid. */ tgid. */
@ -4644,7 +4644,7 @@ linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
{ {
int pid; int pid;
pid = ptid_get_lwp (ptid); pid = ptid.lwp ();
if (pid == 0) if (pid == 0)
pid = ptid.pid (); pid = ptid.pid ();

View File

@ -419,9 +419,9 @@ linux_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
{ {
static char buf[80]; static char buf[80];
if (ptid_get_lwp (ptid) != 0) if (ptid.lwp () != 0)
{ {
snprintf (buf, sizeof (buf), "LWP %ld", ptid_get_lwp (ptid)); snprintf (buf, sizeof (buf), "LWP %ld", ptid.lwp ());
return buf; return buf;
} }
@ -1632,7 +1632,7 @@ linux_collect_thread_registers (const struct regcache *regcache,
data.abort_iteration = 0; data.abort_iteration = 0;
/* For remote targets the LWP may not be available, so use the TID. */ /* For remote targets the LWP may not be available, so use the TID. */
data.lwp = ptid_get_lwp (ptid); data.lwp = ptid.lwp ();
if (!data.lwp) if (!data.lwp)
data.lwp = ptid_get_tid (ptid); data.lwp = ptid_get_tid (ptid);

View File

@ -394,17 +394,17 @@ thread_from_lwp (thread_info *stopped, ptid_t ptid)
/* This ptid comes from linux-nat.c, which should always fill in the /* This ptid comes from linux-nat.c, which should always fill in the
LWP. */ LWP. */
gdb_assert (ptid_get_lwp (ptid) != 0); gdb_assert (ptid.lwp () != 0);
info = get_thread_db_info (ptid.pid ()); info = get_thread_db_info (ptid.pid ());
/* Access an lwp we know is stopped. */ /* Access an lwp we know is stopped. */
info->proc_handle.thread = stopped; info->proc_handle.thread = stopped;
err = info->td_ta_map_lwp2thr_p (info->thread_agent, ptid_get_lwp (ptid), err = info->td_ta_map_lwp2thr_p (info->thread_agent, ptid.lwp (),
&th); &th);
if (err != TD_OK) if (err != TD_OK)
error (_("Cannot find user-level thread for LWP %ld: %s"), error (_("Cannot find user-level thread for LWP %ld: %s"),
ptid_get_lwp (ptid), thread_db_err_str (err)); ptid.lwp (), thread_db_err_str (err));
err = info->td_thr_get_info_p (&th, &ti); err = info->td_thr_get_info_p (&th, &ti);
if (err != TD_OK) if (err != TD_OK)
@ -1638,7 +1638,7 @@ thread_db_target::pid_to_str (ptid_t ptid)
thread_db_thread_info *priv = get_thread_db_thread_info (thread_info); thread_db_thread_info *priv = get_thread_db_thread_info (thread_info);
snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld)", snprintf (buf, sizeof (buf), "Thread 0x%lx (LWP %ld)",
(unsigned long) priv->tid, ptid_get_lwp (ptid)); (unsigned long) priv->tid, ptid.lwp ());
return buf; return buf;
} }

View File

@ -460,7 +460,7 @@ mips_linux_nat_target::read_description ()
{ {
int tid; int tid;
tid = ptid_get_lwp (inferior_ptid); tid = inferior_ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = inferior_ptid.pid (); tid = inferior_ptid.pid ();
@ -543,7 +543,7 @@ mips_linux_nat_target::can_use_hw_breakpoint (enum bptype type,
int i; int i;
uint32_t wanted_mask, irw_mask; uint32_t wanted_mask, irw_mask;
if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid), if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
&watch_readback, &watch_readback,
&watch_readback_valid, 0)) &watch_readback_valid, 0))
return 0; return 0;
@ -584,7 +584,7 @@ mips_linux_nat_target::stopped_by_watchpoint ()
int n; int n;
int num_valid; int num_valid;
if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid), if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
&watch_readback, &watch_readback,
&watch_readback_valid, 1)) &watch_readback_valid, 1))
return false; return false;
@ -619,7 +619,7 @@ mips_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
struct pt_watch_regs dummy_regs; struct pt_watch_regs dummy_regs;
int i; int i;
if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid), if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
&watch_readback, &watch_readback,
&watch_readback_valid, 0)) &watch_readback_valid, 0))
return 0; return 0;
@ -641,7 +641,7 @@ write_watchpoint_regs (void)
ALL_LWPS (lp) ALL_LWPS (lp)
{ {
tid = ptid_get_lwp (lp->ptid); tid = lp->ptid.lwp ();
if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1) if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
perror_with_name (_("Couldn't write debug register")); perror_with_name (_("Couldn't write debug register"));
} }
@ -680,7 +680,7 @@ mips_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
int i; int i;
int retval; int retval;
if (!mips_linux_read_watch_registers (ptid_get_lwp (inferior_ptid), if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
&watch_readback, &watch_readback,
&watch_readback_valid, 0)) &watch_readback_valid, 0))
return -1; return -1;

View File

@ -296,7 +296,7 @@ debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
{ {
struct aarch64_dr_update_callback_param *param_p struct aarch64_dr_update_callback_param *param_p
= (struct aarch64_dr_update_callback_param *) ptr; = (struct aarch64_dr_update_callback_param *) ptr;
int tid = ptid_get_lwp (ptid_of_lwp (lwp)); int tid = ptid_of_lwp (lwp).lwp ();
int idx = param_p->idx; int idx = param_p->idx;
int is_watchpoint = param_p->is_watchpoint; int is_watchpoint = param_p->is_watchpoint;
struct arch_lwp_info *info = lwp_arch_private_info (lwp); struct arch_lwp_info *info = lwp_arch_private_info (lwp);

View File

@ -45,7 +45,7 @@ aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
|| DR_HAS_CHANGED (info->dr_changed_wp)) || DR_HAS_CHANGED (info->dr_changed_wp))
{ {
ptid_t ptid = ptid_of_lwp (lwp); ptid_t ptid = ptid_of_lwp (lwp);
int tid = ptid_get_lwp (ptid); int tid = ptid.lwp ();
struct aarch64_debug_reg_state *state struct aarch64_debug_reg_state *state
= aarch64_get_debug_reg_state (ptid.pid ()); = aarch64_get_debug_reg_state (ptid.pid ());

View File

@ -469,7 +469,7 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf)
bts->attr.exclude_hv = 1; bts->attr.exclude_hv = 1;
bts->attr.exclude_idle = 1; bts->attr.exclude_idle = 1;
pid = ptid_get_lwp (ptid); pid = ptid.lwp ();
if (pid == 0) if (pid == 0)
pid = ptid.pid (); pid = ptid.pid ();
@ -585,7 +585,7 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
size_t pages; size_t pages;
int pid, pg; int pid, pg;
pid = ptid_get_lwp (ptid); pid = ptid.lwp ();
if (pid == 0) if (pid == 0)
pid = ptid.pid (); pid = ptid.pid ();

View File

@ -70,7 +70,7 @@ linux_common_core_of_thread (ptid_t ptid)
int core; int core;
sprintf (filename, "/proc/%lld/task/%lld/stat", sprintf (filename, "/proc/%lld/task/%lld/stat",
(PID_T) ptid.pid (), (PID_T) ptid_get_lwp (ptid)); (PID_T) ptid.pid (), (PID_T) ptid.lwp ());
gdb_file_up f = gdb_fopen_cloexec (filename, "r"); gdb_file_up f = gdb_fopen_cloexec (filename, "r");
if (!f) if (!f)
return -1; return -1;

View File

@ -240,7 +240,7 @@ linux_proc_tid_get_name (ptid_t ptid)
char comm_path[100]; char comm_path[100];
const char *comm_val; const char *comm_val;
pid_t pid = ptid.pid (); pid_t pid = ptid.pid ();
pid_t tid = ptid_lwp_p (ptid) ? ptid_get_lwp (ptid) : ptid.pid (); pid_t tid = ptid_lwp_p (ptid) ? ptid.lwp () : ptid.pid ();
xsnprintf (comm_path, sizeof (comm_path), xsnprintf (comm_path, sizeof (comm_path),
"/proc/%ld/task/%ld/comm", (long) pid, (long) tid); "/proc/%ld/task/%ld/comm", (long) pid, (long) tid);

View File

@ -44,7 +44,7 @@ x86_linux_dr_get (ptid_t ptid, int regnum)
unsigned long value; unsigned long value;
gdb_assert (ptid_lwp_p (ptid)); gdb_assert (ptid_lwp_p (ptid));
tid = ptid_get_lwp (ptid); tid = ptid.lwp ();
errno = 0; errno = 0;
value = ptrace (PTRACE_PEEKUSER, tid, u_debugreg_offset (regnum), 0); value = ptrace (PTRACE_PEEKUSER, tid, u_debugreg_offset (regnum), 0);
@ -62,7 +62,7 @@ x86_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
int tid; int tid;
gdb_assert (ptid_lwp_p (ptid)); gdb_assert (ptid_lwp_p (ptid));
tid = ptid_get_lwp (ptid); tid = ptid.lwp ();
errno = 0; errno = 0;
ptrace (PTRACE_POKEUSER, tid, u_debugreg_offset (regnum), value); ptrace (PTRACE_POKEUSER, tid, u_debugreg_offset (regnum), value);

View File

@ -38,11 +38,11 @@
const char * const char *
obsd_nat_target::pid_to_str (ptid_t ptid) obsd_nat_target::pid_to_str (ptid_t ptid)
{ {
if (ptid_get_lwp (ptid) != 0) if (ptid.lwp () != 0)
{ {
static char buf[64]; static char buf[64];
xsnprintf (buf, sizeof buf, "thread %ld", ptid_get_lwp (ptid)); xsnprintf (buf, sizeof buf, "thread %ld", ptid.lwp ());
return buf; return buf;
} }
@ -66,7 +66,7 @@ obsd_nat_target::update_thread_list ()
if (!in_thread_list (ptid)) if (!in_thread_list (ptid))
{ {
if (ptid_get_lwp (inferior_ptid) == 0) if (inferior_ptid.lwp () == 0)
thread_change_ptid (inferior_ptid, ptid); thread_change_ptid (inferior_ptid, ptid);
else else
add_thread (ptid); add_thread (ptid);
@ -154,7 +154,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
ptid = ptid_t (pid, pe.pe_tid, 0); ptid = ptid_t (pid, pe.pe_tid, 0);
if (!in_thread_list (ptid)) if (!in_thread_list (ptid))
{ {
if (ptid_get_lwp (inferior_ptid) == 0) if (inferior_ptid.lwp () == 0)
thread_change_ptid (inferior_ptid, ptid); thread_change_ptid (inferior_ptid, ptid);
else else
add_thread (ptid); add_thread (ptid);

View File

@ -127,7 +127,7 @@ void
ppc_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regno) ppc_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
{ {
gdb_gregset_t regs; gdb_gregset_t regs;
pid_t pid = ptid_get_lwp (regcache->ptid ()); pid_t pid = regcache->ptid ().lwp ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
perror_with_name (_("Couldn't get registers")); perror_with_name (_("Couldn't get registers"));
@ -153,7 +153,7 @@ void
ppc_fbsd_nat_target::store_registers (struct regcache *regcache, int regno) ppc_fbsd_nat_target::store_registers (struct regcache *regcache, int regno)
{ {
gdb_gregset_t regs; gdb_gregset_t regs;
pid_t pid = ptid_get_lwp (regcache->ptid ()); pid_t pid = regcache->ptid ().lwp ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
perror_with_name (_("Couldn't get registers")); perror_with_name (_("Couldn't get registers"));

View File

@ -1224,7 +1224,7 @@ have_ptrace_hwdebug_interface (void)
{ {
int tid; int tid;
tid = ptid_get_lwp (inferior_ptid); tid = inferior_ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = inferior_ptid.pid (); tid = inferior_ptid.pid ();
@ -1296,7 +1296,7 @@ ppc_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot)
/* We need to know whether ptrace supports PTRACE_SET_DEBUGREG /* We need to know whether ptrace supports PTRACE_SET_DEBUGREG
and whether the target has DABR. If either answer is no, the and whether the target has DABR. If either answer is no, the
ptrace call will return -1. Fail in that case. */ ptrace call will return -1. Fail in that case. */
tid = ptid_get_lwp (ptid); tid = ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = ptid.pid (); tid = ptid.pid ();
@ -1508,7 +1508,7 @@ ppc_linux_nat_target::insert_hw_breakpoint (struct gdbarch *gdbarch,
} }
ALL_LWPS (lp) ALL_LWPS (lp)
hwdebug_insert_point (&p, ptid_get_lwp (lp->ptid)); hwdebug_insert_point (&p, lp->ptid.lwp ());
return 0; return 0;
} }
@ -1544,7 +1544,7 @@ ppc_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
} }
ALL_LWPS (lp) ALL_LWPS (lp)
hwdebug_remove_point (&p, ptid_get_lwp (lp->ptid)); hwdebug_remove_point (&p, lp->ptid.lwp ());
return 0; return 0;
} }
@ -1587,7 +1587,7 @@ ppc_linux_nat_target::insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
p.condition_value = 0; p.condition_value = 0;
ALL_LWPS (lp) ALL_LWPS (lp)
hwdebug_insert_point (&p, ptid_get_lwp (lp->ptid)); hwdebug_insert_point (&p, lp->ptid.lwp ());
return 0; return 0;
} }
@ -1615,7 +1615,7 @@ ppc_linux_nat_target::remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
p.condition_value = 0; p.condition_value = 0;
ALL_LWPS (lp) ALL_LWPS (lp)
hwdebug_remove_point (&p, ptid_get_lwp (lp->ptid)); hwdebug_remove_point (&p, lp->ptid.lwp ());
return 0; return 0;
} }
@ -1625,7 +1625,7 @@ static int
can_use_watchpoint_cond_accel (void) can_use_watchpoint_cond_accel (void)
{ {
struct thread_points *p; struct thread_points *p;
int tid = ptid_get_lwp (inferior_ptid); int tid = inferior_ptid.lwp ();
int cnt = hwdebug_info.num_condition_regs, i; int cnt = hwdebug_info.num_condition_regs, i;
CORE_ADDR tmp_value; CORE_ADDR tmp_value;
@ -1879,7 +1879,7 @@ ppc_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
create_watchpoint_request (&p, addr, len, type, cond, 1); create_watchpoint_request (&p, addr, len, type, cond, 1);
ALL_LWPS (lp) ALL_LWPS (lp)
hwdebug_insert_point (&p, ptid_get_lwp (lp->ptid)); hwdebug_insert_point (&p, lp->ptid.lwp ());
ret = 0; ret = 0;
} }
@ -1923,7 +1923,7 @@ ppc_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
saved_dabr_value = dabr_value; saved_dabr_value = dabr_value;
ALL_LWPS (lp) ALL_LWPS (lp)
if (ptrace (PTRACE_SET_DEBUGREG, ptid_get_lwp (lp->ptid), 0, if (ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (), 0,
saved_dabr_value) < 0) saved_dabr_value) < 0)
return -1; return -1;
@ -1948,7 +1948,7 @@ ppc_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
create_watchpoint_request (&p, addr, len, type, cond, 0); create_watchpoint_request (&p, addr, len, type, cond, 0);
ALL_LWPS (lp) ALL_LWPS (lp)
hwdebug_remove_point (&p, ptid_get_lwp (lp->ptid)); hwdebug_remove_point (&p, lp->ptid.lwp ());
ret = 0; ret = 0;
} }
@ -1956,7 +1956,7 @@ ppc_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
{ {
saved_dabr_value = 0; saved_dabr_value = 0;
ALL_LWPS (lp) ALL_LWPS (lp)
if (ptrace (PTRACE_SET_DEBUGREG, ptid_get_lwp (lp->ptid), 0, if (ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (), 0,
saved_dabr_value) < 0) saved_dabr_value) < 0)
return -1; return -1;
@ -1969,7 +1969,7 @@ ppc_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
void void
ppc_linux_nat_target::low_new_thread (struct lwp_info *lp) ppc_linux_nat_target::low_new_thread (struct lwp_info *lp)
{ {
int tid = ptid_get_lwp (lp->ptid); int tid = lp->ptid.lwp ();
if (have_ptrace_hwdebug_interface ()) if (have_ptrace_hwdebug_interface ())
{ {
@ -2008,7 +2008,7 @@ static void
ppc_linux_thread_exit (struct thread_info *tp, int silent) ppc_linux_thread_exit (struct thread_info *tp, int silent)
{ {
int i; int i;
int tid = ptid_get_lwp (tp->ptid); int tid = tp->ptid.lwp ();
struct hw_break_tuple *hw_breaks; struct hw_break_tuple *hw_breaks;
struct thread_points *t = NULL, *p; struct thread_points *t = NULL, *p;
@ -2057,7 +2057,7 @@ ppc_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p)
/* The index (or slot) of the *point is passed in the si_errno field. */ /* The index (or slot) of the *point is passed in the si_errno field. */
int slot = siginfo.si_errno; int slot = siginfo.si_errno;
t = hwdebug_find_thread_points_by_tid (ptid_get_lwp (inferior_ptid), 0); t = hwdebug_find_thread_points_by_tid (inferior_ptid.lwp (), 0);
/* Find out if this *point is a hardware breakpoint. /* Find out if this *point is a hardware breakpoint.
If so, we should return 0. */ If so, we should return 0. */
@ -2183,7 +2183,7 @@ ppc_linux_nat_target::auxv_parse (gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, gdb_byte *endptr, CORE_ADDR *typep,
CORE_ADDR *valp) CORE_ADDR *valp)
{ {
int tid = ptid_get_lwp (inferior_ptid); int tid = inferior_ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = inferior_ptid.pid (); tid = inferior_ptid.pid ();
@ -2210,7 +2210,7 @@ ppc_linux_nat_target::auxv_parse (gdb_byte **readptr,
const struct target_desc * const struct target_desc *
ppc_linux_nat_target::read_description () ppc_linux_nat_target::read_description ()
{ {
int tid = ptid_get_lwp (inferior_ptid); int tid = inferior_ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = inferior_ptid.pid (); tid = inferior_ptid.pid ();

View File

@ -1635,17 +1635,17 @@ procfs_find_LDT_entry (ptid_t ptid)
procinfo *pi; procinfo *pi;
/* Find procinfo for the lwp. */ /* Find procinfo for the lwp. */
if ((pi = find_procinfo (ptid.pid (), ptid_get_lwp (ptid))) == NULL) if ((pi = find_procinfo (ptid.pid (), ptid.lwp ())) == NULL)
{ {
warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%ld."), warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%ld."),
ptid.pid (), ptid_get_lwp (ptid)); ptid.pid (), ptid.lwp ());
return NULL; return NULL;
} }
/* get its general registers. */ /* get its general registers. */
if ((gregs = proc_get_gregs (pi)) == NULL) if ((gregs = proc_get_gregs (pi)) == NULL)
{ {
warning (_("procfs_find_LDT_entry: could not read gregs for %d:%ld."), warning (_("procfs_find_LDT_entry: could not read gregs for %d:%ld."),
ptid.pid (), ptid_get_lwp (ptid)); ptid.pid (), ptid.lwp ());
return NULL; return NULL;
} }
/* Now extract the GS register's lower 16 bits. */ /* Now extract the GS register's lower 16 bits. */
@ -2065,7 +2065,7 @@ procfs_target::fetch_registers (struct regcache *regcache, int regnum)
procinfo *pi; procinfo *pi;
ptid_t ptid = regcache->ptid (); ptid_t ptid = regcache->ptid ();
int pid = ptid.pid (); int pid = ptid.pid ();
int tid = ptid_get_lwp (ptid); int tid = ptid.lwp ();
struct gdbarch *gdbarch = regcache->arch (); struct gdbarch *gdbarch = regcache->arch ();
pi = find_procinfo_or_die (pid, tid); pi = find_procinfo_or_die (pid, tid);
@ -2114,7 +2114,7 @@ procfs_target::store_registers (struct regcache *regcache, int regnum)
procinfo *pi; procinfo *pi;
ptid_t ptid = regcache->ptid (); ptid_t ptid = regcache->ptid ();
int pid = ptid.pid (); int pid = ptid.pid ();
int tid = ptid_get_lwp (ptid); int tid = ptid.lwp ();
struct gdbarch *gdbarch = regcache->arch (); struct gdbarch *gdbarch = regcache->arch ();
pi = find_procinfo_or_die (pid, tid); pi = find_procinfo_or_die (pid, tid);
@ -2533,9 +2533,9 @@ wait_again:
procinfo, resume may be unhappy later. */ procinfo, resume may be unhappy later. */
add_thread (retval); add_thread (retval);
if (find_procinfo (retval.pid (), if (find_procinfo (retval.pid (),
ptid_get_lwp (retval)) == NULL) retval.lwp ()) == NULL)
create_procinfo (retval.pid (), create_procinfo (retval.pid (),
ptid_get_lwp (retval)); retval.lwp ());
} }
} }
else /* Flags do not indicate STOPPED. */ else /* Flags do not indicate STOPPED. */
@ -2752,7 +2752,7 @@ procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
{ {
/* Resume a specific thread, presumably suppressing the /* Resume a specific thread, presumably suppressing the
others. */ others. */
thread = find_procinfo (ptid.pid (), ptid_get_lwp (ptid)); thread = find_procinfo (ptid.pid (), ptid.lwp ());
if (thread != NULL) if (thread != NULL)
{ {
if (thread->tid != 0) if (thread->tid != 0)
@ -3178,7 +3178,7 @@ procfs_target::thread_alive (ptid_t ptid)
procinfo *pi; procinfo *pi;
proc = ptid.pid (); proc = ptid.pid ();
thread = ptid_get_lwp (ptid); thread = ptid.lwp ();
/* If I don't know it, it ain't alive! */ /* If I don't know it, it ain't alive! */
if ((pi = find_procinfo (proc, thread)) == NULL) if ((pi = find_procinfo (proc, thread)) == NULL)
return false; return false;
@ -3203,10 +3203,10 @@ procfs_target::pid_to_str (ptid_t ptid)
{ {
static char buf[80]; static char buf[80];
if (ptid_get_lwp (ptid) == 0) if (ptid.lwp () == 0)
sprintf (buf, "process %d", ptid.pid ()); sprintf (buf, "process %d", ptid.pid ());
else else
sprintf (buf, "LWP %ld", ptid_get_lwp (ptid)); sprintf (buf, "LWP %ld", ptid.lwp ());
return buf; return buf;
} }
@ -3764,7 +3764,7 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid,
gdb_fpregset_t fpregs; gdb_fpregset_t fpregs;
unsigned long merged_pid; unsigned long merged_pid;
merged_pid = ptid_get_lwp (ptid) << 16 | ptid.pid (); merged_pid = ptid.lwp () << 16 | ptid.pid ();
/* This part is the old method for fetching registers. /* This part is the old method for fetching registers.
It should be replaced by the newer one using regsets It should be replaced by the newer one using regsets

View File

@ -267,7 +267,7 @@ gdbpy_create_ptid_object (ptid_t ptid)
return NULL; return NULL;
pid = ptid.pid (); pid = ptid.pid ();
lwp = ptid_get_lwp (ptid); lwp = ptid.lwp ();
tid = ptid_get_tid (ptid); tid = ptid_get_tid (ptid);
PyTuple_SET_ITEM (ret, 0, PyInt_FromLong (pid)); PyTuple_SET_ITEM (ret, 0, PyInt_FromLong (pid));

View File

@ -147,7 +147,7 @@ is_ravenscar_task (ptid_t ptid)
2.0.48 for LEON3 sends 'm0' as a reply to the 'qfThreadInfo' 2.0.48 for LEON3 sends 'm0' as a reply to the 'qfThreadInfo'
query, which the remote protocol layer then treats as a thread query, which the remote protocol layer then treats as a thread
whose TID is 0. This is obviously not a ravenscar task. */ whose TID is 0. This is obviously not a ravenscar task. */
return ptid_get_lwp (ptid) == 0 && ptid_get_tid (ptid) != 0; return ptid.lwp () == 0 && ptid_get_tid (ptid) != 0;
} }
/* Given PTID, which can be either a ravenscar task or a CPU thread, /* Given PTID, which can be either a ravenscar task or a CPU thread,
@ -171,7 +171,7 @@ ravenscar_get_thread_base_cpu (ptid_t ptid)
else else
{ {
/* We assume that the LWP of the PTID is equal to the CPU number. */ /* We assume that the LWP of the PTID is equal to the CPU number. */
base_cpu = ptid_get_lwp (ptid); base_cpu = ptid.lwp ();
} }
return base_cpu; return base_cpu;

View File

@ -2782,7 +2782,7 @@ remote_thread_always_alive (ptid_t ptid)
/* The main thread is always alive. */ /* The main thread is always alive. */
return 1; return 1;
if (ptid.pid () != 0 && ptid_get_lwp (ptid) == 0) if (ptid.pid () != 0 && ptid.lwp () == 0)
/* The main thread is always alive. This can happen after a /* The main thread is always alive. This can happen after a
vAttach, if the remote side doesn't support vAttach, if the remote side doesn't support
multi-threading. */ multi-threading. */
@ -2924,7 +2924,7 @@ remote_target::write_ptid (char *buf, const char *endbuf, ptid_t ptid)
else else
buf += xsnprintf (buf, endbuf - buf, "p%x.", pid); buf += xsnprintf (buf, endbuf - buf, "p%x.", pid);
} }
tid = ptid_get_lwp (ptid); tid = ptid.lwp ();
if (tid < 0) if (tid < 0)
buf += xsnprintf (buf, endbuf - buf, "-%x", -tid); buf += xsnprintf (buf, endbuf - buf, "-%x", -tid);
else else
@ -3839,7 +3839,7 @@ remote_target::extra_thread_info (thread_info *tp)
_("remote_threads_extra_info")); _("remote_threads_extra_info"));
if (ptid_equal (tp->ptid, magic_null_ptid) if (ptid_equal (tp->ptid, magic_null_ptid)
|| (tp->ptid.pid () != 0 && ptid_get_lwp (tp->ptid) == 0)) || (tp->ptid.pid () != 0 && tp->ptid.lwp () == 0))
/* This is the main thread which was added by GDB. The remote /* This is the main thread which was added by GDB. The remote
server doesn't know about it. */ server doesn't know about it. */
return NULL; return NULL;
@ -3881,7 +3881,7 @@ remote_target::extra_thread_info (thread_info *tp)
rs->use_threadextra_query = 0; rs->use_threadextra_query = 0;
set = TAG_THREADID | TAG_EXISTS | TAG_THREADNAME set = TAG_THREADID | TAG_EXISTS | TAG_THREADNAME
| TAG_MOREDISPLAY | TAG_DISPLAY; | TAG_MOREDISPLAY | TAG_DISPLAY;
int_to_threadref (&id, ptid_get_lwp (tp->ptid)); int_to_threadref (&id, tp->ptid.lwp ());
if (remote_get_threadinfo (&id, set, &threadinfo)) if (remote_get_threadinfo (&id, set, &threadinfo))
if (threadinfo.active) if (threadinfo.active)
{ {
@ -11468,14 +11468,14 @@ remote_target::pid_to_str (ptid_t ptid)
if (ptid_equal (magic_null_ptid, ptid)) if (ptid_equal (magic_null_ptid, ptid))
xsnprintf (buf, sizeof buf, "Thread <main>"); xsnprintf (buf, sizeof buf, "Thread <main>");
else if (remote_multi_process_p (rs)) else if (remote_multi_process_p (rs))
if (ptid_get_lwp (ptid) == 0) if (ptid.lwp () == 0)
return normal_pid_to_str (ptid); return normal_pid_to_str (ptid);
else else
xsnprintf (buf, sizeof buf, "Thread %d.%ld", xsnprintf (buf, sizeof buf, "Thread %d.%ld",
ptid.pid (), ptid_get_lwp (ptid)); ptid.pid (), ptid.lwp ());
else else
xsnprintf (buf, sizeof buf, "Thread %ld", xsnprintf (buf, sizeof buf, "Thread %ld",
ptid_get_lwp (ptid)); ptid.lwp ());
return buf; return buf;
} }
} }

View File

@ -258,7 +258,7 @@ static int
s390_inferior_tid (void) s390_inferior_tid (void)
{ {
/* GNU/Linux LWP ID's are process ID's. */ /* GNU/Linux LWP ID's are process ID's. */
int tid = ptid_get_lwp (inferior_ptid); int tid = inferior_ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = inferior_ptid.pid (); /* Not a threaded program. */ tid = inferior_ptid.pid (); /* Not a threaded program. */
@ -730,7 +730,7 @@ s390_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
lp_priv->per_info_changed = 0; lp_priv->per_info_changed = 0;
tid = ptid_get_lwp (ptid_of_lwp (lp)); tid = ptid_of_lwp (lp).lwp ();
if (tid == 0) if (tid == 0)
tid = pid; tid = pid;

View File

@ -348,7 +348,7 @@ lwp_to_thread (ptid_t lwp)
if (!target_thread_alive (lwp)) if (!target_thread_alive (lwp))
return ptid_t (-1); /* Must be a defunct LPW. */ return ptid_t (-1); /* Must be a defunct LPW. */
val = p_td_ta_map_lwp2thr (main_ta, ptid_get_lwp (lwp), &th); val = p_td_ta_map_lwp2thr (main_ta, lwp.lwp (), &th);
if (val == TD_NOTHR) if (val == TD_NOTHR)
return ptid_t (-1); /* Thread must have terminated. */ return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK) else if (val != TD_OK)
@ -1014,13 +1014,13 @@ sol_thread_target::pid_to_str (ptid_t ptid)
ptid_get_tid (ptid)); ptid_get_tid (ptid));
else if (lwp.pid () != -2) else if (lwp.pid () != -2)
xsnprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)", xsnprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)",
ptid_get_tid (ptid), ptid_get_lwp (lwp)); ptid_get_tid (ptid), lwp.lwp ());
else else
xsnprintf (buf, sizeof (buf), "Thread %ld ", xsnprintf (buf, sizeof (buf), "Thread %ld ",
ptid_get_tid (ptid)); ptid_get_tid (ptid));
} }
else if (ptid_get_lwp (ptid) != 0) else if (ptid.lwp () != 0)
xsnprintf (buf, sizeof (buf), "LWP %ld ", ptid_get_lwp (ptid)); xsnprintf (buf, sizeof (buf), "LWP %ld ", ptid.lwp ());
else else
xsnprintf (buf, sizeof (buf), "process %d ", ptid.pid ()); xsnprintf (buf, sizeof (buf), "process %d ", ptid.pid ());

View File

@ -49,11 +49,11 @@ sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
/* Check whether we're printing an LWP (gdb thread) or a /* Check whether we're printing an LWP (gdb thread) or a
process. */ process. */
pid = ptid_get_lwp (ptid); pid = ptid.lwp ();
if (pid != 0) if (pid != 0)
{ {
/* A thread. */ /* A thread. */
xsnprintf (buf, sizeof buf, "LWP %ld", ptid_get_lwp (ptid)); xsnprintf (buf, sizeof buf, "LWP %ld", ptid.lwp ());
return buf; return buf;
} }

View File

@ -69,7 +69,7 @@ fetch_ppc_register (int regno)
{ {
PTRACE_TYPE_RET res; PTRACE_TYPE_RET res;
int tid = ptid_get_lwp (inferior_ptid); int tid = inferior_ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = inferior_ptid.pid (); tid = inferior_ptid.pid ();
@ -154,7 +154,7 @@ fetch_ppc_memory (ULONGEST memaddr, gdb_byte *myaddr, int len)
/ sizeof (PTRACE_TYPE_RET)); / sizeof (PTRACE_TYPE_RET));
PTRACE_TYPE_RET *buffer; PTRACE_TYPE_RET *buffer;
int tid = ptid_get_lwp (inferior_ptid); int tid = inferior_ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = inferior_ptid.pid (); tid = inferior_ptid.pid ();
@ -184,7 +184,7 @@ store_ppc_memory (ULONGEST memaddr, const gdb_byte *myaddr, int len)
/ sizeof (PTRACE_TYPE_RET)); / sizeof (PTRACE_TYPE_RET));
PTRACE_TYPE_RET *buffer; PTRACE_TYPE_RET *buffer;
int tid = ptid_get_lwp (inferior_ptid); int tid = inferior_ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = inferior_ptid.pid (); tid = inferior_ptid.pid ();
@ -422,7 +422,7 @@ spu_linux_nat_target::post_startup_inferior (ptid_t ptid)
int fd; int fd;
ULONGEST addr; ULONGEST addr;
int tid = ptid_get_lwp (ptid); int tid = ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = ptid.pid (); tid = ptid.pid ();

View File

@ -114,7 +114,7 @@ x86_linux_nat_target::read_description ()
uint64_t xcr0_features_bits; uint64_t xcr0_features_bits;
/* GNU/Linux LWP ID's are process ID's. */ /* GNU/Linux LWP ID's are process ID's. */
tid = ptid_get_lwp (inferior_ptid); tid = inferior_ptid.lwp ();
if (tid == 0) if (tid == 0)
tid = inferior_ptid.pid (); /* Not a threaded program. */ tid = inferior_ptid.pid (); /* Not a threaded program. */

View File

@ -202,7 +202,7 @@ supply_fpregset (struct regcache *regcache,
static void static void
fetch_gregs (struct regcache *regcache, int regnum) fetch_gregs (struct regcache *regcache, int regnum)
{ {
int tid = ptid_get_lwp (regcache->ptid ()); int tid = regcache->ptid ().lwp ();
gdb_gregset_t regs; gdb_gregset_t regs;
int areg; int areg;
@ -221,7 +221,7 @@ fetch_gregs (struct regcache *regcache, int regnum)
static void static void
store_gregs (struct regcache *regcache, int regnum) store_gregs (struct regcache *regcache, int regnum)
{ {
int tid = ptid_get_lwp (regcache->ptid ()); int tid = regcache->ptid ().lwp ();
gdb_gregset_t regs; gdb_gregset_t regs;
int areg; int areg;
@ -249,7 +249,7 @@ static int xtreg_high;
static void static void
fetch_xtregs (struct regcache *regcache, int regnum) fetch_xtregs (struct regcache *regcache, int regnum)
{ {
int tid = ptid_get_lwp (regcache->ptid ()); int tid = regcache->ptid ().lwp ();
const xtensa_regtable_t *ptr; const xtensa_regtable_t *ptr;
char xtregs [XTENSA_ELF_XTREG_SIZE]; char xtregs [XTENSA_ELF_XTREG_SIZE];
@ -264,7 +264,7 @@ fetch_xtregs (struct regcache *regcache, int regnum)
static void static void
store_xtregs (struct regcache *regcache, int regnum) store_xtregs (struct regcache *regcache, int regnum)
{ {
int tid = ptid_get_lwp (regcache->ptid ()); int tid = regcache->ptid ().lwp ();
const xtensa_regtable_t *ptr; const xtensa_regtable_t *ptr;
char xtregs [XTENSA_ELF_XTREG_SIZE]; char xtregs [XTENSA_ELF_XTREG_SIZE];