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.
+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>
* common/ptid.c (ptid_get_pid): Remove.
and arm. */
gdb_static_assert (sizeof (regs) >= 18 * 4);
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
iovec.iov_base = ®s;
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
/* Make sure REGS can hold all registers contents on both aarch64
and arm. */
gdb_static_assert (sizeof (regs) >= 18 * 4);
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
iovec.iov_base = ®s;
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
and arm. */
gdb_static_assert (sizeof regs >= VFP_REGS_SIZE);
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
iovec.iov_base = ®s;
/* Make sure REGS can hold all VFP registers contents on both aarch64
and arm. */
gdb_static_assert (sizeof regs >= VFP_REGS_SIZE);
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
iovec.iov_base = ®s;
fetch_sveregs_from_thread (struct regcache *regcache)
{
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 ());
}
{
int ret;
struct iovec iovec;
- int tid = ptid_get_lwp (regcache->ptid ());
+ int tid = regcache->ptid ().lwp ();
/* Obtain a dump of SVE registers from ptrace. */
std::unique_ptr<gdb_byte[]> base = aarch64_sve_get_sveregs (tid);
gdb_byte regbuf[VFP_REGS_SIZE];
struct iovec iovec;
- tid = ptid_get_lwp (inferior_ptid);
+ tid = inferior_ptid.lwp ();
iovec.iov_base = regbuf;
iovec.iov_len = VFP_REGS_SIZE;
/* Print the TID and LWP. */
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 (task_info->base_cpu != 0)
return -1;
else if (ptid_get_tid (ptid1) > ptid_get_tid (ptid2))
return 1;
- else if (ptid_get_lwp (ptid1) < ptid_get_lwp (ptid2))
+ else if (ptid1.lwp () < ptid2.lwp ())
return -1;
- else if (ptid_get_lwp (ptid1) > ptid_get_lwp (ptid2))
+ else if (ptid1.lwp () > ptid2.lwp ())
return 1;
else
return 0;
thread = find_thread_ptid (ptid);
if (!thread)
error (_("aix-thread resume: unknown pthread %ld"),
- ptid_get_lwp (ptid));
+ ptid.lwp ());
aix_thread_info *priv = get_aix_thread_info (thread);
tid[0] = priv->tid;
if (tid[0] == PTHDB_INVALID_TID)
error (_("aix-thread resume: no tid for pthread %ld"),
- ptid_get_lwp (ptid));
+ ptid.lwp ());
tid[1] = 0;
if (arch64)
int tid;
/* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
if (tid == 0)
tid = regcache->ptid ().pid (); /* Not a threaded program. */
int tid;
/* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
if (tid == 0)
tid = regcache->ptid ().pid (); /* Not a threaded program. */
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
/* Read the floating point state. */
if (have_ptrace_getregset == TRIBOOL_TRUE)
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
/* Read the floating point state. */
if (have_ptrace_getregset == TRIBOOL_TRUE)
elf_gregset_t regs;
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
elf_gregset_t regs;
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
/* Fetch the general registers. */
if (have_ptrace_getregset == TRIBOOL_TRUE)
int ret, regno, tid;
/* 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);
if (ret < 0)
int ret, regno, tid;
/* 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);
if (ret < 0)
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (regcache->ptid ());
+ tid = regcache->ptid ().lwp ();
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
{
elf_gregset_t gpregs;
struct iovec iov;
- int tid = ptid_get_lwp (inferior_ptid);
+ int tid = inferior_ptid.lwp ();
iov.iov_base = &gpregs;
iov.iov_len = sizeof (gpregs);
/* Now make sure that the kernel supports reading these
registers. Support was added in 2.6.30. */
- pid = ptid_get_lwp (inferior_ptid);
+ pid = inferior_ptid.lwp ();
errno = 0;
buf = (char *) alloca (VFP_REGS_SIZE);
if (ptrace (PTRACE_GETVFPREGS, pid, 0, buf) < 0
int tid;
unsigned int val;
- tid = ptid_get_lwp (inferior_ptid);
+ tid = inferior_ptid.lwp ();
if (ptrace (PTRACE_GETHBPREGS, tid, 0, &val) < 0)
available = 0;
else
struct arm_linux_hw_breakpoint *bpts, *wpts;
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;
wpts = arm_linux_get_debug_reg_state (lwp->ptid.pid ())->wpts;
/* See ptid.h. */
-long
-ptid_get_lwp (const ptid_t &ptid)
-{
- return ptid.lwp ();
-}
-
-/* See ptid.h. */
-
long
ptid_get_tid (const ptid_t &ptid)
{
/* The following functions are kept for backwards compatibility. The use of
the ptid_t methods is preferred. */
-/* See ptid_t::lwp. */
-
-extern long ptid_get_lwp (const ptid_t &ptid);
-
/* See ptid_t::tid. */
extern long ptid_get_tid (const ptid_t &ptid);
"process", with normal_pid_to_str. */
/* Try the LWPID field first. */
- pid = ptid_get_lwp (ptid);
+ pid = ptid.lwp ();
if (pid != 0)
return normal_pid_to_str (ptid_t (pid));
{
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)
return false;
#ifdef PL_FLAG_EXITED
{
lwpid_t lwp;
- lwp = ptid_get_lwp (ptid);
+ lwp = ptid.lwp ();
if (lwp != 0)
{
static char buf[64];
struct ptrace_lwpinfo pl;
struct kinfo_proc kp;
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];
/* Note that ptrace_lwpinfo returns the process command in pl_tdname
if (debug_fbsd_lwp)
fprintf_unfiltered (gdb_stdlog,
"FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n",
- ptid.pid (), ptid_get_lwp (ptid),
+ ptid.pid (), ptid.lwp (),
ptid_get_tid (ptid));
if (ptid_lwp_p (ptid))
{
if (tp->ptid.pid () != ptid.pid ())
continue;
- if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (ptid))
+ if (tp->ptid.lwp () == ptid.lwp ())
request = PT_RESUME;
else
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"));
}
}
if (!ptid_match (tp->ptid, ptid))
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"));
}
ptid = inferior_ptid;
{
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;
}
struct bfd_section *section;
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
whose contents are defined by a "struct thrmisc" declared in
data.note_size = note_size;
data.stop_signal = stop_signal;
data.abort_iteration = 0;
- data.lwp = ptid_get_lwp (ptid);
+ data.lwp = ptid.lwp ();
gdbarch_iterate_over_regset_sections (gdbarch,
fbsd_collect_regset_section_cb,
+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>
* linux-low.c: Update.
{
debug_printf ("HEW: Got fork event from LWP %ld, "
"new child is %d\n",
- ptid_get_lwp (ptid_of (event_thr)),
+ ptid_of (event_thr).lwp (),
ptid.pid ());
}
linux_attach_lwp (ptid_t ptid)
{
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)
!= 0)
/* Is this a new thread? */
if (find_thread_ptid (ptid) == NULL)
{
- int lwpid = ptid_get_lwp (ptid);
+ int lwpid = ptid.lwp ();
int err;
if (debug_threads)
{
struct thread_info *thr = get_lwp_thread (lwp);
int pid = ptid_of (thr).pid ();
- int lwpid = ptid_get_lwp (ptid_of (thr));
+ int lwpid = ptid_of (thr).lwp ();
int wstat;
int res;
of PID'. */
|| (ptid.pid () == pid_of (thread)
&& (ptid_is_pid (ptid)
- || ptid_get_lwp (ptid) == -1)))
+ || ptid.lwp () == -1)))
{
if (resume[ndx].kind == resume_stop
&& thread->last_resume_kind == resume_stop)
if (mips_linux_watch_get_num_valid (&priv->watch_mirror) > 0)
{
/* Write the mirrored watch register values. */
- int tid = ptid_get_lwp (ptid);
+ int tid = ptid.lwp ();
if (-1 == ptrace (PTRACE_SET_WATCH_REGS, tid,
&priv->watch_mirror, NULL))
{
/* See lynx_ptid_t: The LynxOS tid is stored inside the lwp field
of the ptid. */
- return ptid_get_lwp (ptid);
+ return ptid.lwp ();
}
/* For a given PTID, return the associated PID as known by the LynxOS
int res = 0;
TRACE ("%s pid: %d tid: %ld\n", __func__, ptid.pid (),
- ptid_get_lwp (ptid));
+ ptid.lwp ());
if (nto_inferior.ctl_fd != -1
&& !ptid_equal (ptid, null_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,
sizeof (tid), 0))
proc = add_process (status.pid, 1);
proc->tdesc = nto_tdesc;
TRACE ("Adding thread: pid=%d tid=%ld\n", status.pid,
- ptid_get_lwp (ptid));
+ ptid.lwp ());
nto_find_new_threads (&nto_inferior);
}
else
int res;
TRACE ("%s pid:%d tid:%d\n", __func__, ptid.pid (),
- ptid_get_lwp (ptid));
- if (SignalKill (0, ptid.pid (), ptid_get_lwp (ptid),
+ ptid.lwp ());
+ if (SignalKill (0, ptid.pid (), ptid.lwp (),
0, 0, 0) == -1)
res = 0;
else
else
buf += sprintf (buf, "p%x.", pid);
}
- tid = ptid_get_lwp (ptid);
+ tid = ptid.lwp ();
if (tid < 0)
buf += sprintf (buf, "-%x", -tid);
else
|| ptid_equal (action->thread, thread->id)
|| ((action->thread.pid ()
== thread->id.pid ())
- && ptid_get_lwp (action->thread) == -1))
+ && action->thread.lwp () == -1))
{
if ((*callback) (action, thread))
return true;
{
PTRACE_TYPE_RET res;
- int tid = ptid_get_lwp (current_ptid);
+ int tid = current_ptid.lwp ();
#ifndef __powerpc64__
/* If running as a 32-bit process on a 64-bit system, we attempt
/ sizeof (PTRACE_TYPE_RET));
PTRACE_TYPE_RET *buffer;
- int tid = ptid_get_lwp (current_ptid);
+ int tid = current_ptid.lwp ();
buffer = XALLOCAVEC (PTRACE_TYPE_RET, count);
for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
/ sizeof (PTRACE_TYPE_RET));
PTRACE_TYPE_RET *buffer;
- int tid = ptid_get_lwp (current_ptid);
+ int tid = current_ptid.lwp ();
buffer = XALLOCAVEC (PTRACE_TYPE_RET, count);
if (!annex)
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);
if (fd <= 0)
return -1;
regcache_invalidate ();
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)
perror_with_name ("ptrace");
}
else if (ptid_get_tid (ptid) != 0)
xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx",
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",
- ptid.pid (), ptid_get_lwp (ptid));
+ ptid.pid (), ptid.lwp ());
else
xsnprintf (buf, sizeof (buf), "Process %d",
ptid.pid ());
td_err_e err;
struct lwp_info *lwp;
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);
lwp = get_thread_lwp (thread);
else if (ptid_equal (ptid, minus_one_ptid))
thread = inf_tid_to_thread (inf, -1);
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)
{
else
/* 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)
error (_("Can't run single thread id %s: no such thread!"),
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)
warning (_("Can't step thread id %s: no such thread."),
target_pid_to_str (ptid));
{
inf_update_procs (gnu_current_inf);
return !!inf_tid_to_thread (gnu_current_inf,
- ptid_get_lwp (ptid));
+ ptid.lwp ());
}
\f
gnu_nat_target::pid_to_str (ptid_t ptid)
{
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);
if (thread)
{
struct inf *inf = cur_inf ();
struct proc *thread = inf_tid_to_thread (inf,
- ptid_get_lwp (inferior_ptid));
+ inferior_ptid.lwp ());
if (!thread)
error (_("No current thread."));
return thread;
else
{
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 ());
}
}
{
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;
}
/* Make sure we know about new threads. */
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)
error (_("Can't fetch registers from thread %s: No such thread"),
target_pid_to_str (ptid));
/* Make sure we know about new threads. */
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)
error (_("Couldn't store registers into thread %s: No such thread"),
target_pid_to_str (ptid));
/* Make sure we know about new threads. */
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 (®s, thread);
return regs.dr[regnum];
void
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;
if (catch_syscall_enabled () > 0)
{
int tid;
- tid = ptid_get_lwp (ptid);
+ tid = ptid.lwp ();
if (tid == 0)
tid = ptid.pid ();
/* If we have an LWPID to work with, use it. Otherwise, we're
dealing with a non-threaded program/target. */
- pid = ptid_get_lwp (ptid);
+ pid = ptid.lwp ();
if (pid == 0)
pid = ptid.pid ();
return pid;
stb.printf ("infrun: target_wait (%d.%ld.%ld",
waiton_ptid.pid (),
- ptid_get_lwp (waiton_ptid),
+ waiton_ptid.lwp (),
ptid_get_tid (waiton_ptid));
if (waiton_ptid.pid () != -1)
stb.printf (" [%s]", target_pid_to_str (waiton_ptid));
stb.printf (", status) =\n");
stb.printf ("infrun: %d.%ld.%ld [%s],\n",
result_ptid.pid (),
- ptid_get_lwp (result_ptid),
+ result_ptid.lwp (),
ptid_get_tid (result_ptid),
target_pid_to_str (result_ptid));
stb.printf ("infrun: %s\n", status_string.c_str ());
"infrun: saving status %s for %d.%ld.%ld\n",
statstr.c_str (),
tp->ptid.pid (),
- ptid_get_lwp (tp->ptid),
+ tp->ptid.lwp (),
ptid_get_tid (tp->ptid));
}
"status for %d.%ld.%ld\n",
statstr.c_str (),
t->ptid.pid (),
- ptid_get_lwp (t->ptid),
+ t->ptid.lwp (),
ptid_get_tid (t->ptid));
}
fp != NULL ? fp->num : -1, (long) retpid);
if (info_verbose)
{
- parent_pid = ptid_get_lwp (last_target_ptid);
+ parent_pid = last_target_ptid.lwp ();
if (parent_pid == 0)
parent_pid = last_target_ptid.pid ();
printf_filtered (_(" gdb says parent = %ld.\n"),
== TARGET_WAITKIND_VFORKED);
parent_ptid = inferior_ptid;
child_ptid = inferior_thread ()->pending_follow.value.related_pid;
- parent_pid = ptid_get_lwp (parent_ptid);
- child_pid = ptid_get_lwp (child_ptid);
+ parent_pid = parent_ptid.lwp ();
+ child_pid = child_ptid.lwp ();
/* We're already attached to the parent, by default. */
child_lp = add_lwp (child_ptid);
lwp_info_hash (const void *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);
}
const struct lwp_info *entry = (const struct lwp_info *) a;
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. */
struct lwp_info dummy;
if (ptid_lwp_p (ptid))
- lwp = ptid_get_lwp (ptid);
+ lwp = ptid.lwp ();
else
lwp = ptid.pid ();
static int
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;
if (linux_proc_pid_is_stopped (pid))
lp = find_lwp_pid (ptid);
if (lp == NULL)
{
- int lwpid = ptid_get_lwp (ptid);
+ int lwpid = ptid.lwp ();
if (ptrace (PTRACE_ATTACH, lwpid, 0, 0) < 0)
{
internal_error (__FILE__, __LINE__,
_("unexpected status %d for PID %ld"),
- status, (long) ptid_get_lwp (ptid));
+ status, (long) ptid.lwp ());
}
lp->stopped = 1;
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;
}
}
static void
detach_one_lwp (struct lwp_info *lp, int *signo_p)
{
- int lwpid = ptid_get_lwp (lp->ptid);
+ int lwpid = lp->ptid.lwp ();
int signo;
gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
/* 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) != lp->ptid.pid ())
+ if (lp->ptid.lwp () != lp->ptid.pid ())
detach_one_lwp (lp, NULL);
return 0;
}
other than ptrace-stopped. */
/* 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->status = 0;
"for LWP %ld (stopping threads), "
"resuming with PTRACE_CONT for SIGSTOP\n",
syscall_number,
- ptid_get_lwp (lp->ptid));
+ lp->ptid.lwp ());
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;
return 1;
}
== TARGET_WAITKIND_SYSCALL_ENTRY
? "entry" : "return",
syscall_number,
- ptid_get_lwp (lp->ptid));
+ lp->ptid.lwp ());
return 0;
}
lp->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY
? "entry" : "return",
syscall_number,
- ptid_get_lwp (lp->ptid));
+ lp->ptid.lwp ());
}
else
{
"with no syscall catchpoints."
" %d for LWP %ld, ignoring\n",
syscall_number,
- ptid_get_lwp (lp->ptid));
+ lp->ptid.lwp ());
lp->syscall_state = TARGET_WAITKIND_IGNORE;
}
static int
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;
int event = linux_ptrace_get_extended_event (status);
{
/* The process is not using thread_db. Add the LWP to
GDB's list. */
- target_post_attach (ptid_get_lwp (new_lp->ptid));
+ target_post_attach (new_lp->ptid.lwp ());
add_thread (new_lp->ptid);
}
fprintf_unfiltered (gdb_stdlog,
"LHEW: waitpid of new LWP %ld, "
"saving status %s\n",
- (long) ptid_get_lwp (new_lp->ptid),
+ (long) new_lp->ptid.lwp (),
status_to_str (status));
new_lp->status = status;
}
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LHEW: Got exec event from LWP %ld\n",
- ptid_get_lwp (lp->ptid));
+ lp->ptid.lwp ());
ourstatus->kind = TARGET_WAITKIND_EXECD;
ourstatus->value.execd_pathname
fprintf_unfiltered (gdb_stdlog,
"LHEW: Got expected PTRACE_EVENT_"
"VFORK_DONE from LWP %ld: stopping\n",
- ptid_get_lwp (lp->ptid));
+ lp->ptid.lwp ());
ourstatus->kind = TARGET_WAITKIND_VFORK_DONE;
return 0;
fprintf_unfiltered (gdb_stdlog,
"LHEW: Got PTRACE_EVENT_VFORK_DONE "
"from LWP %ld: ignoring\n",
- ptid_get_lwp (lp->ptid));
+ lp->ptid.lwp ());
return 1;
}
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)
{
/* The thread has previously exited. We need to delete it
Therefore always use WNOHANG with sigsuspend - it is equivalent to
waiting waitpid but linux_proc_pid_is_zombie is safe this way. */
- if (lp->ptid.pid () == ptid_get_lwp (lp->ptid)
- && linux_proc_pid_is_zombie (ptid_get_lwp (lp->ptid)))
+ if (lp->ptid.pid () == lp->ptid.lwp ()
+ && linux_proc_pid_is_zombie (lp->ptid.lwp ()))
{
thread_dead = 1;
if (debug_linux_nat)
if (!thread_dead)
{
- gdb_assert (pid == ptid_get_lwp (lp->ptid));
+ gdb_assert (pid == lp->ptid.lwp ());
if (debug_linux_nat)
{
if (WIFEXITED (status) || WIFSIGNALED (status))
{
if (report_thread_events
- || lp->ptid.pid () == ptid_get_lwp (lp->ptid))
+ || lp->ptid.pid () == lp->ptid.lwp ())
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog, "WL: LWP %d exited.\n",
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);
+ linux_enable_event_reporting (lp->ptid.lwp (), options);
lp->must_set_ptrace_flags = 0;
}
target_pid_to_str (lp->ptid));
}
errno = 0;
- ret = kill_lwp (ptid_get_lwp (lp->ptid), SIGSTOP);
+ ret = kill_lwp (lp->ptid.lwp (), SIGSTOP);
if (debug_linux_nat)
{
fprintf_unfiltered (gdb_stdlog,
if (!lp->ignore_sigint)
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)
fprintf_unfiltered (gdb_stdlog,
lp->ignore_sigint = 0;
errno = 0;
- ptrace (PTRACE_CONT, ptid_get_lwp (lp->ptid), 0, 0);
+ ptrace (PTRACE_CONT, lp->ptid.lwp (), 0, 0);
lp->stopped = 0;
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
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);
+ linux_enable_event_reporting (lp->ptid.lwp (), options);
lp->must_set_ptrace_flags = 0;
}
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"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. */
lp->signalled = 0;
static int
kill_callback (struct lwp_info *lp, void *data)
{
- kill_one_lwp (ptid_get_lwp (lp->ptid));
+ kill_one_lwp (lp->ptid.lwp ());
return 0;
}
static int
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;
}
{
ptid_t child_ptid = ws->value.related_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_wait_one_lwp (child_lwp);
gdb_assert (object == TARGET_OBJECT_SIGNAL_INFO);
gdb_assert (readbuf || writebuf);
- pid = ptid_get_lwp (inferior_ptid);
+ pid = inferior_ptid.lwp ();
if (pid == 0)
pid = inferior_ptid.pid ();
static char buf[64];
if (ptid_lwp_p (ptid)
- && (ptid.pid () != ptid_get_lwp (ptid)
+ && (ptid.pid () != ptid.lwp ()
|| 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;
}
/* We could keep this file open and cache it - possibly one per
thread. That requires some juggling, but is even faster. */
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)
| O_LARGEFILE), 0);
if (fd == -1)
char buf[128];
int fd = 0;
int ret = -1;
- int pid = ptid_get_lwp (inferior_ptid);
+ int pid = inferior_ptid.lwp ();
if (!annex)
{
fprintf_unfiltered (gdb_stdlog,
"linux-nat: already stopping LWP %ld at "
"GDB's request\n",
- ptid_get_lwp (lwp->ptid));
+ lwp->ptid.lwp ());
return 0;
}
struct inferior *inf;
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
tgid. */
{
int pid;
- pid = ptid_get_lwp (ptid);
+ pid = ptid.lwp ();
if (pid == 0)
pid = ptid.pid ();
{
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;
}
data.abort_iteration = 0;
/* 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)
data.lwp = ptid_get_tid (ptid);
/* This ptid comes from linux-nat.c, which should always fill in the
LWP. */
- gdb_assert (ptid_get_lwp (ptid) != 0);
+ gdb_assert (ptid.lwp () != 0);
info = get_thread_db_info (ptid.pid ());
/* Access an lwp we know is 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);
if (err != TD_OK)
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);
if (err != TD_OK)
thread_db_thread_info *priv = get_thread_db_thread_info (thread_info);
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;
}
{
int tid;
- tid = ptid_get_lwp (inferior_ptid);
+ tid = inferior_ptid.lwp ();
if (tid == 0)
tid = inferior_ptid.pid ();
int i;
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_valid, 0))
return 0;
int n;
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_valid, 1))
return false;
struct pt_watch_regs dummy_regs;
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_valid, 0))
return 0;
ALL_LWPS (lp)
{
- tid = ptid_get_lwp (lp->ptid);
+ tid = lp->ptid.lwp ();
if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
perror_with_name (_("Couldn't write debug register"));
}
int i;
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_valid, 0))
return -1;
{
struct aarch64_dr_update_callback_param *param_p
= (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 is_watchpoint = param_p->is_watchpoint;
struct arch_lwp_info *info = lwp_arch_private_info (lwp);
|| DR_HAS_CHANGED (info->dr_changed_wp))
{
ptid_t ptid = ptid_of_lwp (lwp);
- int tid = ptid_get_lwp (ptid);
+ int tid = ptid.lwp ();
struct aarch64_debug_reg_state *state
= aarch64_get_debug_reg_state (ptid.pid ());
bts->attr.exclude_hv = 1;
bts->attr.exclude_idle = 1;
- pid = ptid_get_lwp (ptid);
+ pid = ptid.lwp ();
if (pid == 0)
pid = ptid.pid ();
size_t pages;
int pid, pg;
- pid = ptid_get_lwp (ptid);
+ pid = ptid.lwp ();
if (pid == 0)
pid = ptid.pid ();
int core;
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");
if (!f)
return -1;
char comm_path[100];
const char *comm_val;
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),
"/proc/%ld/task/%ld/comm", (long) pid, (long) tid);
unsigned long value;
gdb_assert (ptid_lwp_p (ptid));
- tid = ptid_get_lwp (ptid);
+ tid = ptid.lwp ();
errno = 0;
value = ptrace (PTRACE_PEEKUSER, tid, u_debugreg_offset (regnum), 0);
int tid;
gdb_assert (ptid_lwp_p (ptid));
- tid = ptid_get_lwp (ptid);
+ tid = ptid.lwp ();
errno = 0;
ptrace (PTRACE_POKEUSER, tid, u_debugreg_offset (regnum), value);
const char *
obsd_nat_target::pid_to_str (ptid_t ptid)
{
- if (ptid_get_lwp (ptid) != 0)
+ if (ptid.lwp () != 0)
{
static char buf[64];
- xsnprintf (buf, sizeof buf, "thread %ld", ptid_get_lwp (ptid));
+ xsnprintf (buf, sizeof buf, "thread %ld", ptid.lwp ());
return buf;
}
if (!in_thread_list (ptid))
{
- if (ptid_get_lwp (inferior_ptid) == 0)
+ if (inferior_ptid.lwp () == 0)
thread_change_ptid (inferior_ptid, ptid);
else
add_thread (ptid);
ptid = ptid_t (pid, pe.pe_tid, 0);
if (!in_thread_list (ptid))
{
- if (ptid_get_lwp (inferior_ptid) == 0)
+ if (inferior_ptid.lwp () == 0)
thread_change_ptid (inferior_ptid, ptid);
else
add_thread (ptid);
ppc_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
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) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
ppc_fbsd_nat_target::store_registers (struct regcache *regcache, int regno)
{
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) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
{
int tid;
- tid = ptid_get_lwp (inferior_ptid);
+ tid = inferior_ptid.lwp ();
if (tid == 0)
tid = inferior_ptid.pid ();
/* We need to know whether ptrace supports PTRACE_SET_DEBUGREG
and whether the target has DABR. If either answer is no, the
ptrace call will return -1. Fail in that case. */
- tid = ptid_get_lwp (ptid);
+ tid = ptid.lwp ();
if (tid == 0)
tid = ptid.pid ();
}
ALL_LWPS (lp)
- hwdebug_insert_point (&p, ptid_get_lwp (lp->ptid));
+ hwdebug_insert_point (&p, lp->ptid.lwp ());
return 0;
}
}
ALL_LWPS (lp)
- hwdebug_remove_point (&p, ptid_get_lwp (lp->ptid));
+ hwdebug_remove_point (&p, lp->ptid.lwp ());
return 0;
}
p.condition_value = 0;
ALL_LWPS (lp)
- hwdebug_insert_point (&p, ptid_get_lwp (lp->ptid));
+ hwdebug_insert_point (&p, lp->ptid.lwp ());
return 0;
}
p.condition_value = 0;
ALL_LWPS (lp)
- hwdebug_remove_point (&p, ptid_get_lwp (lp->ptid));
+ hwdebug_remove_point (&p, lp->ptid.lwp ());
return 0;
}
can_use_watchpoint_cond_accel (void)
{
struct thread_points *p;
- int tid = ptid_get_lwp (inferior_ptid);
+ int tid = inferior_ptid.lwp ();
int cnt = hwdebug_info.num_condition_regs, i;
CORE_ADDR tmp_value;
create_watchpoint_request (&p, addr, len, type, cond, 1);
ALL_LWPS (lp)
- hwdebug_insert_point (&p, ptid_get_lwp (lp->ptid));
+ hwdebug_insert_point (&p, lp->ptid.lwp ());
ret = 0;
}
saved_dabr_value = dabr_value;
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)
return -1;
create_watchpoint_request (&p, addr, len, type, cond, 0);
ALL_LWPS (lp)
- hwdebug_remove_point (&p, ptid_get_lwp (lp->ptid));
+ hwdebug_remove_point (&p, lp->ptid.lwp ());
ret = 0;
}
{
saved_dabr_value = 0;
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)
return -1;
void
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 ())
{
ppc_linux_thread_exit (struct thread_info *tp, int silent)
{
int i;
- int tid = ptid_get_lwp (tp->ptid);
+ int tid = tp->ptid.lwp ();
struct hw_break_tuple *hw_breaks;
struct thread_points *t = NULL, *p;
/* The index (or slot) of the *point is passed in the si_errno field. */
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.
If so, we should return 0. */
gdb_byte *endptr, CORE_ADDR *typep,
CORE_ADDR *valp)
{
- int tid = ptid_get_lwp (inferior_ptid);
+ int tid = inferior_ptid.lwp ();
if (tid == 0)
tid = inferior_ptid.pid ();
const struct target_desc *
ppc_linux_nat_target::read_description ()
{
- int tid = ptid_get_lwp (inferior_ptid);
+ int tid = inferior_ptid.lwp ();
if (tid == 0)
tid = inferior_ptid.pid ();
procinfo *pi;
/* 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."),
- ptid.pid (), ptid_get_lwp (ptid));
+ ptid.pid (), ptid.lwp ());
return NULL;
}
/* get its general registers. */
if ((gregs = proc_get_gregs (pi)) == NULL)
{
warning (_("procfs_find_LDT_entry: could not read gregs for %d:%ld."),
- ptid.pid (), ptid_get_lwp (ptid));
+ ptid.pid (), ptid.lwp ());
return NULL;
}
/* Now extract the GS register's lower 16 bits. */
procinfo *pi;
ptid_t ptid = regcache->ptid ();
int pid = ptid.pid ();
- int tid = ptid_get_lwp (ptid);
+ int tid = ptid.lwp ();
struct gdbarch *gdbarch = regcache->arch ();
pi = find_procinfo_or_die (pid, tid);
procinfo *pi;
ptid_t ptid = regcache->ptid ();
int pid = ptid.pid ();
- int tid = ptid_get_lwp (ptid);
+ int tid = ptid.lwp ();
struct gdbarch *gdbarch = regcache->arch ();
pi = find_procinfo_or_die (pid, tid);
procinfo, resume may be unhappy later. */
add_thread (retval);
if (find_procinfo (retval.pid (),
- ptid_get_lwp (retval)) == NULL)
+ retval.lwp ()) == NULL)
create_procinfo (retval.pid (),
- ptid_get_lwp (retval));
+ retval.lwp ());
}
}
else /* Flags do not indicate STOPPED. */
{
/* Resume a specific thread, presumably suppressing the
others. */
- thread = find_procinfo (ptid.pid (), ptid_get_lwp (ptid));
+ thread = find_procinfo (ptid.pid (), ptid.lwp ());
if (thread != NULL)
{
if (thread->tid != 0)
procinfo *pi;
proc = ptid.pid ();
- thread = ptid_get_lwp (ptid);
+ thread = ptid.lwp ();
/* If I don't know it, it ain't alive! */
if ((pi = find_procinfo (proc, thread)) == NULL)
return false;
{
static char buf[80];
- if (ptid_get_lwp (ptid) == 0)
+ if (ptid.lwp () == 0)
sprintf (buf, "process %d", ptid.pid ());
else
- sprintf (buf, "LWP %ld", ptid_get_lwp (ptid));
+ sprintf (buf, "LWP %ld", ptid.lwp ());
return buf;
}
gdb_fpregset_t fpregs;
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.
It should be replaced by the newer one using regsets
return NULL;
pid = ptid.pid ();
- lwp = ptid_get_lwp (ptid);
+ lwp = ptid.lwp ();
tid = ptid_get_tid (ptid);
PyTuple_SET_ITEM (ret, 0, PyInt_FromLong (pid));
2.0.48 for LEON3 sends 'm0' as a reply to the 'qfThreadInfo'
query, which the remote protocol layer then treats as a thread
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,
else
{
/* 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;
/* The main thread is always alive. */
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
vAttach, if the remote side doesn't support
multi-threading. */
else
buf += xsnprintf (buf, endbuf - buf, "p%x.", pid);
}
- tid = ptid_get_lwp (ptid);
+ tid = ptid.lwp ();
if (tid < 0)
buf += xsnprintf (buf, endbuf - buf, "-%x", -tid);
else
_("remote_threads_extra_info"));
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
server doesn't know about it. */
return NULL;
rs->use_threadextra_query = 0;
set = TAG_THREADID | TAG_EXISTS | TAG_THREADNAME
| 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 (threadinfo.active)
{
if (ptid_equal (magic_null_ptid, ptid))
xsnprintf (buf, sizeof buf, "Thread <main>");
else if (remote_multi_process_p (rs))
- if (ptid_get_lwp (ptid) == 0)
+ if (ptid.lwp () == 0)
return normal_pid_to_str (ptid);
else
xsnprintf (buf, sizeof buf, "Thread %d.%ld",
- ptid.pid (), ptid_get_lwp (ptid));
+ ptid.pid (), ptid.lwp ());
else
xsnprintf (buf, sizeof buf, "Thread %ld",
- ptid_get_lwp (ptid));
+ ptid.lwp ());
return buf;
}
}
s390_inferior_tid (void)
{
/* GNU/Linux LWP ID's are process ID's. */
- int tid = ptid_get_lwp (inferior_ptid);
+ int tid = inferior_ptid.lwp ();
if (tid == 0)
tid = inferior_ptid.pid (); /* Not a threaded program. */
lp_priv->per_info_changed = 0;
- tid = ptid_get_lwp (ptid_of_lwp (lp));
+ tid = ptid_of_lwp (lp).lwp ();
if (tid == 0)
tid = pid;
if (!target_thread_alive (lwp))
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)
return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK)
ptid_get_tid (ptid));
else if (lwp.pid () != -2)
xsnprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)",
- ptid_get_tid (ptid), ptid_get_lwp (lwp));
+ ptid_get_tid (ptid), lwp.lwp ());
else
xsnprintf (buf, sizeof (buf), "Thread %ld ",
ptid_get_tid (ptid));
}
- else if (ptid_get_lwp (ptid) != 0)
- xsnprintf (buf, sizeof (buf), "LWP %ld ", ptid_get_lwp (ptid));
+ else if (ptid.lwp () != 0)
+ xsnprintf (buf, sizeof (buf), "LWP %ld ", ptid.lwp ());
else
xsnprintf (buf, sizeof (buf), "process %d ", ptid.pid ());
/* Check whether we're printing an LWP (gdb thread) or a
process. */
- pid = ptid_get_lwp (ptid);
+ pid = ptid.lwp ();
if (pid != 0)
{
/* A thread. */
- xsnprintf (buf, sizeof buf, "LWP %ld", ptid_get_lwp (ptid));
+ xsnprintf (buf, sizeof buf, "LWP %ld", ptid.lwp ());
return buf;
}
{
PTRACE_TYPE_RET res;
- int tid = ptid_get_lwp (inferior_ptid);
+ int tid = inferior_ptid.lwp ();
if (tid == 0)
tid = inferior_ptid.pid ();
/ sizeof (PTRACE_TYPE_RET));
PTRACE_TYPE_RET *buffer;
- int tid = ptid_get_lwp (inferior_ptid);
+ int tid = inferior_ptid.lwp ();
if (tid == 0)
tid = inferior_ptid.pid ();
/ sizeof (PTRACE_TYPE_RET));
PTRACE_TYPE_RET *buffer;
- int tid = ptid_get_lwp (inferior_ptid);
+ int tid = inferior_ptid.lwp ();
if (tid == 0)
tid = inferior_ptid.pid ();
int fd;
ULONGEST addr;
- int tid = ptid_get_lwp (ptid);
+ int tid = ptid.lwp ();
if (tid == 0)
tid = ptid.pid ();
uint64_t xcr0_features_bits;
/* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = inferior_ptid.lwp ();
if (tid == 0)
tid = inferior_ptid.pid (); /* Not a threaded program. */
static void
fetch_gregs (struct regcache *regcache, int regnum)
{
- int tid = ptid_get_lwp (regcache->ptid ());
+ int tid = regcache->ptid ().lwp ();
gdb_gregset_t regs;
int areg;
static void
store_gregs (struct regcache *regcache, int regnum)
{
- int tid = ptid_get_lwp (regcache->ptid ());
+ int tid = regcache->ptid ().lwp ();
gdb_gregset_t regs;
int areg;
static void
fetch_xtregs (struct regcache *regcache, int regnum)
{
- int tid = ptid_get_lwp (regcache->ptid ());
+ int tid = regcache->ptid ().lwp ();
const xtensa_regtable_t *ptr;
char xtregs [XTENSA_ELF_XTREG_SIZE];
static void
store_xtregs (struct regcache *regcache, int regnum)
{
- int tid = ptid_get_lwp (regcache->ptid ());
+ int tid = regcache->ptid ().lwp ();
const xtensa_regtable_t *ptr;
char xtregs [XTENSA_ELF_XTREG_SIZE];