This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Remove ptid_get_pid
- From: Tom Tromey <tromey at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 3 Jul 2018 17:39:11 -0000
- Subject: [binutils-gdb] Remove ptid_get_pid
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e99b03dcf42606425eab8bd12eadb8aa4007f35a
commit e99b03dcf42606425eab8bd12eadb8aa4007f35a
Author: Tom Tromey <tom@tromey.com>
Date: Mon Jun 11 12:05:27 2018 -0600
Remove ptid_get_pid
This removes ptid_get_pid in favor of calling the ptid_t::pid method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_pid): Remove.
* common/ptid.h (ptid_get_pid): Don't declare.
* aarch64-linux-nat.c: Update.
* ada-lang.c: Update.
* aix-thread.c: Update.
* alpha-bsd-nat.c: Update.
* amd64-fbsd-nat.c: Update.
* amd64-linux-nat.c: Update.
* arm-linux-nat.c: Update.
* arm-nbsd-nat.c: Update.
* auxv.c: Update.
* break-catch-syscall.c: Update.
* breakpoint.c: Update.
* bsd-uthread.c: Update.
* corelow.c: Update.
* ctf.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* fbsd-tdep.c: Update.
* gcore.c: Update.
* gnu-nat.c: Update.
* hppa-nbsd-nat.c: Update.
* hppa-obsd-nat.c: Update.
* i386-fbsd-nat.c: Update.
* ia64-linux-nat.c: Update.
* inf-ptrace.c: Update.
* infcmd.c: Update.
* inferior.c: Update.
* inferior.h: Update.
* inflow.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-tdep.c: Update.
* linux-thread-db.c: Update.
* m68k-bsd-nat.c: Update.
* mi/mi-interp.c: Update.
* mi/mi-main.c: Update.
* mips-linux-nat.c: Update.
* mips-nbsd-nat.c: Update.
* mips64-obsd-nat.c: Update.
* nat/aarch64-linux-hw-point.c: Update.
* nat/aarch64-linux.c: Update.
* nat/linux-btrace.c: Update.
* nat/linux-osdata.c: Update.
* nat/linux-procfs.c: Update.
* nat/x86-linux-dregs.c: Update.
* nto-procfs.c: Update.
* obsd-nat.c: Update.
* ppc-linux-nat.c: Update.
* ppc-nbsd-nat.c: Update.
* ppc-obsd-nat.c: Update.
* proc-service.c: Update.
* procfs.c: Update.
* python/py-inferior.c: Update.
* python/py-infthread.c: Update.
* ravenscar-thread.c: Update.
* record.c: Update.
* remote-sim.c: Update.
* remote.c: Update.
* rs6000-nat.c: Update.
* s390-linux-nat.c: Update.
* sh-nbsd-nat.c: Update.
* sol-thread.c: Update.
* sparc-nat.c: Update.
* sparc64-tdep.c: Update.
* spu-linux-nat.c: Update.
* spu-tdep.c: Update.
* target-debug.h: Update.
* target.c: Update.
* thread.c: Update.
* tid-parse.c: Update.
* tracefile-tfile.c: Update.
* vax-bsd-nat.c: Update.
* windows-nat.c: Update.
* x86-linux-nat.c: Update.
* x86-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* linux-mips-low.c: Update.
* lynx-low.c: Update.
* mem-break.c: Update.
* nto-low.c: Update.
* remote-utils.c: Update.
* server.c: Update.
* spu-low.c: Update.
* target.c: Update.
* tracepoint.c: Update.
Diff:
---
gdb/ChangeLog | 80 ++++++++++++++++++++++++++++++++++++++++
gdb/aarch64-linux-nat.c | 16 ++++----
gdb/ada-lang.c | 2 +-
gdb/aix-thread.c | 20 +++++-----
gdb/alpha-bsd-nat.c | 12 +++---
gdb/amd64-fbsd-nat.c | 4 +-
gdb/amd64-linux-nat.c | 4 +-
gdb/arm-linux-nat.c | 10 ++---
gdb/arm-nbsd-nat.c | 20 +++++-----
gdb/auxv.c | 2 +-
gdb/break-catch-syscall.c | 4 +-
gdb/breakpoint.c | 22 +++++------
gdb/bsd-uthread.c | 6 +--
gdb/common/ptid.c | 8 ----
gdb/common/ptid.h | 4 --
gdb/darwin-nat.c | 12 +++---
gdb/fbsd-nat.c | 30 +++++++--------
gdb/fbsd-tdep.c | 4 +-
gdb/gcore.c | 2 +-
gdb/gdbserver/ChangeLog | 13 +++++++
gdb/gdbserver/linux-low.c | 8 ++--
gdb/gdbserver/linux-mips-low.c | 2 +-
gdb/gdbserver/lynx-low.c | 4 +-
gdb/gdbserver/mem-break.c | 2 +-
gdb/gdbserver/nto-low.c | 8 ++--
gdb/gdbserver/remote-utils.c | 6 +--
gdb/gdbserver/server.c | 8 ++--
gdb/gdbserver/spu-low.c | 2 +-
gdb/gdbserver/target.c | 8 ++--
gdb/gdbserver/tracepoint.c | 2 +-
gdb/gnu-nat.c | 2 +-
gdb/hppa-nbsd-nat.c | 4 +-
gdb/hppa-obsd-nat.c | 2 +-
gdb/i386-fbsd-nat.c | 6 +--
gdb/ia64-linux-nat.c | 2 +-
gdb/inf-ptrace.c | 22 +++++------
gdb/infcmd.c | 10 ++---
gdb/inferior.c | 6 +--
gdb/inferior.h | 2 +-
gdb/inflow.c | 2 +-
gdb/infrun.c | 28 +++++++-------
gdb/linux-fork.c | 28 +++++++-------
gdb/linux-nat.c | 64 ++++++++++++++++----------------
gdb/linux-tdep.c | 6 +--
gdb/linux-thread-db.c | 34 ++++++++---------
gdb/m68k-bsd-nat.c | 4 +-
gdb/mi/mi-interp.c | 2 +-
gdb/mi/mi-main.c | 8 ++--
gdb/mips-linux-nat.c | 2 +-
gdb/mips-nbsd-nat.c | 4 +-
gdb/mips64-obsd-nat.c | 4 +-
gdb/nat/aarch64-linux-hw-point.c | 2 +-
gdb/nat/aarch64-linux.c | 2 +-
gdb/nat/linux-btrace.c | 4 +-
gdb/nat/linux-osdata.c | 2 +-
gdb/nat/linux-procfs.c | 4 +-
gdb/nat/x86-linux-dregs.c | 6 +--
gdb/nto-procfs.c | 22 +++++------
gdb/obsd-nat.c | 8 ++--
gdb/ppc-linux-nat.c | 8 ++--
gdb/ppc-nbsd-nat.c | 4 +-
gdb/ppc-obsd-nat.c | 4 +-
gdb/proc-service.c | 2 +-
gdb/procfs.c | 74 ++++++++++++++++++-------------------
gdb/python/py-infthread.c | 2 +-
gdb/ravenscar-thread.c | 6 +--
gdb/record.c | 2 +-
gdb/remote-sim.c | 6 +--
gdb/remote.c | 44 +++++++++++-----------
gdb/rs6000-nat.c | 12 +++---
gdb/s390-linux-nat.c | 18 ++++-----
gdb/sh-nbsd-nat.c | 4 +-
gdb/sol-thread.c | 50 ++++++++++++-------------
gdb/sparc-nat.c | 2 +-
gdb/sparc64-tdep.c | 22 +++++------
gdb/spu-linux-nat.c | 16 ++++----
gdb/spu-tdep.c | 4 +-
gdb/target-debug.h | 2 +-
gdb/target.c | 6 +--
gdb/thread.c | 14 +++----
gdb/tid-parse.c | 2 +-
gdb/vax-bsd-nat.c | 4 +-
gdb/windows-nat.c | 8 ++--
gdb/x86-linux-nat.c | 4 +-
gdb/x86-nat.c | 18 ++++-----
85 files changed, 518 insertions(+), 437 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index da383cd..ed89119 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,85 @@
2018-07-03 Tom Tromey <tom@tromey.com>
+ * common/ptid.c (ptid_get_pid): Remove.
+ * common/ptid.h (ptid_get_pid): Don't declare.
+ * aarch64-linux-nat.c: Update.
+ * ada-lang.c: Update.
+ * aix-thread.c: Update.
+ * alpha-bsd-nat.c: Update.
+ * amd64-fbsd-nat.c: Update.
+ * amd64-linux-nat.c: Update.
+ * arm-linux-nat.c: Update.
+ * arm-nbsd-nat.c: Update.
+ * auxv.c: Update.
+ * break-catch-syscall.c: Update.
+ * breakpoint.c: Update.
+ * bsd-uthread.c: Update.
+ * corelow.c: Update.
+ * ctf.c: Update.
+ * darwin-nat.c: Update.
+ * fbsd-nat.c: Update.
+ * fbsd-tdep.c: Update.
+ * gcore.c: Update.
+ * gnu-nat.c: Update.
+ * hppa-nbsd-nat.c: Update.
+ * hppa-obsd-nat.c: Update.
+ * i386-fbsd-nat.c: Update.
+ * ia64-linux-nat.c: Update.
+ * inf-ptrace.c: Update.
+ * infcmd.c: Update.
+ * inferior.c: Update.
+ * inferior.h: Update.
+ * inflow.c: Update.
+ * infrun.c: Update.
+ * linux-fork.c: Update.
+ * linux-nat.c: Update.
+ * linux-tdep.c: Update.
+ * linux-thread-db.c: Update.
+ * m68k-bsd-nat.c: Update.
+ * mi/mi-interp.c: Update.
+ * mi/mi-main.c: Update.
+ * mips-linux-nat.c: Update.
+ * mips-nbsd-nat.c: Update.
+ * mips64-obsd-nat.c: Update.
+ * nat/aarch64-linux-hw-point.c: Update.
+ * nat/aarch64-linux.c: Update.
+ * nat/linux-btrace.c: Update.
+ * nat/linux-osdata.c: Update.
+ * nat/linux-procfs.c: Update.
+ * nat/x86-linux-dregs.c: Update.
+ * nto-procfs.c: Update.
+ * obsd-nat.c: Update.
+ * ppc-linux-nat.c: Update.
+ * ppc-nbsd-nat.c: Update.
+ * ppc-obsd-nat.c: Update.
+ * proc-service.c: Update.
+ * procfs.c: Update.
+ * python/py-inferior.c: Update.
+ * python/py-infthread.c: Update.
+ * ravenscar-thread.c: Update.
+ * record.c: Update.
+ * remote-sim.c: Update.
+ * remote.c: Update.
+ * rs6000-nat.c: Update.
+ * s390-linux-nat.c: Update.
+ * sh-nbsd-nat.c: Update.
+ * sol-thread.c: Update.
+ * sparc-nat.c: Update.
+ * sparc64-tdep.c: Update.
+ * spu-linux-nat.c: Update.
+ * spu-tdep.c: Update.
+ * target-debug.h: Update.
+ * target.c: Update.
+ * thread.c: Update.
+ * tid-parse.c: Update.
+ * tracefile-tfile.c: Update.
+ * vax-bsd-nat.c: Update.
+ * windows-nat.c: Update.
+ * x86-linux-nat.c: Update.
+ * x86-nat.c: Update.
+
+2018-07-03 Tom Tromey <tom@tromey.com>
+
* common/ptid.c (pid_to_ptid): Remove.
* common/ptid.h (pid_to_ptid): Don't declare.
* aix-thread.c: Update.
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index c9fd062..2366eaf 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -540,7 +540,7 @@ aarch64_linux_nat_target::low_new_fork (struct lwp_info *parent,
new process so that all breakpoints and watchpoints can be
removed together. */
- parent_pid = ptid_get_pid (parent->ptid);
+ parent_pid = parent->ptid.pid ();
parent_state = aarch64_get_debug_reg_state (parent_pid);
child_state = aarch64_get_debug_reg_state (child_pid);
*child_state = *parent_state;
@@ -566,8 +566,8 @@ ps_get_thread_area (struct ps_prochandle *ph,
void
aarch64_linux_nat_target::post_startup_inferior (ptid_t ptid)
{
- low_forget_process (ptid_get_pid (ptid));
- aarch64_linux_get_debug_reg_capacity (ptid_get_pid (ptid));
+ low_forget_process (ptid.pid ());
+ aarch64_linux_get_debug_reg_capacity (ptid.pid ());
linux_nat_target::post_startup_inferior (ptid);
}
@@ -687,7 +687,7 @@ aarch64_linux_nat_target::insert_hw_breakpoint (struct gdbarch *gdbarch,
int len;
const enum target_hw_bp_type type = hw_execute;
struct aarch64_debug_reg_state *state
- = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = aarch64_get_debug_reg_state (inferior_ptid.pid ());
gdbarch_breakpoint_from_pc (gdbarch, &addr, &len);
@@ -720,7 +720,7 @@ aarch64_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
int len = 4;
const enum target_hw_bp_type type = hw_execute;
struct aarch64_debug_reg_state *state
- = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = aarch64_get_debug_reg_state (inferior_ptid.pid ());
gdbarch_breakpoint_from_pc (gdbarch, &addr, &len);
@@ -753,7 +753,7 @@ aarch64_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
{
int ret;
struct aarch64_debug_reg_state *state
- = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = aarch64_get_debug_reg_state (inferior_ptid.pid ());
if (show_debug_regs)
fprintf_unfiltered (gdb_stdlog,
@@ -785,7 +785,7 @@ aarch64_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
{
int ret;
struct aarch64_debug_reg_state *state
- = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = aarch64_get_debug_reg_state (inferior_ptid.pid ());
if (show_debug_regs)
fprintf_unfiltered (gdb_stdlog,
@@ -831,7 +831,7 @@ aarch64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p)
return false;
/* Check if the address matches any watched address. */
- state = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+ state = aarch64_get_debug_reg_state (inferior_ptid.pid ());
for (i = aarch64_num_wp_regs - 1; i >= 0; --i)
{
const unsigned int offset
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 298adf7..89cbec3 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12108,7 +12108,7 @@ ada_exception_support_info_sniffer (void)
loaded. If it is not started, this may mean that the symbol is
in a shared library. */
- if (ptid_get_pid (inferior_ptid) == 0)
+ if (inferior_ptid.pid () == 0)
error (_("Unable to insert catchpoint. Try to start the program first."));
/* At this point, we know that we are debugging an Ada program and
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index b977862..91be6d7 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -325,7 +325,7 @@ pid_to_prc (ptid_t *ptidp)
ptid = *ptidp;
if (PD_TID (ptid))
- *ptidp = ptid_t (ptid_get_pid (ptid));
+ *ptidp = ptid_t (ptid.pid ());
}
/* pthdb callback: for <i> from 0 to COUNT, set SYMBOLS[<i>].addr to
@@ -673,9 +673,9 @@ ptid_cmp (ptid_t ptid1, ptid_t ptid2)
{
int pid1, pid2;
- if (ptid_get_pid (ptid1) < ptid_get_pid (ptid2))
+ if (ptid1.pid () < ptid2.pid ())
return -1;
- else if (ptid_get_pid (ptid1) > ptid_get_pid (ptid2))
+ else if (ptid1.pid () > ptid2.pid ())
return 1;
else if (ptid_get_tid (ptid1) < ptid_get_tid (ptid2))
return -1;
@@ -712,7 +712,7 @@ get_signaled_thread (void)
while (1)
{
- if (getthrds (ptid_get_pid (inferior_ptid), &thrinf,
+ if (getthrds (inferior_ptid.pid (), &thrinf,
sizeof (thrinf), &ktid, 1) != 1)
break;
@@ -795,7 +795,7 @@ sync_threadlists (void)
/* Apply differences between the two arrays to GDB's thread list. */
- infpid = ptid_get_pid (inferior_ptid);
+ infpid = inferior_ptid.pid ();
for (pi = gi = 0; pi < pcount || gi < gcount;)
{
if (pi == pcount)
@@ -1042,7 +1042,7 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
{
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
- inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid));
+ inferior_ptid = ptid_t (inferior_ptid.pid ());
beneath ()->resume (ptid, step, sig);
}
else
@@ -1082,11 +1082,11 @@ aix_thread_target::wait (ptid_t ptid, struct target_waitstatus *status,
pid_to_prc (&ptid);
- inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid));
+ inferior_ptid = ptid_t (inferior_ptid.pid ());
ptid = beneath ()->wait (ptid, status, options);
}
- if (ptid_get_pid (ptid) == -1)
+ if (ptid.pid () == -1)
return ptid_t (-1);
/* Check whether libpthdebug might be ready to be initialized. */
@@ -1722,7 +1722,7 @@ aix_thread_target::xfer_partial (enum target_object object,
{
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
- inferior_ptid = ptid_t (ptid_get_pid (inferior_ptid));
+ inferior_ptid = ptid_t (inferior_ptid.pid ());
return beneath ()->xfer_partial (object, annex, readbuf,
writebuf, offset, len, xfered_len);
}
@@ -1832,7 +1832,7 @@ aix_thread_target::extra_thread_info (struct thread_info *thread)
ptid_t
aix_thread_target::get_ada_task_ptid (long lwp, long thread)
{
- return ptid_t (ptid_get_pid (inferior_ptid), 0, thread);
+ return ptid_t (inferior_ptid.pid (), 0, thread);
}
diff --git a/gdb/alpha-bsd-nat.c b/gdb/alpha-bsd-nat.c
index 7a3fe9b..11550cc 100644
--- a/gdb/alpha-bsd-nat.c
+++ b/gdb/alpha-bsd-nat.c
@@ -98,7 +98,7 @@ alpha_bsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
struct reg gregs;
- if (ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()),
+ if (ptrace (PT_GETREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &gregs, 0) == -1)
perror_with_name (_("Couldn't get registers"));
@@ -112,7 +112,7 @@ alpha_bsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()),
+ if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
@@ -129,13 +129,13 @@ alpha_bsd_nat_target::store_registers (struct regcache *regcache, int regno)
if (regno == -1 || getregs_supplies (regno))
{
struct reg gregs;
- if (ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()),
+ if (ptrace (PT_GETREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &gregs, 0) == -1)
perror_with_name (_("Couldn't get registers"));
alphabsd_fill_reg (regcache, (char *) &gregs, regno);
- if (ptrace (PT_SETREGS, ptid_get_pid (regcache->ptid ()),
+ if (ptrace (PT_SETREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &gregs, 0) == -1)
perror_with_name (_("Couldn't write registers"));
@@ -148,13 +148,13 @@ alpha_bsd_nat_target::store_registers (struct regcache *regcache, int regno)
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()),
+ if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
alphabsd_fill_fpreg (regcache, (char *) &fpregs, regno);
- if (ptrace (PT_SETFPREGS, ptid_get_pid (regcache->ptid ()),
+ if (ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
diff --git a/gdb/amd64-fbsd-nat.c b/gdb/amd64-fbsd-nat.c
index f9b1bca..7c7c963 100644
--- a/gdb/amd64-fbsd-nat.c
+++ b/gdb/amd64-fbsd-nat.c
@@ -167,7 +167,7 @@ amd64_fbsd_nat_target::read_description ()
struct reg regs;
int is64;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, inferior_ptid.pid (),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
is64 = (regs.r_cs == GSEL (GUCODE_SEL, SEL_UPL));
@@ -176,7 +176,7 @@ amd64_fbsd_nat_target::read_description ()
{
struct ptrace_xstate_info info;
- if (ptrace (PT_GETXSTATE_INFO, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETXSTATE_INFO, inferior_ptid.pid (),
(PTRACE_TYPE_ARG3) &info, sizeof (info)) == 0)
{
x86bsd_xsave_len = info.xsave_len;
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 5a39fa8..588c9b5 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -150,7 +150,7 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
/* GNU/Linux LWP ID's are process ID's. */
tid = ptid_get_lwp (regcache->ptid ());
if (tid == 0)
- tid = ptid_get_pid (regcache->ptid ()); /* Not a threaded program. */
+ tid = regcache->ptid ().pid (); /* Not a threaded program. */
if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
{
@@ -228,7 +228,7 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
/* GNU/Linux LWP ID's are process ID's. */
tid = ptid_get_lwp (regcache->ptid ());
if (tid == 0)
- tid = ptid_get_pid (regcache->ptid ()); /* Not a threaded program. */
+ tid = regcache->ptid ().pid (); /* Not a threaded program. */
if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
{
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index b5ee3a9..8f9416e 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -993,7 +993,7 @@ arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint* bpt,
struct arm_linux_hw_breakpoint* bpts;
struct update_registers_data data;
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
pid_ptid = ptid_t (pid);
if (watchpoint)
@@ -1032,7 +1032,7 @@ arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt,
struct arm_linux_hw_breakpoint* bpts;
struct update_registers_data data;
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
pid_ptid = ptid_t (pid);
if (watchpoint)
@@ -1251,8 +1251,8 @@ arm_linux_nat_target::low_prepare_to_resume (struct lwp_info *lwp)
struct arch_lwp_info *arm_lwp_info = lwp->arch_private;
pid = ptid_get_lwp (lwp->ptid);
- bpts = arm_linux_get_debug_reg_state (ptid_get_pid (lwp->ptid))->bpts;
- wpts = arm_linux_get_debug_reg_state (ptid_get_pid (lwp->ptid))->wpts;
+ bpts = arm_linux_get_debug_reg_state (lwp->ptid.pid ())->bpts;
+ wpts = arm_linux_get_debug_reg_state (lwp->ptid.pid ())->wpts;
/* NULL means this is the main thread still going through the shell,
or, no watchpoint has been set yet. In that case, there's
@@ -1315,7 +1315,7 @@ arm_linux_nat_target::low_new_fork (struct lwp_info *parent, pid_t child_pid)
new process so that all breakpoints and watchpoints can be
removed together. */
- parent_pid = ptid_get_pid (parent->ptid);
+ parent_pid = parent->ptid.pid ();
parent_state = arm_linux_get_debug_reg_state (parent_pid);
child_state = arm_linux_get_debug_reg_state (child_pid);
*child_state = *parent_state;
diff --git a/gdb/arm-nbsd-nat.c b/gdb/arm-nbsd-nat.c
index 2a298ee..85811c7 100644
--- a/gdb/arm-nbsd-nat.c
+++ b/gdb/arm-nbsd-nat.c
@@ -82,7 +82,7 @@ fetch_register (struct regcache *regcache, int regno)
struct reg inferior_registers;
int ret;
- ret = ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()),
+ ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &inferior_registers, 0);
if (ret < 0)
@@ -131,7 +131,7 @@ fetch_regs (struct regcache *regcache)
int ret;
int regno;
- ret = ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()),
+ ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &inferior_registers, 0);
if (ret < 0)
@@ -149,7 +149,7 @@ fetch_fp_register (struct regcache *regcache, int regno)
struct fpreg inferior_fp_registers;
int ret;
- ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()),
+ ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
if (ret < 0)
@@ -179,7 +179,7 @@ fetch_fp_regs (struct regcache *regcache)
int ret;
int regno;
- ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()),
+ ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
if (ret < 0)
@@ -216,7 +216,7 @@ store_register (const struct regcache *regcache, int regno)
struct reg inferior_registers;
int ret;
- ret = ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()),
+ ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &inferior_registers, 0);
if (ret < 0)
@@ -274,7 +274,7 @@ store_register (const struct regcache *regcache, int regno)
break;
}
- ret = ptrace (PT_SETREGS, ptid_get_pid (regcache->ptid ()),
+ ret = ptrace (PT_SETREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &inferior_registers, 0);
if (ret < 0)
@@ -316,7 +316,7 @@ store_regs (const struct regcache *regcache)
inferior_registers.r_pc = pc_val | psr_val;
}
- ret = ptrace (PT_SETREGS, ptid_get_pid (regcache->ptid ()),
+ ret = ptrace (PT_SETREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &inferior_registers, 0);
if (ret < 0)
@@ -329,7 +329,7 @@ store_fp_register (const struct regcache *regcache, int regno)
struct fpreg inferior_fp_registers;
int ret;
- ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()),
+ ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
if (ret < 0)
@@ -351,7 +351,7 @@ store_fp_register (const struct regcache *regcache, int regno)
break;
}
- ret = ptrace (PT_SETFPREGS, ptid_get_pid (regcache->ptid ()),
+ ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
if (ret < 0)
@@ -373,7 +373,7 @@ store_fp_regs (const struct regcache *regcache)
regcache->raw_collect (ARM_FPS_REGNUM,
(char *) &inferior_fp_registers.fpr_fpsr);
- ret = ptrace (PT_SETFPREGS, ptid_get_pid (regcache->ptid ()),
+ ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
if (ret < 0)
diff --git a/gdb/auxv.c b/gdb/auxv.c
index 2afa136..dda14f2 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -50,7 +50,7 @@ procfs_xfer_auxv (gdb_byte *readbuf,
int fd;
ssize_t l;
- pathname = xstrprintf ("/proc/%d/auxv", ptid_get_pid (inferior_ptid));
+ pathname = xstrprintf ("/proc/%d/auxv", inferior_ptid.pid ());
fd = gdb_open_cloexec (pathname, writebuf != NULL ? O_WRONLY : O_RDONLY, 0);
xfree (pathname);
if (fd < 0)
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 2fb5e61..93ef74c 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -110,7 +110,7 @@ insert_catch_syscall (struct bp_location *bl)
}
}
- return target_set_syscall_catchpoint (ptid_get_pid (inferior_ptid),
+ return target_set_syscall_catchpoint (inferior_ptid.pid (),
inf_data->total_syscalls_count != 0,
inf_data->any_syscall_count,
inf_data->syscalls_counts);
@@ -141,7 +141,7 @@ remove_catch_syscall (struct bp_location *bl, enum remove_bp_reason reason)
}
}
- return target_set_syscall_catchpoint (ptid_get_pid (inferior_ptid),
+ return target_set_syscall_catchpoint (inferior_ptid.pid (),
inf_data->total_syscalls_count != 0,
inf_data->any_syscall_count,
inf_data->syscalls_counts);
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 82dec7d..41050b7 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3637,7 +3637,7 @@ detach_breakpoints (ptid_t ptid)
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
struct inferior *inf = current_inferior ();
- if (ptid_get_pid (ptid) == ptid_get_pid (inferior_ptid))
+ if (ptid.pid () == inferior_ptid.pid ())
error (_("Cannot detach breakpoints of inferior_ptid"));
/* Set inferior_ptid; remove_breakpoint_1 uses this global. */
@@ -7709,7 +7709,7 @@ struct fork_catchpoint : public breakpoint
static int
insert_catch_fork (struct bp_location *bl)
{
- return target_insert_fork_catchpoint (ptid_get_pid (inferior_ptid));
+ return target_insert_fork_catchpoint (inferior_ptid.pid ());
}
/* Implement the "remove" breakpoint_ops method for fork
@@ -7718,7 +7718,7 @@ insert_catch_fork (struct bp_location *bl)
static int
remove_catch_fork (struct bp_location *bl, enum remove_bp_reason reason)
{
- return target_remove_fork_catchpoint (ptid_get_pid (inferior_ptid));
+ return target_remove_fork_catchpoint (inferior_ptid.pid ());
}
/* Implement the "breakpoint_hit" breakpoint_ops method for fork
@@ -7761,7 +7761,7 @@ print_it_catch_fork (bpstat bs)
}
uiout->field_int ("bkptno", b->number);
uiout->text (" (forked process ");
- uiout->field_int ("newpid", ptid_get_pid (c->forked_inferior_pid));
+ uiout->field_int ("newpid", c->forked_inferior_pid.pid ());
uiout->text ("), ");
return PRINT_SRC_AND_LOC;
}
@@ -7788,7 +7788,7 @@ print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc)
if (!ptid_equal (c->forked_inferior_pid, null_ptid))
{
uiout->text (", process ");
- uiout->field_int ("what", ptid_get_pid (c->forked_inferior_pid));
+ uiout->field_int ("what", c->forked_inferior_pid.pid ());
uiout->spaces (1);
}
@@ -7825,7 +7825,7 @@ static struct breakpoint_ops catch_fork_breakpoint_ops;
static int
insert_catch_vfork (struct bp_location *bl)
{
- return target_insert_vfork_catchpoint (ptid_get_pid (inferior_ptid));
+ return target_insert_vfork_catchpoint (inferior_ptid.pid ());
}
/* Implement the "remove" breakpoint_ops method for vfork
@@ -7834,7 +7834,7 @@ insert_catch_vfork (struct bp_location *bl)
static int
remove_catch_vfork (struct bp_location *bl, enum remove_bp_reason reason)
{
- return target_remove_vfork_catchpoint (ptid_get_pid (inferior_ptid));
+ return target_remove_vfork_catchpoint (inferior_ptid.pid ());
}
/* Implement the "breakpoint_hit" breakpoint_ops method for vfork
@@ -7877,7 +7877,7 @@ print_it_catch_vfork (bpstat bs)
}
uiout->field_int ("bkptno", b->number);
uiout->text (" (vforked process ");
- uiout->field_int ("newpid", ptid_get_pid (c->forked_inferior_pid));
+ uiout->field_int ("newpid", c->forked_inferior_pid.pid ());
uiout->text ("), ");
return PRINT_SRC_AND_LOC;
}
@@ -7903,7 +7903,7 @@ print_one_catch_vfork (struct breakpoint *b, struct bp_location **last_loc)
if (!ptid_equal (c->forked_inferior_pid, null_ptid))
{
uiout->text (", process ");
- uiout->field_int ("what", ptid_get_pid (c->forked_inferior_pid));
+ uiout->field_int ("what", c->forked_inferior_pid.pid ());
uiout->spaces (1);
}
@@ -8254,13 +8254,13 @@ exec_catchpoint::~exec_catchpoint ()
static int
insert_catch_exec (struct bp_location *bl)
{
- return target_insert_exec_catchpoint (ptid_get_pid (inferior_ptid));
+ return target_insert_exec_catchpoint (inferior_ptid.pid ());
}
static int
remove_catch_exec (struct bp_location *bl, enum remove_bp_reason reason)
{
- return target_remove_exec_catchpoint (ptid_get_pid (inferior_ptid));
+ return target_remove_exec_catchpoint (inferior_ptid.pid ());
}
static int
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index c2e6ea9..8437081 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -407,7 +407,7 @@ bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status,
{
ULONGEST magic = extract_unsigned_integer (buf, 4, byte_order);
if (magic == BSD_UTHREAD_PTHREAD_MAGIC)
- ptid = ptid_t (ptid_get_pid (ptid), 0, addr);
+ ptid = ptid_t (ptid.pid (), 0, addr);
}
}
@@ -457,7 +457,7 @@ bsd_uthread_target::thread_alive (ptid_t ptid)
void
bsd_uthread_target::update_thread_list ()
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
int offset = bsd_uthread_thread_next_offset;
CORE_ADDR addr;
@@ -539,7 +539,7 @@ bsd_uthread_target::pid_to_str (ptid_t ptid)
static char buf[64];
xsnprintf (buf, sizeof buf, "process %d, thread 0x%lx",
- ptid_get_pid (ptid), ptid_get_tid (ptid));
+ ptid.pid (), ptid_get_tid (ptid));
return buf;
}
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index 42e51d2..0b0a703 100644
--- a/gdb/common/ptid.c
+++ b/gdb/common/ptid.c
@@ -27,14 +27,6 @@ ptid_t minus_one_ptid = ptid_t::make_minus_one ();
/* See ptid.h. */
-int
-ptid_get_pid (const ptid_t &ptid)
-{
- return ptid.pid ();
-}
-
-/* See ptid.h. */
-
long
ptid_get_lwp (const ptid_t &ptid)
{
diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h
index 5591690..6747e7a 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::pid. */
-
-extern int ptid_get_pid (const ptid_t &ptid);
-
/* See ptid_t::lwp. */
extern long ptid_get_lwp (const ptid_t &ptid);
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index b82124d..70eaf08 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -930,7 +930,7 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
inferior_debug
(2, _("darwin_resume: pid=%d, tid=0x%lx, step=%d, signal=%d\n"),
- ptid_get_pid (ptid), ptid_get_tid (ptid), step, signal);
+ ptid.pid (), ptid_get_tid (ptid), step, signal);
if (signal == GDB_SIGNAL_0)
nsignal = 0;
@@ -1199,7 +1199,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status)
inferior_debug
(2, _("darwin_wait: waiting for a message pid=%d thread=%lx\n"),
- ptid_get_pid (ptid), ptid_get_tid (ptid));
+ ptid.pid (), ptid_get_tid (ptid));
/* Handle fake stop events at first. */
if (darwin_inf_fake_stop != NULL)
@@ -1924,7 +1924,7 @@ darwin_nat_target::attach (const char *args, int from_tty)
void
darwin_nat_target::detach (inferior *inf, int from_tty)
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
darwin_inferior *priv = get_darwin_inferior (inf);
kern_return_t kret;
int res;
@@ -1967,7 +1967,7 @@ darwin_nat_target::pid_to_str (ptid_t ptid)
if (tid != 0)
{
snprintf (buf, sizeof (buf), _("Thread 0x%lx of process %u"),
- tid, ptid_get_pid (ptid));
+ tid, ptid.pid ());
return buf;
}
@@ -2272,7 +2272,7 @@ darwin_nat_target::get_ada_task_ptid (long lwp, long thread)
for (darwin_thread_t *t : priv->threads)
{
if (t->inf_port == lwp)
- return ptid_t (ptid_get_pid (inferior_ptid), 0, t->gdb_port);
+ return ptid_t (inferior_ptid.pid (), 0, t->gdb_port);
}
/* Maybe the port was never extract. Do it now. */
@@ -2316,7 +2316,7 @@ darwin_nat_target::get_ada_task_ptid (long lwp, long thread)
names_count * sizeof (mach_port_t));
if (res)
- return ptid_t (ptid_get_pid (inferior_ptid), 0, res);
+ return ptid_t (inferior_ptid.pid (), 0, res);
else
return null_ptid;
}
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index e46645a..f88d6a0 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -92,7 +92,7 @@ int
fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
void *obfd)
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
struct kinfo_vmentry *kve;
uint64_t size;
int i, nitems;
@@ -166,7 +166,7 @@ int
fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
void *obfd)
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
unsigned long start, end, size;
char protection[4];
int read, write, exec;
@@ -312,7 +312,7 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
gdb_argv built_argv (args);
if (built_argv.count () == 0)
{
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
if (pid == 0)
error (_("No current process: you must name one."));
}
@@ -674,7 +674,7 @@ fbsd_nat_target::xfer_partial (enum target_object object,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
switch (object)
{
@@ -838,7 +838,7 @@ fbsd_nat_target::pid_to_str (ptid_t ptid)
if (lwp != 0)
{
static char buf[64];
- int pid = ptid_get_pid (ptid);
+ int pid = ptid.pid ();
xsnprintf (buf, sizeof buf, "LWP %d of process %d", lwp, pid);
return buf;
@@ -856,7 +856,7 @@ fbsd_nat_target::thread_name (struct thread_info *thr)
{
struct ptrace_lwpinfo pl;
struct kinfo_proc kp;
- int pid = ptid_get_pid (thr->ptid);
+ int pid = thr->ptid.pid ();
long lwp = ptid_get_lwp (thr->ptid);
static char buf[sizeof pl.pl_tdname + 1];
@@ -974,7 +974,7 @@ fbsd_nat_target::update_thread_list ()
#else
prune_threads ();
- fbsd_add_threads (ptid_get_pid (inferior_ptid));
+ fbsd_add_threads (inferior_ptid.pid ());
#endif
}
@@ -1090,9 +1090,9 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
/* Don't PT_CONTINUE a process which has a pending vfork done event. */
if (ptid_equal (minus_one_ptid, ptid))
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
else
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
if (fbsd_is_vfork_done_pending (pid))
return;
#endif
@@ -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_get_pid (ptid), ptid_get_lwp (ptid),
+ ptid.pid (), ptid_get_lwp (ptid),
ptid_get_tid (ptid));
if (ptid_lwp_p (ptid))
{
@@ -1110,7 +1110,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
ALL_NON_EXITED_THREADS (tp)
{
- if (ptid_get_pid (tp->ptid) != ptid_get_pid (ptid))
+ if (tp->ptid.pid () != ptid.pid ())
continue;
if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (ptid))
@@ -1249,7 +1249,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
pid_t pid;
int status;
- pid = ptid_get_pid (wptid);
+ pid = wptid.pid ();
if (ptrace (PT_LWPINFO, pid, (caddr_t) &pl, sizeof pl) == -1)
perror_with_name (("ptrace"));
@@ -1361,7 +1361,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
}
/* Enable additional events on the child process. */
- fbsd_enable_proc_events (ptid_get_pid (child_ptid));
+ fbsd_enable_proc_events (child_ptid.pid ());
#ifndef PTRACE_VFORK
/* For vfork, the child process will have the P_PPWAIT
@@ -1487,7 +1487,7 @@ fbsd_nat_target::follow_fork (int follow_child, int detach_fork)
if (!follow_child && detach_fork)
{
struct thread_info *tp = inferior_thread ();
- pid_t child_pid = ptid_get_pid (tp->pending_follow.value.related_pid);
+ pid_t child_pid = tp->pending_follow.value.related_pid.pid ();
/* Breakpoints have already been detached from the child by
infrun.c. */
@@ -1558,7 +1558,7 @@ fbsd_nat_target::remove_vfork_catchpoint (int pid)
void
fbsd_nat_target::post_startup_inferior (ptid_t pid)
{
- fbsd_enable_proc_events (ptid_get_pid (pid));
+ fbsd_enable_proc_events (pid.pid ());
}
/* Implement the "post_attach" target_ops method. */
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 455deb1..e26b876 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -406,7 +406,7 @@ static int
find_signalled_thread (struct thread_info *info, void *data)
{
if (info->suspend.stop_signal != GDB_SIGNAL_0
- && ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
+ && info->ptid.pid () == inferior_ptid.pid ())
return 1;
return 0;
@@ -578,7 +578,7 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
{
if (thr == signalled_thr)
continue;
- if (ptid_get_pid (thr->ptid) != ptid_get_pid (inferior_ptid))
+ if (thr->ptid.pid () != inferior_ptid.pid ())
continue;
fbsd_corefile_thread (thr, &thread_args);
diff --git a/gdb/gcore.c b/gdb/gcore.c
index c538100..fbebb6a 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -151,7 +151,7 @@ gcore_command (const char *args, int from_tty)
else
{
/* Default corefile name is "core.PID". */
- corefilename.reset (xstrprintf ("core.%d", ptid_get_pid (inferior_ptid)));
+ corefilename.reset (xstrprintf ("core.%d", inferior_ptid.pid ()));
}
if (info_verbose)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 71f3e16..5aee98c 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,6 +1,19 @@
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
+ * linux-mips-low.c: Update.
+ * lynx-low.c: Update.
+ * mem-break.c: Update.
+ * nto-low.c: Update.
+ * remote-utils.c: Update.
+ * server.c: Update.
+ * spu-low.c: Update.
+ * target.c: Update.
+ * tracepoint.c: Update.
+
+2018-07-03 Tom Tromey <tom@tromey.com>
+
+ * linux-low.c: Update.
* linux-ppc-low.c: Update.
* linux-x86-low.c: Update.
* proc-service.c: Update.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index a5e0d5b..99a7e16 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -530,7 +530,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_get_pid (ptid));
+ ptid.pid ());
}
/* Add the new process to the tables and clone the breakpoint
@@ -699,7 +699,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
/* Get the event ptid. */
event_ptid = ptid_of (event_thr);
- event_pid = ptid_get_pid (event_ptid);
+ event_pid = event_ptid.pid ();
/* Save the syscall list from the execing process. */
proc = get_thread_process (event_thr);
@@ -1323,7 +1323,7 @@ static void
kill_wait_lwp (struct lwp_info *lwp)
{
struct thread_info *thr = get_lwp_thread (lwp);
- int pid = ptid_get_pid (ptid_of (thr));
+ int pid = ptid_of (thr).pid ();
int lwpid = ptid_get_lwp (ptid_of (thr));
int wstat;
int res;
@@ -4546,7 +4546,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
|| ptid == thread->id
/* Handle both 'pPID' and 'pPID.-1' as meaning 'all threads
of PID'. */
- || (ptid_get_pid (ptid) == pid_of (thread)
+ || (ptid.pid () == pid_of (thread)
&& (ptid_is_pid (ptid)
|| ptid_get_lwp (ptid) == -1)))
{
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index 17fb897..f61c294 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -440,7 +440,7 @@ static void
mips_linux_prepare_to_resume (struct lwp_info *lwp)
{
ptid_t ptid = ptid_of (get_lwp_thread (lwp));
- struct process_info *proc = find_process_pid (ptid_get_pid (ptid));
+ struct process_info *proc = find_process_pid (ptid.pid ());
struct arch_process_info *priv = proc->priv->arch_private;
if (lwp->arch_private->watch_registers_changed)
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index b19ea62..b637ef9 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -83,7 +83,7 @@ lynx_ptid_t (int pid, long tid)
static int
lynx_ptid_get_pid (ptid_t ptid)
{
- return ptid_get_pid (ptid);
+ return ptid.pid ();
}
/* Return the LynxOS tid of the given PTID. */
@@ -352,7 +352,7 @@ lynx_resume (struct thread_resume *resume_info, size_t n)
if (ptid_equal (ptid, minus_one_ptid))
ptid = ptid_of (current_thread);
- regcache_invalidate_pid (ptid_get_pid (ptid));
+ regcache_invalidate_pid (ptid.pid ());
errno = 0;
lynx_ptrace (request, ptid, 1, signal, 0);
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index 4c10fbb..7ad8c48 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -1482,7 +1482,7 @@ set_single_step_breakpoint (CORE_ADDR stop_at, ptid_t ptid)
{
struct single_step_breakpoint *bp;
- gdb_assert (ptid_get_pid (current_ptid) == ptid_get_pid (ptid));
+ gdb_assert (current_ptid.pid () == ptid.pid ());
bp = (struct single_step_breakpoint *) set_breakpoint_type_at (single_step_breakpoint,
stop_at, NULL);
diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c
index ed28426..6a05d2b 100644
--- a/gdb/gdbserver/nto-low.c
+++ b/gdb/gdbserver/nto-low.c
@@ -91,7 +91,7 @@ nto_set_thread (ptid_t ptid)
{
int res = 0;
- TRACE ("%s pid: %d tid: %ld\n", __func__, ptid_get_pid (ptid),
+ TRACE ("%s pid: %d tid: %ld\n", __func__, ptid.pid (),
ptid_get_lwp (ptid));
if (nto_inferior.ctl_fd != -1
&& !ptid_equal (ptid, null_ptid)
@@ -430,9 +430,9 @@ nto_thread_alive (ptid_t ptid)
{
int res;
- TRACE ("%s pid:%d tid:%d\n", __func__, ptid_get_pid (ptid),
+ TRACE ("%s pid:%d tid:%d\n", __func__, ptid.pid (),
ptid_get_lwp (ptid));
- if (SignalKill (0, ptid_get_pid (ptid), ptid_get_lwp (ptid),
+ if (SignalKill (0, ptid.pid (), ptid_get_lwp (ptid),
0, 0, 0) == -1)
res = 0;
else
@@ -582,7 +582,7 @@ nto_wait (ptid_t ptid,
int waitval = 0;
TRACE (" TERMINATED\n");
- waitpid (ptid_get_pid (ptid), &waitval, WNOHANG);
+ waitpid (ptid.pid (), &waitval, WNOHANG);
if (nto_inferior.exit_signo)
{
/* Abnormal death. */
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index a1a06dc..400c2be 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -486,7 +486,7 @@ write_ptid (char *buf, ptid_t ptid)
if (cs.multi_process)
{
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
if (pid < 0)
buf += sprintf (buf, "p-%x.", -pid);
else
@@ -1261,14 +1261,14 @@ prepare_resume_reply (char *buf, ptid_t ptid,
case TARGET_WAITKIND_EXITED:
if (cs.multi_process)
sprintf (buf, "W%x;process:%x",
- status->value.integer, ptid_get_pid (ptid));
+ status->value.integer, ptid.pid ());
else
sprintf (buf, "W%02x", status->value.integer);
break;
case TARGET_WAITKIND_SIGNALLED:
if (cs.multi_process)
sprintf (buf, "X%x;process:%x",
- status->value.sig, ptid_get_pid (ptid));
+ status->value.sig, ptid.pid ());
else
sprintf (buf, "X%02x", status->value.sig);
break;
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index c2f7287..28bc9de 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1205,7 +1205,7 @@ handle_detach (char *own_buf)
pid = strtol (&own_buf[2], NULL, 16);
}
else
- pid = ptid_get_pid (current_ptid);
+ pid = current_ptid.pid ();
if ((tracing && disconnected_tracing) || any_persistent_commands ())
{
@@ -2180,7 +2180,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
if (current_thread == NULL)
{
current_thread
- = find_any_thread_of_pid (ptid_get_pid (cs.general_thread));
+ = find_any_thread_of_pid (cs.general_thread.pid ());
/* Just in case, if we didn't find a thread, then bail out
instead of crashing. */
@@ -2698,7 +2698,7 @@ visit_actioned_threads (thread_info *thread,
if (ptid_equal (action->thread, minus_one_ptid)
|| ptid_equal (action->thread, thread->id)
- || ((ptid_get_pid (action->thread)
+ || ((action->thread.pid ()
== thread->id.pid ())
&& ptid_get_lwp (action->thread) == -1))
{
@@ -4427,7 +4427,7 @@ handle_target_event (int err, gdb_client_data client_data)
}
else if (cs.last_status.kind != TARGET_WAITKIND_IGNORE)
{
- int pid = ptid_get_pid (cs.last_ptid);
+ int pid = cs.last_ptid.pid ();
struct process_info *process = find_process_pid (pid);
int forward_event = !gdb_connected () || process->gdb_detached;
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index 8a221a2..3436d39 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -418,7 +418,7 @@ spu_resume (struct thread_resume *resume_info, size_t n)
static ptid_t
spu_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
{
- int pid = ptid_get_pid (ptid);
+ int pid = ptid.pid ();
int w;
int ret;
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index c276329..400d458 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -248,7 +248,7 @@ target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
void
target_mourn_inferior (ptid_t ptid)
{
- (*the_target->mourn) (find_process_pid (ptid_get_pid (ptid)));
+ (*the_target->mourn) (find_process_pid (ptid.pid ()));
}
/* See target/target.h. */
@@ -320,13 +320,13 @@ target_pid_to_str (ptid_t ptid)
xsnprintf (buf, sizeof (buf), "<null thread>");
else if (ptid_get_tid (ptid) != 0)
xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx",
- ptid_get_pid (ptid), ptid_get_tid (ptid));
+ ptid.pid (), ptid_get_tid (ptid));
else if (ptid_get_lwp (ptid) != 0)
xsnprintf (buf, sizeof (buf), "LWP %d.%ld",
- ptid_get_pid (ptid), ptid_get_lwp (ptid));
+ ptid.pid (), ptid_get_lwp (ptid));
else
xsnprintf (buf, sizeof (buf), "Process %d",
- ptid_get_pid (ptid));
+ ptid.pid ());
return buf;
}
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index c203080..ad2a801 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -6835,7 +6835,7 @@ static int
run_inferior_command (char *cmd, int len)
{
int err = -1;
- int pid = ptid_get_pid (current_ptid);
+ int pid = current_ptid.pid ();
trace_debug ("run_inferior_command: running: %s", cmd);
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 78276a7..c7c7e89 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2042,7 +2042,7 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
/* Allow all threads to run, except perhaps single-stepping one. */
{
inf_debug (inf, "running all threads; tid = %d",
- ptid_get_pid (inferior_ptid));
+ inferior_ptid.pid ());
ptid = inferior_ptid; /* What to step. */
inf_set_threads_resume_sc (inf, 0, 1);
}
diff --git a/gdb/hppa-nbsd-nat.c b/gdb/hppa-nbsd-nat.c
index 40a08b7..2a11490 100644
--- a/gdb/hppa-nbsd-nat.c
+++ b/gdb/hppa-nbsd-nat.c
@@ -170,7 +170,7 @@ void
hppa_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum))
{
@@ -199,7 +199,7 @@ hppa_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
void
hppa_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum))
{
diff --git a/gdb/hppa-obsd-nat.c b/gdb/hppa-obsd-nat.c
index eb056e3..9237dee 100644
--- a/gdb/hppa-obsd-nat.c
+++ b/gdb/hppa-obsd-nat.c
@@ -196,7 +196,7 @@ hppaobsd_collect_fpregset (struct regcache *regcache,
void
hppa_obsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (regnum == -1 || hppaobsd_gregset_supplies_p (regnum))
{
diff --git a/gdb/i386-fbsd-nat.c b/gdb/i386-fbsd-nat.c
index 46f9a86..ced369e 100644
--- a/gdb/i386-fbsd-nat.c
+++ b/gdb/i386-fbsd-nat.c
@@ -58,14 +58,14 @@ static i386_fbsd_nat_target the_i386_fbsd_nat_target;
void
i386_fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
{
- pid_t pid = ptid_get_pid (ptid);
+ pid_t pid = ptid.pid ();
int request = PT_STEP;
if (pid == -1)
/* Resume all threads. This only gets used in the non-threaded
case, where "resume all threads" and "resume inferior_ptid" are
the same. */
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
if (!step)
{
@@ -148,7 +148,7 @@ i386_fbsd_nat_target::read_description ()
{
struct ptrace_xstate_info info;
- if (ptrace (PT_GETXSTATE_INFO, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETXSTATE_INFO, inferior_ptid.pid (),
(PTRACE_TYPE_ARG3) &info, sizeof (info)) == 0)
{
x86bsd_xsave_len = info.xsave_len;
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index ef70da5..49ae702 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -555,7 +555,7 @@ store_debug_register (ptid_t ptid, int idx, long val)
tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (ptid);
+ tid = ptid.pid ();
(void) ptrace (PT_WRITE_U, tid, (PTRACE_TYPE_ARG3) (PT_DBR + 8 * idx), val);
}
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 3b32b67..bdea7f1 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -66,7 +66,7 @@ inf_ptrace_target::follow_fork (int follow_child, int detach_fork)
if (!follow_child)
{
struct thread_info *tp = inferior_thread ();
- pid_t child_pid = ptid_get_pid (tp->pending_follow.value.related_pid);
+ pid_t child_pid = tp->pending_follow.value.related_pid.pid ();
/* Breakpoints have already been detached from the child by
infrun.c. */
@@ -156,7 +156,7 @@ inf_ptrace_target::post_startup_inferior (ptid_t pid)
/* Set the initial event mask. */
memset (&pe, 0, sizeof pe);
pe.pe_set_event |= PTRACE_FORK;
- if (ptrace (PT_SET_EVENT_MASK, ptid_get_pid (pid),
+ if (ptrace (PT_SET_EVENT_MASK, pid.pid (),
(PTRACE_TYPE_ARG3)&pe, sizeof pe) == -1)
perror_with_name (("ptrace"));
}
@@ -174,7 +174,7 @@ inf_ptrace_target::mourn_inferior ()
Do not check whether this succeeds though, since we may be
dealing with a process that we attached to. Such a process will
only report its exit status to its original parent. */
- waitpid (ptid_get_pid (inferior_ptid), &status, 0);
+ waitpid (inferior_ptid.pid (), &status, 0);
inf_child_target::mourn_inferior ();
}
@@ -267,7 +267,7 @@ inf_ptrace_target::post_attach (int pid)
void
inf_ptrace_target::detach (inferior *inf, int from_tty)
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
target_announce_detach (from_tty);
@@ -303,7 +303,7 @@ inf_ptrace_target::detach_success (inferior *inf)
void
inf_ptrace_target::kill ()
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
int status;
if (pid == 0)
@@ -327,7 +327,7 @@ get_ptrace_pid (ptid_t ptid)
dealing with a non-threaded program/target. */
pid = ptid_get_lwp (ptid);
if (pid == 0)
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
return pid;
}
@@ -344,7 +344,7 @@ inf_ptrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
if (ptid_equal (minus_one_ptid, ptid))
/* Resume all threads. Traditionally ptrace() only supports
single-threaded processes, so simply resume the inferior. */
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
else
pid = get_ptrace_pid (ptid);
@@ -389,7 +389,7 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
do
{
- pid = waitpid (ptid_get_pid (ptid), &status, 0);
+ pid = waitpid (ptid.pid (), &status, 0);
save_errno = errno;
}
while (pid == -1 && errno == EINTR);
@@ -409,7 +409,7 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
}
/* Ignore terminated detached child processes. */
- if (!WIFSTOPPED (status) && pid != ptid_get_pid (inferior_ptid))
+ if (!WIFSTOPPED (status) && pid != inferior_ptid.pid ())
pid = -1;
}
while (pid == -1);
@@ -441,7 +441,7 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
gdb_assert (pe.pe_report_event == PTRACE_FORK);
gdb_assert (pe.pe_other_pid == pid);
- if (fpid == ptid_get_pid (inferior_ptid))
+ if (fpid == inferior_ptid.pid ())
{
ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
return ptid_t (fpid);
@@ -614,7 +614,7 @@ bool
inf_ptrace_target::thread_alive (ptid_t ptid)
{
/* ??? Is kill the right way to do this? */
- return (::kill (ptid_get_pid (ptid), 0) != -1);
+ return (::kill (ptid.pid (), 0) != -1);
}
/* Print status information about what we're accessing. */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 2be286c..41322c6 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2638,7 +2638,7 @@ proceed_after_attach_callback (struct thread_info *thread,
{
int pid = * (int *) arg;
- if (ptid_get_pid (thread->ptid) == pid
+ if (thread->ptid.pid () == pid
&& thread->state != THREAD_EXITED
&& !thread->executing
&& !thread->stop_requested
@@ -2677,7 +2677,7 @@ setup_inferior (int from_tty)
/* If no exec file is yet known, try to determine it from the
process itself. */
if (get_exec_file (0) == NULL)
- exec_file_locate_attach (ptid_get_pid (inferior_ptid), 1, from_tty);
+ exec_file_locate_attach (inferior_ptid.pid (), 1, from_tty);
else
{
reopen_exec_file ();
@@ -2685,7 +2685,7 @@ setup_inferior (int from_tty)
}
/* Take any necessary post-attaching actions for this platform. */
- target_post_attach (ptid_get_pid (inferior_ptid));
+ target_post_attach (inferior_ptid.pid ());
post_create_inferior (current_top_target (), from_tty);
}
@@ -2766,7 +2766,7 @@ attach_post_wait (const char *args, int from_tty, enum attach_post_wait_mode mod
still exists. */
ALL_NON_EXITED_THREADS (thread)
{
- if (ptid_get_pid (thread->ptid) == pid)
+ if (thread->ptid.pid () == pid)
{
if (thread->inf->num < lowest->inf->num
|| thread->per_inf_num < lowest->per_inf_num)
@@ -2897,7 +2897,7 @@ attach_command (const char *args, int from_tty)
else
/* The user requested an `attach', so stop all threads of this
inferior. */
- target_stop (ptid_t (ptid_get_pid (inferior_ptid)));
+ target_stop (ptid_t (inferior_ptid.pid ()));
}
mode = async_exec ? ATTACH_POST_WAIT_RESUME : ATTACH_POST_WAIT_STOP;
diff --git a/gdb/inferior.c b/gdb/inferior.c
index b8539d8..16991d4 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -141,7 +141,7 @@ delete_thread_of_inferior (struct thread_info *tp, void *data)
struct delete_thread_of_inferior_arg *arg
= (struct delete_thread_of_inferior_arg *) data;
- if (ptid_get_pid (tp->ptid) == arg->pid)
+ if (tp->ptid.pid () == arg->pid)
{
if (arg->silent)
delete_thread_silent (tp);
@@ -322,7 +322,7 @@ find_inferior_pid (int pid)
struct inferior *
find_inferior_ptid (ptid_t ptid)
{
- return find_inferior_pid (ptid_get_pid (ptid));
+ return find_inferior_pid (ptid.pid ());
}
/* See inferior.h. */
@@ -388,7 +388,7 @@ number_of_live_inferiors (void)
struct thread_info *tp;
ALL_NON_EXITED_THREADS (tp)
- if (tp && ptid_get_pid (tp->ptid) == inf->pid)
+ if (tp && tp->ptid.pid () == inf->pid)
if (target_has_execution_1 (tp->ptid))
{
/* Found a live thread in this inferior, go to the next
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 154fda6..c5dc324 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -84,7 +84,7 @@ extern void set_inferior_io_terminal (const char *terminal_name);
extern const char *get_inferior_io_terminal (void);
/* Collected pid, tid, etc. of the debugged inferior. When there's
- no inferior, ptid_get_pid (inferior_ptid) will be 0. */
+ no inferior, inferior_ptid.pid () will be 0. */
extern ptid_t inferior_ptid;
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 08e47d6..7bcefdc 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -908,7 +908,7 @@ static void
pass_signal (int signo)
{
#ifndef _WIN32
- kill (ptid_get_pid (inferior_ptid), SIGINT);
+ kill (inferior_ptid.pid (), SIGINT);
#endif
}
diff --git a/gdb/infrun.c b/gdb/infrun.c
index b77e40d..f5c6ac3 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -462,7 +462,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \
if (print_inferior_events)
{
/* Ensure that we have a process ptid. */
- ptid_t process_ptid = ptid_t (ptid_get_pid (child_ptid));
+ ptid_t process_ptid = ptid_t (child_ptid.pid ());
target_terminal::ours_for_output ();
fprintf_filtered (gdb_stdlog,
@@ -476,7 +476,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \
struct inferior *parent_inf, *child_inf;
/* Add process to GDB's tables. */
- child_inf = add_inferior (ptid_get_pid (child_ptid));
+ child_inf = add_inferior (child_ptid.pid ());
parent_inf = current_inferior ();
child_inf->attach_flag = parent_inf->attach_flag;
@@ -563,7 +563,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \
/* Add the new inferior first, so that the target_detach below
doesn't unpush the target. */
- child_inf = add_inferior (ptid_get_pid (child_ptid));
+ child_inf = add_inferior (child_ptid.pid ());
parent_inf = current_inferior ();
child_inf->attach_flag = parent_inf->attach_flag;
@@ -598,7 +598,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \
if (print_inferior_events)
{
/* Ensure that we have a process ptid. */
- ptid_t process_ptid = ptid_t (ptid_get_pid (parent_ptid));
+ ptid_t process_ptid = ptid_t (parent_ptid.pid ());
target_terminal::ours_for_output ();
fprintf_filtered (gdb_stdlog,
@@ -1082,7 +1082,7 @@ follow_exec (ptid_t ptid, char *exec_file_target)
{
struct thread_info *th, *tmp;
struct inferior *inf = current_inferior ();
- int pid = ptid_get_pid (ptid);
+ int pid = ptid.pid ();
ptid_t process_ptid;
/* This is an exec event that we actually wish to pay attention to.
@@ -1128,7 +1128,7 @@ follow_exec (ptid_t ptid, char *exec_file_target)
stop provides a nicer sequence of events for user and MI
notifications. */
ALL_THREADS_SAFE (th, tmp)
- if (ptid_get_pid (th->ptid) == pid && !ptid_equal (th->ptid, ptid))
+ if (th->ptid.pid () == pid && !ptid_equal (th->ptid, ptid))
delete_thread (th);
/* We also need to clear any left over stale state for the
@@ -2268,7 +2268,7 @@ user_visible_resume_ptid (int step)
{
/* Resume all threads of the current process (and none of other
processes). */
- resume_ptid = ptid_t (ptid_get_pid (inferior_ptid));
+ resume_ptid = ptid_t (inferior_ptid.pid ());
}
else
{
@@ -3422,14 +3422,14 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
is set. */
stb.printf ("infrun: target_wait (%d.%ld.%ld",
- ptid_get_pid (waiton_ptid),
+ waiton_ptid.pid (),
ptid_get_lwp (waiton_ptid),
ptid_get_tid (waiton_ptid));
- if (ptid_get_pid (waiton_ptid) != -1)
+ 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",
- ptid_get_pid (result_ptid),
+ result_ptid.pid (),
ptid_get_lwp (result_ptid),
ptid_get_tid (result_ptid),
target_pid_to_str (result_ptid));
@@ -4376,7 +4376,7 @@ save_waitstatus (struct thread_info *tp, struct target_waitstatus *ws)
fprintf_unfiltered (gdb_stdlog,
"infrun: saving status %s for %d.%ld.%ld\n",
statstr.c_str (),
- ptid_get_pid (tp->ptid),
+ tp->ptid.pid (),
ptid_get_lwp (tp->ptid),
ptid_get_tid (tp->ptid));
}
@@ -4613,7 +4613,7 @@ stop_all_threads (void)
"infrun: target_wait %s, saving "
"status for %d.%ld.%ld\n",
statstr.c_str (),
- ptid_get_pid (t->ptid),
+ t->ptid.pid (),
ptid_get_lwp (t->ptid),
ptid_get_tid (t->ptid));
}
@@ -4904,7 +4904,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs)
process as not-executing so that finish_thread_state marks
them stopped (in the user's perspective) if/when we present
the stop to the user. */
- mark_ptid = ptid_t (ptid_get_pid (ecs->ptid));
+ mark_ptid = ptid_t (ecs->ptid.pid ());
}
else
mark_ptid = ecs->ptid;
@@ -7106,7 +7106,7 @@ switch_back_to_stepped_thread (struct execution_control_state *ecs)
/* Ignore threads of processes the caller is not
resuming. */
if (!sched_multi
- && ptid_get_pid (tp->ptid) != ptid_get_pid (ecs->ptid))
+ && tp->ptid.pid () != ecs->ptid.pid ())
continue;
/* When stepping over a breakpoint, we lock all threads
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index ef9015d..4b7e177 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -83,14 +83,14 @@ add_fork (pid_t pid)
{
struct fork_info *fp;
- if (fork_list == NULL && pid != ptid_get_pid (inferior_ptid))
+ if (fork_list == NULL && pid != inferior_ptid.pid ())
{
/* Special case -- if this is the first fork in the list
(the list is hitherto empty), and if this new fork is
NOT the current inferior_ptid, then add inferior_ptid
first, as a special zeroeth fork id. */
highest_fork_num = -1;
- add_fork (ptid_get_pid (inferior_ptid)); /* safe recursion */
+ add_fork (inferior_ptid.pid ()); /* safe recursion */
}
fp = XCNEW (struct fork_info);
@@ -141,7 +141,7 @@ delete_fork (ptid_t ptid)
fpprev = NULL;
- linux_target->low_forget_process (ptid_get_pid (ptid));
+ linux_target->low_forget_process (ptid.pid ());
for (fp = fork_list; fp; fpprev = fp, fp = fp->next)
if (ptid_equal (fp->ptid, ptid))
@@ -203,7 +203,7 @@ find_fork_pid (pid_t pid)
struct fork_info *fp;
for (fp = fork_list; fp; fp = fp->next)
- if (pid == ptid_get_pid (fp->ptid))
+ if (pid == fp->ptid.pid ())
return fp;
return NULL;
@@ -305,7 +305,7 @@ fork_save_infrun_state (struct fork_info *fp, int clobber_regs)
/* Now save the 'state' (file position) of all open file descriptors.
Unfortunately fork does not take care of that for us... */
snprintf (path, PATH_MAX, "/proc/%ld/fd",
- (long) ptid_get_pid (fp->ptid));
+ (long) fp->ptid.pid ());
if ((d = opendir (path)) != NULL)
{
long tmp;
@@ -355,7 +355,7 @@ linux_fork_killall (void)
for (fp = fork_list; fp; fp = fp->next)
{
- pid = ptid_get_pid (fp->ptid);
+ pid = fp->ptid.pid ();
do {
/* Use SIGKILL instead of PTRACE_KILL because the former works even
if the thread is running, while the later doesn't. */
@@ -383,7 +383,7 @@ linux_fork_mourn_inferior (void)
Do not check whether this succeeds though, since we may be
dealing with a process that we attached to. Such a process will
only report its exit status to its original parent. */
- waitpid (ptid_get_pid (inferior_ptid), &status, 0);
+ waitpid (inferior_ptid.pid (), &status, 0);
/* OK, presumably inferior_ptid is the one who has exited.
We need to delete that one from the fork_list, and switch
@@ -416,7 +416,7 @@ linux_fork_detach (int from_tty)
delete it from the fork_list, and switch to the next available
fork. */
- if (ptrace (PTRACE_DETACH, ptid_get_pid (inferior_ptid), 0, 0))
+ if (ptrace (PTRACE_DETACH, inferior_ptid.pid (), 0, 0))
error (_("Unable to detach %s"), target_pid_to_str (inferior_ptid));
delete_fork (inferior_ptid);
@@ -522,7 +522,7 @@ delete_checkpoint_command (const char *args, int from_tty)
error (_("\
Please switch to another checkpoint before deleting the current one"));
- if (ptrace (PTRACE_KILL, ptid_get_pid (ptid), 0, 0))
+ if (ptrace (PTRACE_KILL, ptid.pid (), 0, 0))
error (_("Unable to kill pid %s"), target_pid_to_str (ptid));
fi = find_fork_ptid (ptid);
@@ -542,7 +542,7 @@ Please switch to another checkpoint before deleting the current one"));
if ((parent == NULL && find_fork_ptid (pptid))
|| (parent != NULL && parent->state == THREAD_STOPPED))
{
- if (inferior_call_waitpid (pptid, ptid_get_pid (ptid)))
+ if (inferior_call_waitpid (pptid, ptid.pid ()))
warning (_("Unable to wait pid %s"), target_pid_to_str (ptid));
}
}
@@ -563,7 +563,7 @@ detach_checkpoint_command (const char *args, int from_tty)
error (_("\
Please switch to another checkpoint before detaching the current one"));
- if (ptrace (PTRACE_DETACH, ptid_get_pid (ptid), 0, 0))
+ if (ptrace (PTRACE_DETACH, ptid.pid (), 0, 0))
error (_("Unable to detach %s"), target_pid_to_str (ptid));
if (from_tty)
@@ -649,7 +649,7 @@ inf_has_multiple_thread_cb (struct thread_info *tp, void *data)
{
int *count_p = (int *) data;
- if (current_inferior ()->pid == ptid_get_pid (tp->ptid))
+ if (current_inferior ()->pid == tp->ptid.pid ())
(*count_p)++;
/* Stop the iteration if multiple threads have been detected. */
@@ -702,7 +702,7 @@ checkpoint_command (const char *args, int from_tty)
/* Tell linux-nat.c that we're checkpointing this inferior. */
{
scoped_restore save_pid
- = make_scoped_restore (&checkpointing_pid, ptid_get_pid (inferior_ptid));
+ = make_scoped_restore (&checkpointing_pid, inferior_ptid.pid ());
ret = call_function_by_hand (fork_fn, NULL, 0, &ret);
}
@@ -725,7 +725,7 @@ checkpoint_command (const char *args, int from_tty)
{
parent_pid = ptid_get_lwp (last_target_ptid);
if (parent_pid == 0)
- parent_pid = ptid_get_pid (last_target_ptid);
+ parent_pid = last_target_ptid.pid ();
printf_filtered (_(" gdb says parent = %ld.\n"),
(long) parent_pid);
}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index f62910c..cc03a5d 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -410,7 +410,7 @@ linux_nat_target::post_attach (int pid)
void
linux_nat_target::post_startup_inferior (ptid_t ptid)
{
- linux_init_ptrace (ptid_get_pid (ptid), 0);
+ linux_init_ptrace (ptid.pid (), 0);
}
/* Return the number of known LWPs in the tgid given by PID. */
@@ -422,7 +422,7 @@ num_lwps (int pid)
struct lwp_info *lp;
for (lp = lwp_list; lp; lp = lp->next)
- if (ptid_get_pid (lp->ptid) == pid)
+ if (lp->ptid.pid () == pid)
count++;
return count;
@@ -821,7 +821,7 @@ lwp_lwpid_htab_remove_pid (void **slot, void *info)
struct lwp_info *lp = (struct lwp_info *) *slot;
int pid = *(int *) info;
- if (ptid_get_pid (lp->ptid) == pid)
+ if (lp->ptid.pid () == pid)
{
htab_clear_slot (lwp_lwpid_htab, slot);
lwp_list_remove (lp);
@@ -938,7 +938,7 @@ find_lwp_pid (ptid_t ptid)
if (ptid_lwp_p (ptid))
lwp = ptid_get_lwp (ptid);
else
- lwp = ptid_get_pid (ptid);
+ lwp = ptid.pid ();
dummy.ptid = ptid_t (0, lwp, 0);
lp = (struct lwp_info *) htab_find (lwp_lwpid_htab, &dummy);
@@ -978,7 +978,7 @@ linux_nat_switch_fork (ptid_t new_ptid)
{
struct lwp_info *lp;
- purge_lwp_list (ptid_get_pid (inferior_ptid));
+ purge_lwp_list (inferior_ptid.pid ());
lp = add_lwp (new_ptid);
lp->stopped = 1;
@@ -1196,8 +1196,8 @@ linux_nat_target::attach (const char *args, int from_tty)
/* The ptrace base target adds the main thread with (pid,0,0)
format. Decorate it with lwp info. */
- ptid = ptid_t (ptid_get_pid (inferior_ptid),
- ptid_get_pid (inferior_ptid),
+ ptid = ptid_t (inferior_ptid.pid (),
+ inferior_ptid.pid (),
0);
thread_change_ptid (inferior_ptid, ptid);
@@ -1245,7 +1245,7 @@ linux_nat_target::attach (const char *args, int from_tty)
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LNA: waitpid %ld, saving status %s\n",
- (long) ptid_get_pid (lp->ptid), status_to_str (status));
+ (long) lp->ptid.pid (), status_to_str (status));
lp->status = status;
@@ -1256,7 +1256,7 @@ linux_nat_target::attach (const char *args, int from_tty)
of threads/LWPs, and those structures may well be corrupted.
Note that once thread_db is loaded, we'll still use it to list
threads and associate pthread info with each LWP. */
- linux_proc_attach_tgid_threads (ptid_get_pid (lp->ptid),
+ linux_proc_attach_tgid_threads (lp->ptid.pid (),
attach_proc_task_lwp_callback);
if (target_can_async_p ())
@@ -1450,7 +1450,7 @@ detach_callback (struct lwp_info *lp, void *data)
/* We don't actually detach from the thread group leader just yet.
If the thread group exits, we must reap the zombie clone lwps
before we're able to reap the leader. */
- if (ptid_get_lwp (lp->ptid) != ptid_get_pid (lp->ptid))
+ if (ptid_get_lwp (lp->ptid) != lp->ptid.pid ())
detach_one_lwp (lp, NULL);
return 0;
}
@@ -1969,7 +1969,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
}
if (event == PTRACE_EVENT_FORK
- && linux_fork_checkpointing_p (ptid_get_pid (lp->ptid)))
+ && linux_fork_checkpointing_p (lp->ptid.pid ()))
{
/* Handle checkpointing by linux-fork.c here as a special
case. We don't want the follow-fork-mode or 'catch fork'
@@ -2008,7 +2008,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
"from LWP %d, new child is LWP %ld\n",
pid, new_pid);
- new_lp = add_lwp (ptid_t (ptid_get_pid (lp->ptid), new_pid, 0));
+ new_lp = add_lwp (ptid_t (lp->ptid.pid (), new_pid, 0));
new_lp->stopped = 1;
new_lp->resumed = 1;
@@ -2181,7 +2181,7 @@ wait_lwp (struct lwp_info *lp)
Therefore always use WNOHANG with sigsuspend - it is equivalent to
waiting waitpid but linux_proc_pid_is_zombie is safe this way. */
- if (ptid_get_pid (lp->ptid) == ptid_get_lwp (lp->ptid)
+ if (lp->ptid.pid () == ptid_get_lwp (lp->ptid)
&& linux_proc_pid_is_zombie (ptid_get_lwp (lp->ptid)))
{
thread_dead = 1;
@@ -2219,11 +2219,11 @@ wait_lwp (struct lwp_info *lp)
if (WIFEXITED (status) || WIFSIGNALED (status))
{
if (report_thread_events
- || ptid_get_pid (lp->ptid) == ptid_get_lwp (lp->ptid))
+ || lp->ptid.pid () == ptid_get_lwp (lp->ptid))
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog, "WL: LWP %d exited.\n",
- ptid_get_pid (lp->ptid));
+ lp->ptid.pid ());
/* If this is the leader exiting, it means the whole
process is gone. Store the status to report to the
@@ -2251,7 +2251,7 @@ wait_lwp (struct lwp_info *lp)
if (lp->must_set_ptrace_flags)
{
- struct inferior *inf = find_inferior_pid (ptid_get_pid (lp->ptid));
+ struct inferior *inf = find_inferior_pid (lp->ptid.pid ());
int options = linux_nat_ptrace_options (inf->attach_flag);
linux_enable_event_reporting (ptid_get_lwp (lp->ptid), options);
@@ -2973,7 +2973,7 @@ linux_nat_filter_event (int lwpid, int status)
if (WIFSTOPPED (status) && lp->must_set_ptrace_flags)
{
- struct inferior *inf = find_inferior_pid (ptid_get_pid (lp->ptid));
+ struct inferior *inf = find_inferior_pid (lp->ptid.pid ());
int options = linux_nat_ptrace_options (inf->attach_flag);
linux_enable_event_reporting (ptid_get_lwp (lp->ptid), options);
@@ -3014,7 +3014,7 @@ linux_nat_filter_event (int lwpid, int status)
if (WIFEXITED (status) || WIFSIGNALED (status))
{
if (!report_thread_events
- && num_lwps (ptid_get_pid (lp->ptid)) > 1)
+ && num_lwps (lp->ptid.pid ()) > 1)
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
@@ -3125,7 +3125,7 @@ linux_nat_filter_event (int lwpid, int status)
will receive it - unless they're using CLONE_THREAD to
share signals. Since we only want to report it once, we
mark it as ignored for all LWPs except this one. */
- iterate_over_lwps (ptid_t (ptid_get_pid (lp->ptid)),
+ iterate_over_lwps (ptid_t (lp->ptid.pid ()),
set_ignore_sigint, NULL);
lp->ignore_sigint = 0;
}
@@ -3227,7 +3227,7 @@ filter_exit_event (struct lwp_info *event_child,
{
ptid_t ptid = event_child->ptid;
- if (num_lwps (ptid_get_pid (ptid)) > 1)
+ if (num_lwps (ptid.pid ()) > 1)
{
if (report_thread_events)
ourstatus->kind = TARGET_WAITKIND_THREAD_EXITED;
@@ -3259,8 +3259,8 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
{
/* Upgrade the main thread's ptid. */
thread_change_ptid (inferior_ptid,
- ptid_t (ptid_get_pid (inferior_ptid),
- ptid_get_pid (inferior_ptid), 0));
+ ptid_t (inferior_ptid.pid (),
+ inferior_ptid.pid (), 0));
lp = add_initial_lwp (inferior_ptid);
lp->resumed = 1;
@@ -3688,7 +3688,7 @@ kill_unfollowed_fork_children (struct inferior *inf)
|| ws->kind == TARGET_WAITKIND_VFORKED)
{
ptid_t child_ptid = ws->value.related_pid;
- int child_pid = ptid_get_pid (child_ptid);
+ int child_pid = child_ptid.pid ();
int child_lwp = ptid_get_lwp (child_ptid);
kill_one_lwp (child_lwp);
@@ -3713,7 +3713,7 @@ linux_nat_target::kill ()
linux_fork_killall ();
else
{
- ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid));
+ ptid_t ptid = ptid_t (inferior_ptid.pid ());
/* Stop all threads before killing them, since ptrace requires
that the thread is stopped to sucessfully PTRACE_KILL. */
@@ -3735,7 +3735,7 @@ linux_nat_target::kill ()
void
linux_nat_target::mourn_inferior ()
{
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
purge_lwp_list (pid);
@@ -3784,7 +3784,7 @@ linux_xfer_siginfo (enum target_object object,
pid = ptid_get_lwp (inferior_ptid);
if (pid == 0)
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
if (offset > sizeof (siginfo))
return TARGET_XFER_E_IO;
@@ -3934,8 +3934,8 @@ linux_nat_target::pid_to_str (ptid_t ptid)
static char buf[64];
if (ptid_lwp_p (ptid)
- && (ptid_get_pid (ptid) != ptid_get_lwp (ptid)
- || num_lwps (ptid_get_pid (ptid)) > 1))
+ && (ptid.pid () != ptid_get_lwp (ptid)
+ || num_lwps (ptid.pid ()) > 1))
{
snprintf (buf, sizeof (buf), "LWP %ld", ptid_get_lwp (ptid));
return buf;
@@ -4238,7 +4238,7 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid)
{
char s[IPA_CMD_BUF_SIZE];
struct cleanup *old_chain;
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
std::vector<static_tracepoint_marker> markers;
const char *p = s;
ptid_t ptid = ptid_t (pid, 0, 0);
@@ -4503,12 +4503,12 @@ linux_nat_target::thread_address_space (ptid_t ptid)
/* An (lwpid,0,0) ptid. Look up the lwp object to get at the
tgid. */
lwp = find_lwp_pid (ptid);
- pid = ptid_get_pid (lwp->ptid);
+ pid = lwp->ptid.pid ();
}
else
{
/* A (pid,lwpid,0) ptid. */
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
}
inf = find_inferior_pid (pid);
@@ -4646,7 +4646,7 @@ linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
pid = ptid_get_lwp (ptid);
if (pid == 0)
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
errno = 0;
ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, siginfo);
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 5a40a68..da8a1f0 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1386,7 +1386,7 @@ static int
find_signalled_thread (struct thread_info *info, void *data)
{
if (info->suspend.stop_signal != GDB_SIGNAL_0
- && ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
+ && info->ptid.pid () == inferior_ptid.pid ())
return 1;
return 0;
@@ -1745,7 +1745,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
gdb_assert (p != NULL);
/* Obtaining PID and filename. */
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
xsnprintf (filename, sizeof (filename), "/proc/%d/cmdline", (int) pid);
/* The full name of the program which generated the corefile. */
gdb::unique_xmalloc_ptr<char> fname
@@ -1959,7 +1959,7 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
{
if (thr == signalled_thr)
continue;
- if (ptid_get_pid (thr->ptid) != ptid_get_pid (inferior_ptid))
+ if (thr->ptid.pid () != inferior_ptid.pid ())
continue;
linux_corefile_thread (thr, &thread_args);
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index b67bd5d..11c07dc 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -230,7 +230,7 @@ add_thread_db_info (void *handle)
{
struct thread_db_info *info = XCNEW (struct thread_db_info);
- info->pid = ptid_get_pid (inferior_ptid);
+ info->pid = inferior_ptid.pid ();
info->handle = handle;
/* The workaround works by reading from /proc/pid/status, so it is
@@ -396,7 +396,7 @@ thread_from_lwp (thread_info *stopped, ptid_t ptid)
LWP. */
gdb_assert (ptid_get_lwp (ptid) != 0);
- info = get_thread_db_info (ptid_get_pid (ptid));
+ info = get_thread_db_info (ptid.pid ());
/* Access an lwp we know is stopped. */
info->proc_handle.thread = stopped;
@@ -424,7 +424,7 @@ thread_db_notice_clone (ptid_t parent, ptid_t child)
{
struct thread_db_info *info;
- info = get_thread_db_info (ptid_get_pid (child));
+ info = get_thread_db_info (child.pid ());
if (info == NULL)
return 0;
@@ -871,7 +871,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
td_ta_map_lwp2thr uses ps_get_thread_area, but we can't use that
currently on core targets, as it uses ptrace directly. */
if (target_has_execution
- && linux_proc_task_list_dir_exists (ptid_get_pid (inferior_ptid)))
+ && linux_proc_task_list_dir_exists (inferior_ptid.pid ()))
info->td_ta_thr_iter_p = NULL;
else
CHK (TDB_VERBOSE_DLSYM (info, td_ta_thr_iter));
@@ -890,13 +890,13 @@ try_thread_db_load_1 (struct thread_db_info *info)
if (info->td_ta_thr_iter_p == NULL)
{
struct lwp_info *lp;
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
thread_info *curr_thread = inferior_thread ();
linux_stop_and_wait_all_lwps ();
ALL_LWPS (lp)
- if (ptid_get_pid (lp->ptid) == pid)
+ if (lp->ptid.pid () == pid)
thread_from_lwp (curr_thread, lp->ptid);
linux_unstop_all_lwps ();
@@ -1003,7 +1003,7 @@ try_thread_db_load (const char *library, int check_auto_load_safe)
return 1;
/* This library "refused" to work on current inferior. */
- delete_thread_db_info (ptid_get_pid (inferior_ptid));
+ delete_thread_db_info (inferior_ptid.pid ());
return 0;
}
@@ -1175,7 +1175,7 @@ thread_db_load (void)
{
struct thread_db_info *info;
- info = get_thread_db_info (ptid_get_pid (inferior_ptid));
+ info = get_thread_db_info (inferior_ptid.pid ());
if (info != NULL)
return 1;
@@ -1284,7 +1284,7 @@ check_pid_namespace_match (void)
child's thread list, we'll mistakenly think it has no threads
since the thread PID fields won't match the PID we give to
libthread_db. */
- if (!linux_ns_same (ptid_get_pid (inferior_ptid), LINUX_NS_PID))
+ if (!linux_ns_same (inferior_ptid.pid (), LINUX_NS_PID))
{
warning (_ ("Target and debugger are in different PID "
"namespaces; thread lists and other data are "
@@ -1384,7 +1384,7 @@ thread_db_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
return ptid;
}
- info = get_thread_db_info (ptid_get_pid (ptid));
+ info = get_thread_db_info (ptid.pid ());
/* If this process isn't using thread_db, we're done. */
if (info == NULL)
@@ -1394,7 +1394,7 @@ thread_db_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
{
/* New image, it may or may not end up using thread_db. Assume
not unless we find otherwise. */
- delete_thread_db_info (ptid_get_pid (ptid));
+ delete_thread_db_info (ptid.pid ());
if (!thread_db_list)
unpush_target (&the_thread_db_target);
@@ -1410,7 +1410,7 @@ thread_db_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
void
thread_db_target::mourn_inferior ()
{
- delete_thread_db_info (ptid_get_pid (inferior_ptid));
+ delete_thread_db_info (inferior_ptid.pid ());
beneath ()->mourn_inferior ();
@@ -1716,7 +1716,7 @@ thread_db_target::get_thread_local_address (ptid_t ptid,
{
td_err_e err;
psaddr_t address;
- thread_db_info *info = get_thread_db_info (ptid_get_pid (ptid));
+ thread_db_info *info = get_thread_db_info (ptid.pid ());
thread_db_thread_info *priv = get_thread_db_thread_info (thread_info);
/* Finally, get the address of the variable. */
@@ -1784,7 +1784,7 @@ ptid_t
thread_db_target::get_ada_task_ptid (long lwp, long thread)
{
/* NPTL uses a 1:1 model, so the LWP id suffices. */
- return ptid_t (ptid_get_pid (inferior_ptid), lwp, 0);
+ return ptid_t (inferior_ptid.pid (), lwp, 0);
}
void
@@ -1793,9 +1793,9 @@ thread_db_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
struct thread_db_info *info;
if (ptid_equal (ptid, minus_one_ptid))
- info = get_thread_db_info (ptid_get_pid (inferior_ptid));
+ info = get_thread_db_info (inferior_ptid.pid ());
else
- info = get_thread_db_info (ptid_get_pid (ptid));
+ info = get_thread_db_info (ptid.pid ());
/* This workaround is only needed for child fork lwps stopped in a
PTRACE_O_TRACEFORK event. When the inferior is resumed, the
@@ -1923,7 +1923,7 @@ info_auto_load_libthread_db (const char *args, int from_tty)
static void
maintenance_check_libthread_db (const char *args, int from_tty)
{
- int inferior_pid = ptid_get_pid (inferior_ptid);
+ int inferior_pid = inferior_ptid.pid ();
struct thread_db_info *info;
if (inferior_pid == 0)
diff --git a/gdb/m68k-bsd-nat.c b/gdb/m68k-bsd-nat.c
index 2111c27..120d4c1 100644
--- a/gdb/m68k-bsd-nat.c
+++ b/gdb/m68k-bsd-nat.c
@@ -117,7 +117,7 @@ m68kbsd_collect_fpregset (struct regcache *regcache,
void
m68k_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
{
@@ -146,7 +146,7 @@ m68k_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
void
m68k_bsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
{
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index a12329f..1f36819 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -968,7 +968,7 @@ mi_on_resume_1 (struct mi_interp *mi, ptid_t ptid)
current_token ? current_token : "");
}
- if (ptid_get_pid (ptid) == -1)
+ if (ptid.pid () == -1)
fprintf_unfiltered (mi->raw_stdout, "*running,thread-id=\"all\"\n");
else if (ptid_is_pid (ptid))
{
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 2177abd..6228dd1 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -246,7 +246,7 @@ proceed_thread (struct thread_info *thread, int pid)
if (thread->state != THREAD_STOPPED)
return;
- if (pid != 0 && ptid_get_pid (thread->ptid) != pid)
+ if (pid != 0 && thread->ptid.pid () != pid)
return;
switch_to_thread (thread);
@@ -348,7 +348,7 @@ interrupt_thread_callback (struct thread_info *thread, void *arg)
if (thread->state != THREAD_RUNNING)
return 0;
- if (ptid_get_pid (thread->ptid) != pid)
+ if (thread->ptid.pid () != pid)
return 0;
target_stop (thread->ptid);
@@ -487,7 +487,7 @@ find_thread_of_process (struct thread_info *ti, void *p)
{
int pid = *(int *)p;
- if (ptid_get_pid (ti->ptid) == pid && ti->state != THREAD_EXITED)
+ if (ti->ptid.pid () == pid && ti->state != THREAD_EXITED)
return 1;
return 0;
@@ -623,7 +623,7 @@ collect_cores (struct thread_info *ti, void *xdata)
{
struct collect_cores_data *data = (struct collect_cores_data *) xdata;
- if (ptid_get_pid (ti->ptid) == data->pid)
+ if (ti->ptid.pid () == data->pid)
{
int core = target_core_of_thread (ti->ptid);
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index beb0ea0..8d87dc8 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -462,7 +462,7 @@ mips_linux_nat_target::read_description ()
tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ tid = inferior_ptid.pid ();
errno = 0;
ptrace (PTRACE_PEEKUSER, tid, DSP_CONTROL, 0);
diff --git a/gdb/mips-nbsd-nat.c b/gdb/mips-nbsd-nat.c
index 4c61081..b14828f 100644
--- a/gdb/mips-nbsd-nat.c
+++ b/gdb/mips-nbsd-nat.c
@@ -49,7 +49,7 @@ getregs_supplies (struct gdbarch *gdbarch, int regno)
void
mips_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
struct gdbarch *gdbarch = regcache->arch ();
if (regno == -1 || getregs_supplies (gdbarch, regno))
@@ -79,7 +79,7 @@ mips_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
void
mips_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
{
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
struct gdbarch *gdbarch = regcache->arch ();
if (regno == -1 || getregs_supplies (gdbarch, regno))
diff --git a/gdb/mips64-obsd-nat.c b/gdb/mips64-obsd-nat.c
index 4627cbe..620945e 100644
--- a/gdb/mips64-obsd-nat.c
+++ b/gdb/mips64-obsd-nat.c
@@ -89,7 +89,7 @@ void
mips64_obsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
@@ -104,7 +104,7 @@ static void
mips64_obsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
index 22b265e..3de3e5b 100644
--- a/gdb/nat/aarch64-linux-hw-point.c
+++ b/gdb/nat/aarch64-linux-hw-point.c
@@ -357,7 +357,7 @@ aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state,
int is_watchpoint, unsigned int idx)
{
struct aarch64_dr_update_callback_param param;
- ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ()));
+ ptid_t pid_ptid = ptid_t (current_lwp_ptid ().pid ());
param.is_watchpoint = is_watchpoint;
param.idx = idx;
diff --git a/gdb/nat/aarch64-linux.c b/gdb/nat/aarch64-linux.c
index 35ecdc2..c3c29a0 100644
--- a/gdb/nat/aarch64-linux.c
+++ b/gdb/nat/aarch64-linux.c
@@ -47,7 +47,7 @@ aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
ptid_t ptid = ptid_of_lwp (lwp);
int tid = ptid_get_lwp (ptid);
struct aarch64_debug_reg_state *state
- = aarch64_get_debug_reg_state (ptid_get_pid (ptid));
+ = aarch64_get_debug_reg_state (ptid.pid ());
if (show_debug_regs)
debug_printf ("prepare_to_resume thread %d\n", tid);
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index 8eadf7a..b2c30b3 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -471,7 +471,7 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf)
pid = ptid_get_lwp (ptid);
if (pid == 0)
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
errno = 0;
scoped_fd fd (syscall (SYS_perf_event_open, &bts->attr, pid, -1, -1, 0));
@@ -587,7 +587,7 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
pid = ptid_get_lwp (ptid);
if (pid == 0)
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
gdb::unique_xmalloc_ptr<btrace_target_info> tinfo
(XCNEW (btrace_target_info));
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 1f3a911..358a89e 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_get_pid (ptid), (PID_T) ptid_get_lwp (ptid));
+ (PID_T) ptid.pid (), (PID_T) ptid_get_lwp (ptid));
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 5a94641..a672cdf 100644
--- a/gdb/nat/linux-procfs.c
+++ b/gdb/nat/linux-procfs.c
@@ -239,8 +239,8 @@ linux_proc_tid_get_name (ptid_t ptid)
static char comm_buf[TASK_COMM_LEN];
char comm_path[100];
const char *comm_val;
- pid_t pid = ptid_get_pid (ptid);
- pid_t tid = ptid_lwp_p (ptid) ? ptid_get_lwp (ptid) : ptid_get_pid (ptid);
+ pid_t pid = ptid.pid ();
+ pid_t tid = ptid_lwp_p (ptid) ? ptid_get_lwp (ptid) : 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 9865ac6..d362c30 100644
--- a/gdb/nat/x86-linux-dregs.c
+++ b/gdb/nat/x86-linux-dregs.c
@@ -102,7 +102,7 @@ x86_linux_dr_get_addr (int regnum)
void
x86_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
- ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ()));
+ ptid_t pid_ptid = ptid_t (current_lwp_ptid ().pid ());
gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR);
@@ -122,7 +122,7 @@ x86_linux_dr_get_control (void)
void
x86_linux_dr_set_control (unsigned long control)
{
- ptid_t pid_ptid = ptid_t (ptid_get_pid (current_lwp_ptid ()));
+ ptid_t pid_ptid = ptid_t (current_lwp_ptid ().pid ());
iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
}
@@ -148,7 +148,7 @@ x86_linux_update_debug_registers (struct lwp_info *lwp)
if (lwp_debug_registers_changed (lwp))
{
struct x86_debug_reg_state *state
- = x86_debug_reg_state (ptid_get_pid (ptid));
+ = x86_debug_reg_state (ptid.pid ());
int i;
/* Prior to Linux kernel 2.6.33 commit
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 7591a60..53797c8 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -311,7 +311,7 @@ nto_procfs_target::thread_alive (ptid_t ptid)
int err;
tid = ptid_get_tid (ptid);
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
if (kill (pid, 0) == -1)
return false;
@@ -398,7 +398,7 @@ nto_procfs_target::update_thread_list ()
prune_threads ();
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
status.tid = 1;
@@ -746,7 +746,7 @@ do_attach (ptid_t ptid)
char path[PATH_MAX];
snprintf (path, PATH_MAX - 1, "%s%s/%d/as",
- (nodestr != NULL) ? nodestr : "", "/proc", ptid_get_pid (ptid));
+ (nodestr != NULL) ? nodestr : "", "/proc", ptid.pid ());
ctl_fd = open (path, O_RDWR);
if (ctl_fd == -1)
error (_("Couldn't open proc file %s, error %d (%s)"), path, errno,
@@ -764,9 +764,9 @@ do_attach (ptid_t ptid)
if (devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0) == EOK
&& status.flags & _DEBUG_FLAG_STOPPED)
- SignalKill (nto_node (), ptid_get_pid (ptid), 0, SIGCONT, 0, 0);
+ SignalKill (nto_node (), ptid.pid (), 0, SIGCONT, 0, 0);
nto_init_solib_absolute_prefix ();
- return ptid_t (ptid_get_pid (ptid), 0, status.tid);
+ return ptid_t (ptid.pid (), 0, status.tid);
}
/* Ask the user what to do when an interrupt is received. */
@@ -873,7 +873,7 @@ nto_procfs_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
{
int waitval = 0;
- waitpid (ptid_get_pid (inferior_ptid), &waitval, WNOHANG);
+ waitpid (inferior_ptid.pid (), &waitval, WNOHANG);
if (exit_signo)
{
/* Abnormal death. */
@@ -1013,12 +1013,12 @@ nto_procfs_target::detach (inferior *inf, int from_tty)
target_announce_detach ();
if (siggnal)
- SignalKill (nto_node (), ptid_get_pid (inferior_ptid), 0, 0, 0, 0);
+ SignalKill (nto_node (), inferior_ptid.pid (), 0, 0, 0, 0);
close (ctl_fd);
ctl_fd = -1;
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
inferior_ptid = null_ptid;
detach_inferior (pid);
init_thread_list ();
@@ -1113,7 +1113,7 @@ nto_procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
{
if (signal_to_pass != status.info.si_signo)
{
- SignalKill (nto_node (), ptid_get_pid (inferior_ptid), 0,
+ SignalKill (nto_node (), inferior_ptid.pid (), 0,
signal_to_pass, 0, 0);
run.flags |= _DEBUG_RUN_CLRFLT | _DEBUG_RUN_CLRSIG;
}
@@ -1137,7 +1137,7 @@ nto_procfs_target::mourn_inferior ()
{
if (!ptid_equal (inferior_ptid, null_ptid))
{
- SignalKill (nto_node (), ptid_get_pid (inferior_ptid), 0, SIGKILL, 0, 0);
+ SignalKill (nto_node (), inferior_ptid.pid (), 0, SIGKILL, 0, 0);
close (ctl_fd);
}
inferior_ptid = null_ptid;
@@ -1468,7 +1468,7 @@ nto_procfs_target::pid_to_str (ptid_t ptid)
int pid, tid, n;
struct tidinfo *tip;
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
tid = ptid_get_tid (ptid);
n = snprintf (buf, 1023, "process %d", pid);
diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c
index ac05fae..a3058b0 100644
--- a/gdb/obsd-nat.c
+++ b/gdb/obsd-nat.c
@@ -52,7 +52,7 @@ obsd_nat_target::pid_to_str (ptid_t ptid)
void
obsd_nat_target::update_thread_list ()
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
struct ptrace_thread_state pts;
prune_threads ();
@@ -90,7 +90,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
do
{
- pid = waitpid (ptid_get_pid (ptid), &status, 0);
+ pid = waitpid (ptid.pid (), &status, 0);
save_errno = errno;
}
while (pid == -1 && errno == EINTR);
@@ -110,7 +110,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
}
/* Ignore terminated detached child processes. */
- if (!WIFSTOPPED (status) && pid != ptid_get_pid (inferior_ptid))
+ if (!WIFSTOPPED (status) && pid != inferior_ptid.pid ())
pid = -1;
}
while (pid == -1);
@@ -142,7 +142,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
gdb_assert (pe.pe_report_event == PTRACE_FORK);
gdb_assert (pe.pe_other_pid == pid);
- if (fpid == ptid_get_pid (inferior_ptid))
+ if (fpid == inferior_ptid.pid ())
{
ourstatus->value.related_pid = ptid_t (pe.pe_other_pid);
return ptid_t (fpid);
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index f9ec3176..09cb247 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1226,7 +1226,7 @@ have_ptrace_hwdebug_interface (void)
tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ tid = inferior_ptid.pid ();
/* Check for kernel support for PowerPC HWDEBUG ptrace interface. */
if (ptrace (PPC_PTRACE_GETHWDBGINFO, tid, 0, &hwdebug_info) >= 0)
@@ -1298,7 +1298,7 @@ ppc_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot)
ptrace call will return -1. Fail in that case. */
tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (ptid);
+ tid = ptid.pid ();
if (ptrace (PTRACE_SET_DEBUGREG, tid, 0, 0) == -1)
return 0;
@@ -2185,7 +2185,7 @@ ppc_linux_nat_target::auxv_parse (gdb_byte **readptr,
{
int tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ tid = inferior_ptid.pid ();
int sizeof_auxv_field = ppc_linux_target_wordsize (tid);
@@ -2212,7 +2212,7 @@ ppc_linux_nat_target::read_description ()
{
int tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ tid = inferior_ptid.pid ();
if (have_ptrace_getsetevrregs)
{
diff --git a/gdb/ppc-nbsd-nat.c b/gdb/ppc-nbsd-nat.c
index ea163f3..abdc0ee 100644
--- a/gdb/ppc-nbsd-nat.c
+++ b/gdb/ppc-nbsd-nat.c
@@ -88,7 +88,7 @@ void
ppc_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
{
@@ -117,7 +117,7 @@ void
ppc_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
{
diff --git a/gdb/ppc-obsd-nat.c b/gdb/ppc-obsd-nat.c
index ee71b742..af5f348 100644
--- a/gdb/ppc-obsd-nat.c
+++ b/gdb/ppc-obsd-nat.c
@@ -82,7 +82,7 @@ void
ppc_obsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
@@ -116,7 +116,7 @@ void
ppc_obsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index 393cd90..8340f95 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -204,7 +204,7 @@ ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
pid_t
ps_getpid (struct ps_prochandle *ph)
{
- return ptid_get_pid (ph->thread->ptid);
+ return ph->thread->ptid.pid ();
}
void
diff --git a/gdb/procfs.c b/gdb/procfs.c
index df23966..77a679c 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_get_pid (ptid), ptid_get_lwp (ptid))) == NULL)
+ if ((pi = find_procinfo (ptid.pid (), ptid_get_lwp (ptid))) == NULL)
{
warning (_("procfs_find_LDT_entry: could not find procinfo for %d:%ld."),
- ptid_get_pid (ptid), ptid_get_lwp (ptid));
+ ptid.pid (), ptid_get_lwp (ptid));
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_get_pid (ptid), ptid_get_lwp (ptid));
+ ptid.pid (), ptid_get_lwp (ptid));
return NULL;
}
/* Now extract the GS register's lower 16 bits. */
@@ -1910,7 +1910,7 @@ procfs_target::attach (const char *args, int from_tty)
void
procfs_target::detach (inferior *inf, int from_tty)
{
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
if (from_tty)
{
@@ -1940,14 +1940,14 @@ do_attach (ptid_t ptid)
int fail;
int lwpid;
- if ((pi = create_procinfo (ptid_get_pid (ptid), 0)) == NULL)
+ if ((pi = create_procinfo (ptid.pid (), 0)) == NULL)
perror (_("procfs: out of memory in 'attach'"));
if (!open_procinfo_files (pi, FD_CTL))
{
fprintf_filtered (gdb_stderr, "procfs:%d -- ", __LINE__);
sprintf (errmsg, "do_attach: couldn't open /proc file for process %d",
- ptid_get_pid (ptid));
+ ptid.pid ());
dead_procinfo (pi, errmsg, NOKILL);
}
@@ -2008,7 +2008,7 @@ do_detach ()
procinfo *pi;
/* Find procinfo for the main process. */
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid),
+ pi = find_procinfo_or_die (inferior_ptid.pid (),
0); /* FIXME: threads */
if (!proc_set_traced_signals (pi, &pi->saved_sigset))
@@ -2064,7 +2064,7 @@ procfs_target::fetch_registers (struct regcache *regcache, int regnum)
gdb_gregset_t *gregs;
procinfo *pi;
pti[...]
[diff truncated at 100000 bytes]