diff options
52 files changed, 263 insertions, 219 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ed89119..1cebccc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,49 @@ 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. * common/ptid.h (ptid_get_pid): Don't declare. * aarch64-linux-nat.c: Update. diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 2366eaf..43af99d 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -212,7 +212,7 @@ fetch_gregs_from_thread (struct regcache *regcache) 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) @@ -249,7 +249,7 @@ store_gregs_to_thread (const struct regcache *regcache) /* 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) @@ -292,7 +292,7 @@ fetch_fpregs_from_thread (struct regcache *regcache) and arm. */ gdb_static_assert (sizeof regs >= VFP_REGS_SIZE); - tid = ptid_get_lwp (regcache->ptid ()); + tid = regcache->ptid ().lwp (); iovec.iov_base = ®s; @@ -338,7 +338,7 @@ store_fpregs_to_thread (const struct regcache *regcache) /* 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; @@ -394,7 +394,7 @@ static void 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 ()); } @@ -406,7 +406,7 @@ store_sveregs_to_thread (struct regcache *regcache) { 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); @@ -597,7 +597,7 @@ aarch64_linux_nat_target::read_description () 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; diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 7e57d24..8c45879 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -1204,7 +1204,7 @@ info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf) /* 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) diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 91be6d7..c8791bd 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -681,9 +681,9 @@ ptid_cmp (ptid_t ptid1, ptid_t ptid2) 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; @@ -1050,14 +1050,14 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig) 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) diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index 588c9b5..bc2412b 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -148,7 +148,7 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum) 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. */ @@ -226,7 +226,7 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum) 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. */ diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 8f9416e..3c552ec 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -119,7 +119,7 @@ fetch_fpregs (struct regcache *regcache) 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) @@ -155,7 +155,7 @@ store_fpregs (const struct regcache *regcache) 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) @@ -209,7 +209,7 @@ fetch_regs (struct regcache *regcache) 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) { @@ -236,7 +236,7 @@ store_regs (const struct regcache *regcache) 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) @@ -284,7 +284,7 @@ fetch_wmmx_regs (struct regcache *regcache) 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) @@ -309,7 +309,7 @@ store_wmmx_regs (const struct regcache *regcache) 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) @@ -344,7 +344,7 @@ fetch_vfp_regs (struct regcache *regcache) 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) { @@ -373,7 +373,7 @@ store_vfp_regs (const struct regcache *regcache) 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) { @@ -539,7 +539,7 @@ arm_linux_nat_target::read_description () { 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); @@ -576,7 +576,7 @@ arm_linux_nat_target::read_description () /* 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 @@ -622,7 +622,7 @@ arm_linux_get_hwbp_cap (void) 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 @@ -1250,7 +1250,7 @@ arm_linux_nat_target::low_prepare_to_resume (struct lwp_info *lwp) 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; diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c index 0b0a703..85cb4ca 100644 --- a/gdb/common/ptid.c +++ b/gdb/common/ptid.c @@ -28,14 +28,6 @@ ptid_t minus_one_ptid = ptid_t::make_minus_one (); /* 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) { return ptid.tid (); diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h index 6747e7a..5eeecdd 100644 --- a/gdb/common/ptid.h +++ b/gdb/common/ptid.h @@ -156,10 +156,6 @@ extern ptid_t minus_one_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); diff --git a/gdb/corelow.c b/gdb/corelow.c index ff0526d..153afd8 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -1005,7 +1005,7 @@ core_target::pid_to_str (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)); diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index f88d6a0..8ce55c1 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -814,7 +814,7 @@ fbsd_nat_target::thread_alive (ptid_t ptid) { 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 @@ -834,7 +834,7 @@ fbsd_nat_target::pid_to_str (ptid_t ptid) { lwpid_t lwp; - lwp = ptid_get_lwp (ptid); + lwp = ptid.lwp (); if (lwp != 0) { static char buf[64]; @@ -857,7 +857,7 @@ fbsd_nat_target::thread_name (struct thread_info *thr) 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 @@ -1100,7 +1100,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) 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)) { @@ -1113,12 +1113,12 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) 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")); } } @@ -1133,7 +1133,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) 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; diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index e26b876..9cea009 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -301,9 +301,9 @@ fbsd_core_pid_to_str (struct gdbarch *gdbarch, ptid_t 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; } @@ -320,7 +320,7 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr) 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 @@ -477,7 +477,7 @@ fbsd_collect_thread_registers (const struct regcache *regcache, 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, diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 5aee98c..602d4f1 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -3,6 +3,18 @@ * 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. + * linux-mips-low.c: Update. + * lynx-low.c: Update. * mem-break.c: Update. * nto-low.c: Update. * remote-utils.c: Update. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 99a7e16..a290b5b 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -529,7 +529,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat) { 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 ()); } @@ -1052,7 +1052,7 @@ int 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) @@ -1140,7 +1140,7 @@ attach_proc_task_lwp_callback (ptid_t ptid) /* 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) @@ -1324,7 +1324,7 @@ kill_wait_lwp (struct lwp_info *lwp) { 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; @@ -4548,7 +4548,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n) 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) diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c index f61c294..2194af6 100644 --- a/gdb/gdbserver/linux-mips-low.c +++ b/gdb/gdbserver/linux-mips-low.c @@ -450,7 +450,7 @@ mips_linux_prepare_to_resume (struct lwp_info *lwp) 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)) diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c index b637ef9..8d79ab1 100644 --- a/gdb/gdbserver/lynx-low.c +++ b/gdb/gdbserver/lynx-low.c @@ -93,7 +93,7 @@ lynx_ptid_get_tid (ptid_t ptid) { /* 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 diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c index 6a05d2b..21f6da6 100644 --- a/gdb/gdbserver/nto-low.c +++ b/gdb/gdbserver/nto-low.c @@ -92,12 +92,12 @@ nto_set_thread (ptid_t ptid) 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)) @@ -213,7 +213,7 @@ do_attach (pid_t pid) 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 @@ -431,8 +431,8 @@ nto_thread_alive (ptid_t ptid) 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 diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 400c2be..ac57ce5 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -492,7 +492,7 @@ write_ptid (char *buf, ptid_t ptid) else buf += sprintf (buf, "p%x.", pid); } - tid = ptid_get_lwp (ptid); + tid = ptid.lwp (); if (tid < 0) buf += sprintf (buf, "-%x", -tid); else diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 28bc9de..5c24315 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -2700,7 +2700,7 @@ visit_actioned_threads (thread_info *thread, || 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; diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c index 3436d39..b3980e7 100644 --- a/gdb/gdbserver/spu-low.c +++ b/gdb/gdbserver/spu-low.c @@ -66,7 +66,7 @@ fetch_ppc_register (int regno) { 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 @@ -151,7 +151,7 @@ fetch_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len) / 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)) @@ -176,7 +176,7 @@ store_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len) / 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); @@ -241,7 +241,7 @@ spu_proc_xfer_spu (const char *annex, unsigned char *readbuf, 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; @@ -409,7 +409,7 @@ spu_resume (struct thread_resume *resume_info, size_t n) 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"); } diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index 400d458..aff316d 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -321,9 +321,9 @@ target_pid_to_str (ptid_t ptid) 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 ()); diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c index 80125ee..7d4bfb6 100644 --- a/gdb/gdbserver/thread-db.c +++ b/gdb/gdbserver/thread-db.c @@ -167,7 +167,7 @@ find_one_thread (ptid_t ptid) 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); diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index c7c7e89..f256a82 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -1620,7 +1620,7 @@ rewait: 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) { @@ -2049,7 +2049,7 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig) 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!"), @@ -2060,7 +2060,7 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig) 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)); @@ -2293,7 +2293,7 @@ gnu_nat_target::thread_alive (ptid_t ptid) { inf_update_procs (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) { 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) @@ -2818,7 +2818,7 @@ cur_thread (void) { 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; @@ -3018,7 +3018,7 @@ set_sig_thread_cmd (const char *args, int from_tty) 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 ()); } } diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c index 20ae5a3..ed75ea3 100644 --- a/gdb/i386-cygwin-tdep.c +++ b/gdb/i386-cygwin-tdep.c @@ -183,9 +183,9 @@ i386_windows_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid) { 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; } diff --git a/gdb/i386-gnu-nat.c b/gdb/i386-gnu-nat.c index 9875d81..ca30eb6 100644 --- a/gdb/i386-gnu-nat.c +++ b/gdb/i386-gnu-nat.c @@ -113,7 +113,7 @@ gnu_fetch_registers (struct target_ops *ops, /* 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)); @@ -205,7 +205,7 @@ gnu_store_registers (struct target_ops *ops, /* 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)); @@ -392,7 +392,7 @@ i386_gnu_dr_get_reg (ptid_t ptid, int regnum) /* 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]; diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 897a21f..fcd014b 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -647,7 +647,7 @@ static const unsigned char linux_syscall[] = { 0xcd, 0x80 }; 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) diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index 49ae702..1d39ec5 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -553,7 +553,7 @@ store_debug_register (ptid_t ptid, int idx, long val) { int tid; - tid = ptid_get_lwp (ptid); + tid = ptid.lwp (); if (tid == 0) tid = ptid.pid (); diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index bdea7f1..d1c9a90 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -325,7 +325,7 @@ get_ptrace_pid (ptid_t ptid) /* 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; diff --git a/gdb/infrun.c b/gdb/infrun.c index f5c6ac3..b3a6a38 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3423,14 +3423,14 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid, 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 ()); @@ -4377,7 +4377,7 @@ save_waitstatus (struct thread_info *tp, struct target_waitstatus *ws) "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)); } @@ -4614,7 +4614,7 @@ stop_all_threads (void) "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)); } diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index 4b7e177..1cbaca5 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -723,7 +723,7 @@ checkpoint_command (const char *args, int from_tty) 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"), diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index cc03a5d..d06bf77 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -457,8 +457,8 @@ linux_nat_target::follow_fork (int follow_child, int detach_fork) == 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); @@ -668,7 +668,7 @@ static hashval_t 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); } @@ -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 *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. */ @@ -936,7 +936,7 @@ find_lwp_pid (ptid_t ptid) struct lwp_info dummy; if (ptid_lwp_p (ptid)) - lwp = ptid_get_lwp (ptid); + lwp = ptid.lwp (); else lwp = ptid.pid (); @@ -1018,7 +1018,7 @@ exit_lwp (struct lwp_info *lp) 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)) @@ -1104,7 +1104,7 @@ attach_proc_task_lwp_callback (ptid_t ptid) 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) { @@ -1235,7 +1235,7 @@ linux_nat_target::attach (const char *args, int from_tty) internal_error (__FILE__, __LINE__, _("unexpected status %d for PID %ld"), - status, (long) ptid_get_lwp (ptid)); + status, (long) ptid.lwp ()); } lp->stopped = 1; @@ -1316,7 +1316,7 @@ get_detach_signal (struct lwp_info *lp) 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; } } @@ -1358,7 +1358,7 @@ get_detach_signal (struct lwp_info *lp) 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)); @@ -1450,7 +1450,7 @@ detach_callback (struct lwp_info *lp, void *data) /* We don't actually detach from the thread group leader just yet. If the thread group exits, we must reap the zombie clone lwps before we're able to reap the leader. */ - if (ptid_get_lwp (lp->ptid) != lp->ptid.pid ()) + if (lp->ptid.lwp () != lp->ptid.pid ()) detach_one_lwp (lp, NULL); return 0; } @@ -1557,7 +1557,7 @@ check_ptrace_stopped_lwp_gone (struct lwp_info *lp) 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; @@ -1831,10 +1831,10 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping) "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; } @@ -1864,7 +1864,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping) == TARGET_WAITKIND_SYSCALL_ENTRY ? "entry" : "return", syscall_number, - ptid_get_lwp (lp->ptid)); + lp->ptid.lwp ()); return 0; } @@ -1875,7 +1875,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping) lp->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY ? "entry" : "return", syscall_number, - ptid_get_lwp (lp->ptid)); + lp->ptid.lwp ()); } else { @@ -1901,7 +1901,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping) "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; } @@ -1925,7 +1925,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping) 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); @@ -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 GDB's list. */ - target_post_attach (ptid_get_lwp (new_lp->ptid)); + target_post_attach (new_lp->ptid.lwp ()); add_thread (new_lp->ptid); } @@ -2049,7 +2049,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status) 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; } @@ -2070,7 +2070,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int 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 @@ -2091,7 +2091,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status) 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; @@ -2101,7 +2101,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status) 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; } @@ -2152,7 +2152,7 @@ wait_lwp (struct lwp_info *lp) 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 @@ -2181,8 +2181,8 @@ wait_lwp (struct lwp_info *lp) Therefore always use WNOHANG with sigsuspend - it is equivalent to waiting waitpid but linux_proc_pid_is_zombie is safe this way. */ - if (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) @@ -2205,7 +2205,7 @@ wait_lwp (struct lwp_info *lp) if (!thread_dead) { - gdb_assert (pid == ptid_get_lwp (lp->ptid)); + gdb_assert (pid == lp->ptid.lwp ()); if (debug_linux_nat) { @@ -2219,7 +2219,7 @@ wait_lwp (struct lwp_info *lp) 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", @@ -2254,7 +2254,7 @@ wait_lwp (struct lwp_info *lp) 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; } @@ -2307,7 +2307,7 @@ stop_callback (struct lwp_info *lp, void *data) 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, @@ -2397,7 +2397,7 @@ maybe_clear_ignore_sigint (struct lwp_info *lp) 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, @@ -2496,7 +2496,7 @@ stop_wait_callback (struct lwp_info *lp, void *data) 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, @@ -2976,7 +2976,7 @@ linux_nat_filter_event (int lwpid, int status) 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; } @@ -3035,7 +3035,7 @@ linux_nat_filter_event (int lwpid, int status) 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; @@ -3658,7 +3658,7 @@ kill_wait_one_lwp (pid_t pid) 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; } @@ -3667,7 +3667,7 @@ kill_callback (struct lwp_info *lp, void *data) 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; } @@ -3689,7 +3689,7 @@ kill_unfollowed_fork_children (struct inferior *inf) { 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); @@ -3782,7 +3782,7 @@ linux_xfer_siginfo (enum target_object object, 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 (); @@ -3934,10 +3934,10 @@ linux_nat_target::pid_to_str (ptid_t ptid) 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; } @@ -3983,7 +3983,7 @@ linux_proc_xfer_partial (enum target_object object, /* 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) @@ -4076,7 +4076,7 @@ linux_proc_xfer_spu (enum target_object object, char buf[128]; int fd = 0; int ret = -1; - int pid = ptid_get_lwp (inferior_ptid); + int pid = inferior_ptid.lwp (); if (!annex) { @@ -4441,7 +4441,7 @@ linux_nat_stop_lwp (struct lwp_info *lwp, void *data) 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; } @@ -4498,7 +4498,7 @@ linux_nat_target::thread_address_space (ptid_t ptid) 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. */ @@ -4644,7 +4644,7 @@ linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo) { int pid; - pid = ptid_get_lwp (ptid); + pid = ptid.lwp (); if (pid == 0) pid = ptid.pid (); diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index da8a1f0..12455a7 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -419,9 +419,9 @@ linux_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid) { 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; } @@ -1632,7 +1632,7 @@ linux_collect_thread_registers (const struct regcache *regcache, 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); diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 11c07dc..de9a48c 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -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 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) @@ -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); 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; } diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 8d87dc8..21b1f58 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -460,7 +460,7 @@ mips_linux_nat_target::read_description () { int tid; - tid = ptid_get_lwp (inferior_ptid); + tid = inferior_ptid.lwp (); if (tid == 0) tid = inferior_ptid.pid (); @@ -543,7 +543,7 @@ mips_linux_nat_target::can_use_hw_breakpoint (enum bptype type, 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; @@ -584,7 +584,7 @@ mips_linux_nat_target::stopped_by_watchpoint () 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; @@ -619,7 +619,7 @@ mips_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) 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; @@ -641,7 +641,7 @@ write_watchpoint_regs (void) 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")); } @@ -680,7 +680,7 @@ mips_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len, 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; diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c index 3de3e5b..18b5af2 100644 --- a/gdb/nat/aarch64-linux-hw-point.c +++ b/gdb/nat/aarch64-linux-hw-point.c @@ -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 *) 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); diff --git a/gdb/nat/aarch64-linux.c b/gdb/nat/aarch64-linux.c index c3c29a0..0f2c801 100644 --- a/gdb/nat/aarch64-linux.c +++ b/gdb/nat/aarch64-linux.c @@ -45,7 +45,7 @@ aarch64_linux_prepare_to_resume (struct lwp_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 ()); diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c index b2c30b3..83afe88 100644 --- a/gdb/nat/linux-btrace.c +++ b/gdb/nat/linux-btrace.c @@ -469,7 +469,7 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf) bts->attr.exclude_hv = 1; bts->attr.exclude_idle = 1; - pid = ptid_get_lwp (ptid); + pid = ptid.lwp (); if (pid == 0) pid = ptid.pid (); @@ -585,7 +585,7 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf) size_t pages; int pid, pg; - pid = ptid_get_lwp (ptid); + pid = ptid.lwp (); if (pid == 0) pid = ptid.pid (); diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c index 358a89e..25e895d 100644 --- a/gdb/nat/linux-osdata.c +++ b/gdb/nat/linux-osdata.c @@ -70,7 +70,7 @@ linux_common_core_of_thread (ptid_t ptid) 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; diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c index a672cdf..20708fa 100644 --- a/gdb/nat/linux-procfs.c +++ b/gdb/nat/linux-procfs.c @@ -240,7 +240,7 @@ linux_proc_tid_get_name (ptid_t ptid) 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); diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c index d362c30..8aa8717 100644 --- a/gdb/nat/x86-linux-dregs.c +++ b/gdb/nat/x86-linux-dregs.c @@ -44,7 +44,7 @@ x86_linux_dr_get (ptid_t ptid, int regnum) 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); @@ -62,7 +62,7 @@ x86_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) 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); diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c index a3058b0..e654d33 100644 --- a/gdb/obsd-nat.c +++ b/gdb/obsd-nat.c @@ -38,11 +38,11 @@ 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; } @@ -66,7 +66,7 @@ obsd_nat_target::update_thread_list () 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); @@ -154,7 +154,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, 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); diff --git a/gdb/ppc-fbsd-nat.c b/gdb/ppc-fbsd-nat.c index 44661e9..5d2d391 100644 --- a/gdb/ppc-fbsd-nat.c +++ b/gdb/ppc-fbsd-nat.c @@ -127,7 +127,7 @@ void 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")); @@ -153,7 +153,7 @@ void 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")); diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 09cb247..9719a0e 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -1224,7 +1224,7 @@ have_ptrace_hwdebug_interface (void) { int tid; - tid = ptid_get_lwp (inferior_ptid); + tid = inferior_ptid.lwp (); if (tid == 0) 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 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 (); @@ -1508,7 +1508,7 @@ ppc_linux_nat_target::insert_hw_breakpoint (struct gdbarch *gdbarch, } ALL_LWPS (lp) - hwdebug_insert_point (&p, ptid_get_lwp (lp->ptid)); + hwdebug_insert_point (&p, lp->ptid.lwp ()); return 0; } @@ -1544,7 +1544,7 @@ ppc_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, } ALL_LWPS (lp) - hwdebug_remove_point (&p, ptid_get_lwp (lp->ptid)); + hwdebug_remove_point (&p, lp->ptid.lwp ()); return 0; } @@ -1587,7 +1587,7 @@ ppc_linux_nat_target::insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, 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; } @@ -1615,7 +1615,7 @@ ppc_linux_nat_target::remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, 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; } @@ -1625,7 +1625,7 @@ static int 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; @@ -1879,7 +1879,7 @@ ppc_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len, 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; } @@ -1923,7 +1923,7 @@ ppc_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len, 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; @@ -1948,7 +1948,7 @@ ppc_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len, 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; } @@ -1956,7 +1956,7 @@ ppc_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len, { 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; @@ -1969,7 +1969,7 @@ ppc_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len, 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 ()) { @@ -2008,7 +2008,7 @@ static void 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; @@ -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. */ 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. */ @@ -2183,7 +2183,7 @@ ppc_linux_nat_target::auxv_parse (gdb_byte **readptr, 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 (); @@ -2210,7 +2210,7 @@ ppc_linux_nat_target::auxv_parse (gdb_byte **readptr, 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 (); diff --git a/gdb/procfs.c b/gdb/procfs.c index 77a679c..ad6549c 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -1635,17 +1635,17 @@ procfs_find_LDT_entry (ptid_t ptid) 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. */ @@ -2065,7 +2065,7 @@ procfs_target::fetch_registers (struct regcache *regcache, int regnum) 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); @@ -2114,7 +2114,7 @@ procfs_target::store_registers (struct regcache *regcache, int regnum) 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); @@ -2533,9 +2533,9 @@ wait_again: 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. */ @@ -2752,7 +2752,7 @@ procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo) { /* 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) @@ -3178,7 +3178,7 @@ procfs_target::thread_alive (ptid_t ptid) 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; @@ -3203,10 +3203,10 @@ procfs_target::pid_to_str (ptid_t ptid) { 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; } @@ -3764,7 +3764,7 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid, 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 diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c index 19b5bfa..7e409bb 100644 --- a/gdb/python/py-infthread.c +++ b/gdb/python/py-infthread.c @@ -267,7 +267,7 @@ gdbpy_create_ptid_object (ptid_t ptid) 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)); diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index f748e87..fccb37e 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -147,7 +147,7 @@ is_ravenscar_task (ptid_t ptid) 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, @@ -171,7 +171,7 @@ ravenscar_get_thread_base_cpu (ptid_t ptid) 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; diff --git a/gdb/remote.c b/gdb/remote.c index 57a57ac..0d64458 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2782,7 +2782,7 @@ remote_thread_always_alive (ptid_t ptid) /* 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. */ @@ -2924,7 +2924,7 @@ remote_target::write_ptid (char *buf, const char *endbuf, ptid_t ptid) 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 @@ -3839,7 +3839,7 @@ remote_target::extra_thread_info (thread_info *tp) _("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; @@ -3881,7 +3881,7 @@ remote_target::extra_thread_info (thread_info *tp) 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) { @@ -11468,14 +11468,14 @@ remote_target::pid_to_str (ptid_t ptid) 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; } } diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index b112a3d..2c60562 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -258,7 +258,7 @@ static int 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. */ @@ -730,7 +730,7 @@ s390_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp) 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; diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 44a98a1..c554057 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -348,7 +348,7 @@ lwp_to_thread (ptid_t lwp) 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) @@ -1014,13 +1014,13 @@ sol_thread_target::pid_to_str (ptid_t ptid) 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 ()); diff --git a/gdb/sol2-tdep.c b/gdb/sol2-tdep.c index 71e813b..ba37fe1 100644 --- a/gdb/sol2-tdep.c +++ b/gdb/sol2-tdep.c @@ -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 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; } diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c index 65b434e..c2d6569 100644 --- a/gdb/spu-linux-nat.c +++ b/gdb/spu-linux-nat.c @@ -69,7 +69,7 @@ fetch_ppc_register (int regno) { PTRACE_TYPE_RET res; - int tid = ptid_get_lwp (inferior_ptid); + int tid = inferior_ptid.lwp (); if (tid == 0) tid = inferior_ptid.pid (); @@ -154,7 +154,7 @@ fetch_ppc_memory (ULONGEST memaddr, gdb_byte *myaddr, int len) / 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 (); @@ -184,7 +184,7 @@ store_ppc_memory (ULONGEST memaddr, const gdb_byte *myaddr, int len) / 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 (); @@ -422,7 +422,7 @@ spu_linux_nat_target::post_startup_inferior (ptid_t ptid) int fd; ULONGEST addr; - int tid = ptid_get_lwp (ptid); + int tid = ptid.lwp (); if (tid == 0) tid = ptid.pid (); diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c index b1a96c1..fe6598e 100644 --- a/gdb/x86-linux-nat.c +++ b/gdb/x86-linux-nat.c @@ -114,7 +114,7 @@ x86_linux_nat_target::read_description () 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. */ diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c index 5ac29ee..007a5c3 100644 --- a/gdb/xtensa-linux-nat.c +++ b/gdb/xtensa-linux-nat.c @@ -202,7 +202,7 @@ supply_fpregset (struct regcache *regcache, 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; @@ -221,7 +221,7 @@ fetch_gregs (struct regcache *regcache, int regnum) 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; @@ -249,7 +249,7 @@ static int xtreg_high; 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]; @@ -264,7 +264,7 @@ fetch_xtregs (struct regcache *regcache, int regnum) 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]; |