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.
+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.
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;
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);
}
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);
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);
{
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,
{
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,
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
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
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
{
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;
while (1)
{
- if (getthrds (ptid_get_pid (inferior_ptid), &thrinf,
+ if (getthrds (inferior_ptid.pid (), &thrinf,
sizeof (thrinf), &ktid, 1) != 1)
break;
/* 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)
{
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
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. */
{
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);
}
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);
}
{
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"));
{
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"));
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"));
{
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"));
}
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));
{
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;
/* 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))
{
/* 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))
{
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)
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)
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
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;
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
}
}
- 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);
}
}
- 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);
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. */
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
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
}
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;
}
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);
}
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
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
}
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;
}
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);
}
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
{
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);
}
}
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;
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;
}
/* 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)
{
/* 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);
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;
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)
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;
if (tid != 0)
{
snprintf (buf, sizeof (buf), _("Thread 0x%lx of process %u"),
- tid, ptid_get_pid (ptid));
+ tid, ptid.pid ());
return buf;
}
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. */
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;
}
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;
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;
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."));
}
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
switch (object)
{
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;
{
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];
#else
prune_threads ();
- fbsd_add_threads (ptid_get_pid (inferior_ptid));
+ fbsd_add_threads (inferior_ptid.pid ());
#endif
}
/* 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
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))
{
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))
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"));
}
/* 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
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. */
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. */
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;
{
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);
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)
+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.
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
/* 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);
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;
|| 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)))
{
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)
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. */
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);
{
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);
{
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)
{
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
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. */
if (cs.multi_process)
{
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
if (pid < 0)
buf += sprintf (buf, "p-%x.", -pid);
else
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;
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 ())
{
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. */
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))
{
}
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;
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;
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. */
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;
}
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);
/* 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);
}
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))
{
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))
{
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))
{
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)
{
{
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;
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);
}
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. */
/* 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"));
}
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 ();
}
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);
void
inf_ptrace_target::kill ()
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
int status;
if (pid == 0)
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;
}
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);
do
{
- pid = waitpid (ptid_get_pid (ptid), &status, 0);
+ pid = waitpid (ptid.pid (), &status, 0);
save_errno = errno;
}
while (pid == -1 && errno == EINTR);
}
/* 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);
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);
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. */
{
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
/* 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 ();
}
/* 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);
}
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)
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;
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);
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. */
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
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;
pass_signal (int signo)
{
#ifndef _WIN32
- kill (ptid_get_pid (inferior_ptid), SIGINT);
+ kill (inferior_ptid.pid (), SIGINT);
#endif
}
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,
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;
/* 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;
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,
{
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.
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
{
/* 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
{
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));
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));
}
"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));
}
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;
/* 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
{
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);
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))
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;
/* 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;
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. */
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
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);
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);
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));
}
}
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)
{
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. */
/* 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);
}
{
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);
}
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. */
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;
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);
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);
{
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;
/* 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);
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;
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 ())
/* 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;
}
}
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'
"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;
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;
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
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);
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);
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,
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;
}
{
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;
{
/* 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;
|| 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);
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. */
void
linux_nat_target::mourn_inferior ()
{
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
purge_lwp_list (pid);
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;
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;
{
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);
/* 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);
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);
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;
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
{
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);
{
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
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;
{
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;
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));
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 ();
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;
}
{
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;
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 "
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)
{
/* 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);
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 ();
{
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. */
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
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
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)
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))
{
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))
{
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))
{
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);
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);
{
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;
{
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);
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);
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))
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))
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"));
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"));
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;
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);
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));
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));
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;
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);
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);
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);
}
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
int err;
tid = ptid_get_tid (ptid);
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
if (kill (pid, 0) == -1)
return false;
prune_threads ();
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
status.tid = 1;
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,
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. */
{
int waitval = 0;
- waitpid (ptid_get_pid (inferior_ptid), &waitval, WNOHANG);
+ waitpid (inferior_ptid.pid (), &waitval, WNOHANG);
if (exit_signo)
{
/* Abnormal death. */
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 ();
{
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;
}
{
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;
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);
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 ();
do
{
- pid = waitpid (ptid_get_pid (ptid), &status, 0);
+ pid = waitpid (ptid.pid (), &status, 0);
save_errno = errno;
}
while (pid == -1 && errno == EINTR);
}
/* 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);
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);
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)
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;
{
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);
{
int tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ tid = inferior_ptid.pid ();
if (have_ptrace_getsetevrregs)
{
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))
{
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))
{
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"));
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"));
pid_t
ps_getpid (struct ps_prochandle *ph)
{
- return ptid_get_pid (ph->thread->ptid);
+ return ph->thread->ptid.pid ();
}
void
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. */
void
procfs_target::detach (inferior *inf, int from_tty)
{
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
if (from_tty)
{
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);
}
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))
gdb_gregset_t *gregs;
procinfo *pi;
ptid_t ptid = regcache->ptid ();
- int pid = ptid_get_pid (ptid);
+ int pid = ptid.pid ();
int tid = ptid_get_lwp (ptid);
struct gdbarch *gdbarch = regcache->arch ();
gdb_gregset_t *gregs;
procinfo *pi;
ptid_t ptid = regcache->ptid ();
- int pid = ptid_get_pid (ptid);
+ int pid = ptid.pid ();
int tid = ptid_get_lwp (ptid);
struct gdbarch *gdbarch = regcache->arch ();
retval = ptid_t (-1);
/* Find procinfo for main process. */
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
if (pi)
{
/* We must assume that the status is stale now... */
wait_retval = ::wait (&wstat); /* "wait" for the child's exit. */
/* Wrong child? */
- if (wait_retval != ptid_get_pid (inferior_ptid))
+ if (wait_retval != inferior_ptid.pid ())
error (_("procfs: couldn't stop "
"process %d: wait returned %d."),
- ptid_get_pid (inferior_ptid), wait_retval);
+ inferior_ptid.pid (), wait_retval);
/* FIXME: might I not just use waitpid?
Or try find_procinfo to see if I know about this child? */
retval = ptid_t (wait_retval);
}
/* Got this far without error: If retval isn't in the
threads database, add it. */
- if (ptid_get_pid (retval) > 0 &&
+ if (retval.pid () > 0 &&
!ptid_equal (retval, inferior_ptid) &&
!in_thread_list (retval))
{
GDB's list and to our own. If we don't create a
procinfo, resume may be unhappy later. */
add_thread (retval);
- if (find_procinfo (ptid_get_pid (retval),
+ if (find_procinfo (retval.pid (),
ptid_get_lwp (retval)) == NULL)
- create_procinfo (ptid_get_pid (retval),
+ create_procinfo (retval.pid (),
ptid_get_lwp (retval));
}
}
int nbytes;
/* Find procinfo for main process. */
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
if (pi->as_fd == 0 &&
open_procinfo_files (pi, FD_AS) == 0)
{
to proc_run_process (for use in the prrun struct by ioctl). */
/* Find procinfo for main process. */
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
/* First cut: ignore pid argument. */
errno = 0;
/* Void the process procinfo's caches. */
invalidate_cache (NULL, pi, NULL);
- if (ptid_get_pid (ptid) != -1)
+ if (ptid.pid () != -1)
{
/* Resume a specific thread, presumably suppressing the
others. */
- thread = find_procinfo (ptid_get_pid (ptid), ptid_get_lwp (ptid));
+ thread = find_procinfo (ptid.pid (), ptid_get_lwp (ptid));
if (thread != NULL)
{
if (thread->tid != 0)
procfs_target::pass_signals (int numsigs, unsigned char *pass_signals)
{
sigset_t signals;
- procinfo *pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
int signo;
prfillset (&signals);
if (!ptid_equal (inferior_ptid, null_ptid)) /* ? */
{
/* Find procinfo for main process. */
- procinfo *pi = find_procinfo (ptid_get_pid (inferior_ptid), 0);
+ procinfo *pi = find_procinfo (inferior_ptid.pid (), 0);
if (pi)
unconditionally_kill_inferior (pi);
if (!ptid_equal (inferior_ptid, null_ptid))
{
/* Find procinfo for main process. */
- pi = find_procinfo (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo (inferior_ptid.pid (), 0);
if (pi)
destroy_procinfo (pi);
}
prune_threads ();
/* Find procinfo for main process. */
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
proc_update_threads (pi);
proc_iterate_over_threads (pi, procfs_notice_thread, NULL);
}
int proc, thread;
procinfo *pi;
- proc = ptid_get_pid (ptid);
+ proc = ptid.pid ();
thread = ptid_get_lwp (ptid);
/* If I don't know it, it ain't alive! */
if ((pi = find_procinfo (proc, thread)) == NULL)
static char buf[80];
if (ptid_get_lwp (ptid) == 0)
- sprintf (buf, "process %d", ptid_get_pid (ptid));
+ sprintf (buf, "process %d", ptid.pid ());
else
sprintf (buf, "LWP %ld", ptid_get_lwp (ptid));
int pflags = 0;
procinfo *pi;
- pi = find_procinfo_or_die (ptid_get_pid (ptid) == -1 ?
- ptid_get_pid (inferior_ptid) : ptid_get_pid (ptid),
+ pi = find_procinfo_or_die (ptid.pid () == -1 ?
+ inferior_ptid.pid () : ptid.pid (),
0);
/* Translate from GDB's flags to /proc's. */
{
procinfo *pi;
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
if (proc_flags (pi) & (PR_STOPPED | PR_ISTOP))
{
{
procinfo *pi;
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
return proc_watchpoint_address (pi, addr);
}
int
procfs_target::find_memory_regions (find_memory_region_ftype func, void *data)
{
- procinfo *pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
return iterate_over_mappings (pi, func, data,
find_memory_regions_callback);
}
}
if (pid == 0)
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
if (pid == 0)
error (_("No current process: you must name one."));
else
{
procinfo *pi;
- if (ptid_get_pid (inferior_ptid) <= 0)
+ if (inferior_ptid.pid () <= 0)
error (_("you must be debugging a process to use this command."));
if (args == NULL || args[0] == 0)
error_no_arg (_("system call to trace"));
- pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
if (isdigit (args[0]))
{
const int syscallnum = atoi (args);
gdb_fpregset_t fpregs;
unsigned long merged_pid;
- merged_pid = ptid_get_lwp (ptid) << 16 | ptid_get_pid (ptid);
+ merged_pid = ptid_get_lwp (ptid) << 16 | ptid.pid ();
/* This part is the old method for fetching registers.
It should be replaced by the newer one using regsets
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;
gdb_fpregset_t fpregs;
char fname[16] = {'\0'};
char psargs[80] = {'\0'};
- procinfo *pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
+ procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
char *note_data = NULL;
char *inf_args;
struct procfs_corefile_thread_data thread_args;
fill_gregset (get_current_regcache (), &gregs, -1);
note_data = elfcore_write_pstatus (obfd, note_data, note_size,
- ptid_get_pid (inferior_ptid),
+ inferior_ptid.pid (),
stop_signal, &gregs);
thread_args.obfd = obfd;
if (!ret)
return NULL;
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
lwp = ptid_get_lwp (ptid);
tid = ptid_get_tid (ptid);
return ptid;
base_cpu = ravenscar_get_thread_base_cpu (ptid);
- return ptid_t (ptid_get_pid (ptid), base_cpu, 0);
+ return ptid_t (ptid.pid (), base_cpu, 0);
}
/* Fetch the ravenscar running thread from target memory and
if (tid == 0)
return null_ptid;
else
- return ptid_t (ptid_get_pid (base_ptid), 0, tid);
+ return ptid_t (base_ptid.pid (), 0, tid);
}
const char *
ptid_t
ravenscar_thread_target::get_ada_task_ptid (long lwp, long thread)
{
- return ptid_t (ptid_get_pid (base_ptid), 0, thread);
+ return ptid_t (base_ptid.pid (), 0, thread);
}
/* Command-list for the "set/show ravenscar" prefix command. */
{
/* Default recfile name is "gdb_record.PID". */
xsnprintf (recfilename_buffer, sizeof (recfilename_buffer),
- "gdb_record.%d", ptid_get_pid (inferior_ptid));
+ "gdb_record.%d", inferior_ptid.pid ());
recfilename = recfilename_buffer;
}
get_sim_inferior_data_by_ptid (ptid_t ptid, int sim_instance_needed)
{
struct inferior *inf;
- int pid = ptid_get_pid (ptid);
+ int pid = ptid.pid ();
if (pid <= 0)
return NULL;
error (_("Unable to create sim inferior."));
inferior_ptid = sim_data->remote_sim_ptid;
- inferior_appeared (current_inferior (), ptid_get_pid (inferior_ptid));
+ inferior_appeared (current_inferior (), inferior_ptid.pid ());
add_thread_silent (inferior_ptid);
insert_breakpoints (); /* Needed to get correct instruction
sim_data = get_sim_inferior_data_by_ptid (ptid, SIM_INSTANCE_NEEDED);
if (sim_data == NULL)
error (_("Unable to wait for pid %d. Inferior not found."),
- ptid_get_pid (ptid));
+ ptid.pid ());
inferior_ptid = ptid;
}
if (!in_thread_list (currthread))
{
struct inferior *inf = NULL;
- int pid = ptid_get_pid (currthread);
+ int pid = currthread.pid ();
if (ptid_is_pid (inferior_ptid)
- && pid == ptid_get_pid (inferior_ptid))
+ && pid == inferior_ptid.pid ())
{
/* inferior_ptid has no thread member yet. This can happen
with the vAttach -> remote_wait,"TAAthread:" path if the
extended-remote which already was debugging an inferior, we
may not know about it yet. Add it before adding its child
thread, so notifications are emitted in a sensible order. */
- if (find_inferior_pid (ptid_get_pid (currthread)) == NULL)
+ if (find_inferior_pid (currthread.pid ()) == NULL)
{
struct remote_state *rs = get_remote_state ();
int fake_pid_p = !remote_multi_process_p (rs);
inf = remote_add_inferior (fake_pid_p,
- ptid_get_pid (currthread), -1, 1);
+ currthread.pid (), -1, 1);
}
/* This is really a new thread. Add it. */
/* We only need to change the remote current thread if it's pointing
at some other process. */
- if (ptid_get_pid (rs->general_thread) != ptid_get_pid (inferior_ptid))
+ if (rs->general_thread.pid () != inferior_ptid.pid ())
set_general_thread (inferior_ptid);
}
/* The main thread is always alive. */
return 1;
- if (ptid_get_pid (ptid) != 0 && ptid_get_lwp (ptid) == 0)
+ if (ptid.pid () != 0 && ptid_get_lwp (ptid) == 0)
/* The main thread is always alive. This can happen after a
vAttach, if the remote side doesn't support
multi-threading. */
if (remote_multi_process_p (rs))
{
- pid = ptid_get_pid (ptid);
+ pid = ptid.pid ();
if (pid < 0)
buf += xsnprintf (buf, endbuf - buf, "p-%x.", -pid);
else
then since there's no way to know the pid of the reported
threads, use the magic number. */
if (ptid_equal (inferior_ptid, null_ptid))
- pid = ptid_get_pid (magic_null_ptid);
+ pid = magic_null_ptid.pid ();
else
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
if (obuf)
*obuf = pp;
_("remote_threads_extra_info"));
if (ptid_equal (tp->ptid, magic_null_ptid)
- || (ptid_get_pid (tp->ptid) != 0 && ptid_get_lwp (tp->ptid) == 0))
+ || (tp->ptid.pid () != 0 && ptid_get_lwp (tp->ptid) == 0))
/* This is the main thread which was added by GDB. The remote
server doesn't know about it. */
return NULL;
ptid_t
remote_target::get_ada_task_ptid (long lwp, long thread)
{
- return ptid_t (ptid_get_pid (inferior_ptid), lwp, 0);
+ return ptid_t (inferior_ptid.pid (), lwp, 0);
}
\f
fake_pid_p = 1;
}
- remote_add_inferior (fake_pid_p, ptid_get_pid (curr_ptid), -1, 1);
+ remote_add_inferior (fake_pid_p, curr_ptid.pid (), -1, 1);
/* Add the main thread and switch to it. Don't try reading
registers yet, since we haven't fetched the target description
void
remote_target::remote_detach_1 (inferior *inf, int from_tty)
{
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
struct remote_state *rs = get_remote_state ();
int is_fork_parent;
pid_t child_pid;
child_ptid = inferior_thread ()->pending_follow.value.related_pid;
- child_pid = ptid_get_pid (child_ptid);
+ child_pid = child_ptid.pid ();
remote_detach_pid (child_pid);
}
ptid_t nptid;
/* All (-1) threads of process. */
- nptid = ptid_t (ptid_get_pid (ptid), -1, 0);
+ nptid = ptid_t (ptid.pid (), -1, 0);
p += xsnprintf (p, endp - p, ":");
p = write_ptid (p, endp, nptid);
if (ptid_is_pid (ptid))
/* All (-1) threads of process. */
- nptid = ptid_t (ptid_get_pid (ptid), -1, 0);
+ nptid = ptid_t (ptid.pid (), -1, 0);
else
{
/* Small optimization: if we already have a stop reply for
if (ws->kind == TARGET_WAITKIND_FORKED
|| ws->kind == TARGET_WAITKIND_VFORKED)
{
- if (event_pid == -1 || event_pid == ptid_get_pid (thread_ptid))
+ if (event_pid == -1 || event_pid == thread_ptid.pid ())
return 1;
}
reply = (struct stop_reply *) rns->pending_event[notif_client_stop.id];
/* Discard the in-flight notification. */
- if (reply != NULL && ptid_get_pid (reply->ptid) == inf->pid)
+ if (reply != NULL && reply->ptid.pid () == inf->pid)
{
stop_reply_xfree (reply);
rns->pending_event[notif_client_stop.id] = NULL;
}
/* If no process is specified, assume inferior_ptid. */
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
if (*p == '\0')
;
else if (*p == ';')
remote_target::kill ()
{
int res = -1;
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
struct remote_state *rs = get_remote_state ();
if (packet_support (PACKET_vKill) != PACKET_DISABLE)
threadalive_test (const char *cmd, int tty)
{
int sample_thread = SAMPLE_THREAD;
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
ptid_t ptid = ptid_t (pid, sample_thread, 0);
if (remote_thread_alive (ptid))
return normal_pid_to_str (ptid);
else
xsnprintf (buf, sizeof buf, "Thread %d.%ld",
- ptid_get_pid (ptid), ptid_get_lwp (ptid));
+ ptid.pid (), ptid_get_lwp (ptid));
else
xsnprintf (buf, sizeof buf, "Thread %ld",
ptid_get_lwp (ptid));
struct gdbarch *gdbarch = regcache->arch ();
int addr[PPC_MAX_REGISTER_SIZE];
int nr, isfloat;
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
/* Retrieved values may be -1, so infer errors from errno. */
errno = 0;
struct gdbarch *gdbarch = regcache->arch ();
int addr[PPC_MAX_REGISTER_SIZE];
int nr, isfloat;
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
/* Fetch the register's value from the register cache. */
regcache->raw_collect (regno, addr);
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
int arch64 = ARCH64 ();
switch (object)
do
{
- pid = waitpid (ptid_get_pid (ptid), &status, 0);
+ pid = waitpid (ptid.pid (), &status, 0);
save_errno = errno;
}
while (pid == -1 && errno == EINTR);
}
/* 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);
static gdb::byte_vector
rs6000_ptrace_ldinfo (ptid_t ptid)
{
- const int pid = ptid_get_pid (ptid);
+ const int pid = ptid.pid ();
gdb::byte_vector ldi (1024);
int rc = -1;
/* GNU/Linux LWP ID's are process ID's. */
int tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ tid = inferior_ptid.pid (); /* Not a threaded program. */
return tid;
}
/* GDB core assumes the child inherits the watchpoints/hw breakpoints of
the parent. So copy the debug state from parent to child. */
- parent_pid = ptid_get_pid (parent->ptid);
+ parent_pid = parent->ptid.pid ();
parent_state = s390_get_debug_reg_state (parent_pid);
child_state = s390_get_debug_reg_state (child_pid);
s390_linux_nat_target::stopped_by_watchpoint ()
{
struct s390_debug_reg_state *state
- = s390_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = s390_get_debug_reg_state (inferior_ptid.pid ());
per_lowcore_bits per_lowcore;
ptrace_area parea;
s390_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
{
int tid;
- pid_t pid = ptid_get_pid (ptid_of_lwp (lp));
+ pid_t pid = ptid_of_lwp (lp).pid ();
per_struct per_info;
ptrace_area parea;
static int
s390_refresh_per_info (void)
{
- 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, s390_refresh_per_info_cb, NULL);
return 0;
{
s390_watch_area area;
struct s390_debug_reg_state *state
- = s390_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = s390_get_debug_reg_state (inferior_ptid.pid ());
area.lo_addr = addr;
area.hi_addr = addr + len - 1;
unsigned ix;
s390_watch_area *area;
struct s390_debug_reg_state *state
- = s390_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = s390_get_debug_reg_state (inferior_ptid.pid ());
for (ix = 0;
VEC_iterate (s390_watch_area, state->watch_areas, ix, area);
area.lo_addr = bp_tgt->placed_address = bp_tgt->reqstd_address;
area.hi_addr = area.lo_addr;
- state = s390_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+ state = s390_get_debug_reg_state (inferior_ptid.pid ());
VEC_safe_push (s390_watch_area, state->break_areas, &area);
return s390_refresh_per_info ();
struct watch_area *area;
struct s390_debug_reg_state *state;
- state = s390_get_debug_reg_state (ptid_get_pid (inferior_ptid));
+ state = s390_get_debug_reg_state (inferior_ptid.pid ());
for (ix = 0;
VEC_iterate (s390_watch_area, state->break_areas, ix, area);
ix++)
void
sh_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno))
{
void
sh_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
{
- pid_t pid = ptid_get_pid (regcache->ptid ());
+ pid_t pid = regcache->ptid ().pid ();
if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno))
{
td_state_string (ti.ti_state));
}
- return ptid_t (ptid_get_pid (thread_id), ti.ti_lid, 0);
+ return ptid_t (thread_id.pid (), ti.ti_lid, 0);
}
/* Convert an LWP ID into a POSIX or Solaris thread ID. If LWP_ID
else if (val != TD_OK)
error (_("lwp_to_thread: td_thr_get_info: %s."), td_err_string (val));
- return ptid_t (ptid_get_pid (lwp), 0 , ti.ti_tid);
+ return ptid_t (lwp.pid (), 0 , ti.ti_tid);
}
\f
target_ops *beneath = this->beneath ();
sol_thread_active = 0;
- inferior_ptid = ptid_t (ptid_get_pid (main_ph.ptid));
+ inferior_ptid = ptid_t (main_ph.ptid.pid ());
unpush_target (this);
beneath->detach (inf, from_tty);
}
{
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
- inferior_ptid = thread_to_lwp (inferior_ptid, ptid_get_pid (main_ph.ptid));
- if (ptid_get_pid (inferior_ptid) == -1)
+ inferior_ptid = thread_to_lwp (inferior_ptid, main_ph.ptid.pid ());
+ if (inferior_ptid.pid () == -1)
inferior_ptid = procfs_first_available ();
- if (ptid_get_pid (ptid) != -1)
+ if (ptid.pid () != -1)
{
ptid_t save_ptid = ptid;
ptid = thread_to_lwp (ptid, -2);
- if (ptid_get_pid (ptid) == -2) /* Inactive thread. */
+ if (ptid.pid () == -2) /* Inactive thread. */
error (_("This version of Solaris can't start inactive threads."));
- if (info_verbose && ptid_get_pid (ptid) == -1)
+ if (info_verbose && ptid.pid () == -1)
warning (_("Specified thread %ld seems to have terminated"),
ptid_get_tid (save_ptid));
}
save_ptid = inferior_ptid;
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
- inferior_ptid = thread_to_lwp (inferior_ptid, ptid_get_pid (main_ph.ptid));
- if (ptid_get_pid (inferior_ptid) == -1)
+ inferior_ptid = thread_to_lwp (inferior_ptid, main_ph.ptid.pid ());
+ if (inferior_ptid.pid () == -1)
inferior_ptid = procfs_first_available ();
- if (ptid_get_pid (ptid) != -1)
+ if (ptid.pid () != -1)
{
ptid_t save_ptid = ptid;
ptid = thread_to_lwp (ptid, -2);
- if (ptid_get_pid (ptid) == -2) /* Inactive thread. */
+ if (ptid.pid () == -2) /* Inactive thread. */
error (_("This version of Solaris can't start inactive threads."));
- if (info_verbose && ptid_get_pid (ptid) == -1)
+ if (info_verbose && ptid.pid () == -1)
warning (_("Specified thread %ld seems to have terminated"),
ptid_get_tid (save_ptid));
}
{
/* Map the LWP of interest back to the appropriate thread ID. */
rtnval = lwp_to_thread (rtnval);
- if (ptid_get_pid (rtnval) == -1)
+ if (rtnval.pid () == -1)
rtnval = save_ptid;
/* See if we have a new thread. */
main_ph.ptid = inferior_ptid; /* Save for xfer_memory. */
ptid = lwp_to_thread (inferior_ptid);
- if (ptid_get_pid (ptid) != -1)
+ if (ptid.pid () != -1)
inferior_ptid = ptid;
target_update_thread_list ();
ps_err_e
ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
{
- ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
+ ptid_t ptid = ptid_t (inferior_ptid.pid (), lwpid, 0);
struct regcache *regcache
= get_thread_arch_regcache (ptid, target_gdbarch ());
ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid,
const prgregset_t gregset)
{
- ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
+ ptid_t ptid = ptid_t (inferior_ptid.pid (), lwpid, 0);
struct regcache *regcache
= get_thread_arch_regcache (ptid, target_gdbarch ());
ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
prfpregset_t *fpregset)
{
- ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
+ ptid_t ptid = ptid_t (inferior_ptid.pid (), lwpid, 0);
struct regcache *regcache
= get_thread_arch_regcache (ptid, target_gdbarch ());
ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
const prfpregset_t * fpregset)
{
- ptid_t ptid = ptid_t (ptid_get_pid (inferior_ptid), lwpid, 0);
+ ptid_t ptid = ptid_t (inferior_ptid.pid (), lwpid, 0);
struct regcache *regcache
= get_thread_arch_regcache (ptid, target_gdbarch ());
/* FIXME: can't I get the process ID from the prochandle or
something? */
- if (ptid_get_pid (inferior_ptid) <= 0 || lwpid <= 0)
+ if (inferior_ptid.pid () <= 0 || lwpid <= 0)
return PS_BADLID;
- ret = procfs_find_LDT_entry (ptid_t (ptid_get_pid (inferior_ptid),
+ ret = procfs_find_LDT_entry (ptid_t (inferior_ptid.pid (),
lwpid, 0));
if (ret)
{
lwp = thread_to_lwp (ptid, -2);
- if (ptid_get_pid (lwp) == -1)
+ if (lwp.pid () == -1)
xsnprintf (buf, sizeof (buf), "Thread %ld (defunct)",
ptid_get_tid (ptid));
- else if (ptid_get_pid (lwp) != -2)
+ else if (lwp.pid () != -2)
xsnprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)",
ptid_get_tid (ptid), ptid_get_lwp (lwp));
else
else if (ptid_get_lwp (ptid) != 0)
xsnprintf (buf, sizeof (buf), "LWP %ld ", ptid_get_lwp (ptid));
else
- xsnprintf (buf, sizeof (buf), "process %d ", ptid_get_pid (ptid));
+ xsnprintf (buf, sizeof (buf), "process %d ", ptid.pid ());
return buf;
}
if (retval != TD_OK)
return -1;
- ptid = ptid_t (ptid_get_pid (inferior_ptid), 0, ti.ti_tid);
+ ptid = ptid_t (inferior_ptid.pid (), 0, ti.ti_tid);
if (!in_thread_list (ptid) || is_exited (ptid))
add_thread (ptid);
later). Since release 3.6, OpenBSD uses a fully randomized
cookie. */
{
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
/* Sanity check. The proper type for a cookie is register_t, but
we can't assume that this type exists on all systems supported
static bool
adi_available (void)
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
sparc64_adi_info *proc = get_adi_info_proc (pid);
CORE_ADDR value;
static CORE_ADDR
adi_normalize_address (CORE_ADDR addr)
{
- adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+ adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
if (ast.nbits)
{
static CORE_ADDR
adi_align_address (CORE_ADDR naddr)
{
- adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+ adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
return (naddr - (naddr % ast.blksize)) / ast.blksize;
}
static int
adi_convert_byte_count (CORE_ADDR naddr, int nbytes, CORE_ADDR locl)
{
- adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+ adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
return ((naddr + nbytes + ast.blksize - 1) / ast.blksize) - locl;
}
static int
adi_tag_fd (void)
{
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
sparc64_adi_info *proc = get_adi_info_proc (pid);
if (proc->stat.tag_fd != 0)
char filename[MAX_PROC_NAME_SIZE];
size_t i = 0;
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
snprintf (filename, sizeof filename, "/proc/%ld/adi/maps", (long) pid);
gdb::unique_xmalloc_ptr<char> data
= target_fileio_read_stralloc (NULL, filename);
if (!adi_is_addr_mapped (vaddr, size))
{
- adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+ adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
error(_("Address at %s is not in ADI maps"),
paddress (target_gdbarch (), vaddr * ast.blksize));
}
if (!adi_is_addr_mapped (vaddr, size))
{
- adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+ adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
error(_("Address at %s is not in ADI maps"),
paddress (target_gdbarch (), vaddr * ast.blksize));
}
int v_idx = 0;
const int maxelts = 8; /* # of elements per line */
- adi_stat_t adi_stat = get_adi_info (ptid_get_pid (inferior_ptid));
+ adi_stat_t adi_stat = get_adi_info (inferior_ptid.pid ());
while (cnt > 0)
{
if (!adi_available ())
error (_("No ADI information"));
- pid_t pid = ptid_get_pid (inferior_ptid);
+ pid_t pid = inferior_ptid.pid ();
sparc64_adi_info *proc = get_adi_info_proc (pid);
int cnt = 1;
const char *p = args;
int version = 0;
if (q != NULL) /* parse version tag */
{
- adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid));
+ adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
version = parse_and_eval_long (q);
if (version < 0 || version > ast.max_version)
error (_("Invalid ADI version tag %d"), version);
int tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ tid = inferior_ptid.pid ();
#ifndef __powerpc64__
/* If running as a 32-bit process on a 64-bit system, we attempt
int tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ tid = inferior_ptid.pid ();
buffer = (PTRACE_TYPE_RET *) alloca (count * sizeof (PTRACE_TYPE_RET));
for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
int tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ tid = inferior_ptid.pid ();
buffer = (PTRACE_TYPE_RET *) alloca (count * sizeof (PTRACE_TYPE_RET));
char buf[128];
int fd = 0;
int ret = -1;
- int pid = ptid_get_pid (inferior_ptid);
+ int pid = inferior_ptid.pid ();
if (!annex)
return TARGET_XFER_EOF;
int tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (ptid);
+ tid = ptid.pid ();
while (!parse_spufs_run (&fd, &addr))
{
set_sigint_trap (); /* Causes SIGINT to be passed on to the
attached process. */
- pid = waitpid (ptid_get_pid (ptid), &status, 0);
+ pid = waitpid (ptid.pid (), &status, 0);
if (pid == -1 && errno == ECHILD)
/* Try again with __WCLONE to check cloned processes. */
- pid = waitpid (ptid_get_pid (ptid), &status, __WCLONE);
+ pid = waitpid (ptid.pid (), &status, __WCLONE);
save_errno = errno;
/* Make sure we don't report an event for the exit of the
original program, if we've detached from it. */
if (pid != -1 && !WIFSTOPPED (status)
- && pid != ptid_get_pid (inferior_ptid))
+ && pid != inferior_ptid.pid ())
{
pid = -1;
save_errno = EINTR;
-- this is not the correct behaviour.
The workaround is to check whether the PID we are asked to remove this
- breakpoint from (i.e. ptid_get_pid (inferior_ptid)) is different from the
+ breakpoint from (i.e. inferior_ptid.pid ()) is different from the
PID of the current inferior (i.e. current_inferior ()->pid). This is only
true in the context of detach_breakpoints. If so, we simply do nothing.
[ Note that for the fork child process, it does not matter if breakpoints
remain inserted, because those SPU contexts are not runnable anyway --
the Linux kernel allows only the original process to invoke spu_run. */
- if (ptid_get_pid (inferior_ptid) != current_inferior ()->pid)
+ if (inferior_ptid.pid () != current_inferior ()->pid)
return 0;
return default_memory_remove_breakpoint (gdbarch, bp_tgt);
#define target_debug_print_enum_btrace_error(X) \
target_debug_do_print (plongest (X))
#define target_debug_print_ptid_t(X) \
- target_debug_do_print (plongest (ptid_get_pid (X)))
+ target_debug_do_print (plongest (X.pid ()))
#define target_debug_print_struct_gdbarch_p(X) \
target_debug_do_print (gdbarch_bfd_arch_info (X)->printable_name)
#define target_debug_print_const_gdb_byte_p(X) \
static ptid_t
default_get_ada_task_ptid (struct target_ops *self, long lwp, long tid)
{
- return ptid_t (ptid_get_pid (inferior_ptid), lwp, tid);
+ return ptid_t (inferior_ptid.pid (), lwp, tid);
}
static enum exec_direction_kind
if (exec_file == NULL)
exec_file = "";
- pid = ptid_get_pid (inferior_ptid);
+ pid = inferior_ptid.pid ();
printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file,
target_pid_to_str (ptid_t (pid)));
gdb_flush (gdb_stdout);
{
static char buf[32];
- xsnprintf (buf, sizeof buf, "process %d", ptid_get_pid (ptid));
+ xsnprintf (buf, sizeof buf, "process %d", ptid.pid ());
return buf;
}
changes. E.g, target remote may only discover the remote process
pid after adding the inferior to GDB's list. */
inf = find_inferior_ptid (old_ptid);
- inf->pid = ptid_get_pid (new_ptid);
+ inf->pid = new_ptid.pid ();
tp = find_thread_ptid (old_ptid);
tp->ptid = new_ptid;
if (all || ptid_is_pid (ptid))
{
for (tp = thread_list; tp; tp = tp->next)
- if (all || ptid_get_pid (tp->ptid) == ptid_get_pid (ptid))
+ if (all || tp->ptid.pid () == ptid.pid ())
tp->resumed = resumed;
}
else
if (all || ptid_is_pid (ptid))
{
for (tp = thread_list; tp; tp = tp->next)
- if (all || ptid_get_pid (tp->ptid) == ptid_get_pid (ptid))
+ if (all || tp->ptid.pid () == ptid.pid ())
{
if (tp->state == THREAD_EXITED)
continue;
if (all || ptid_is_pid (ptid))
{
for (tp = thread_list; tp; tp = tp->next)
- if (all || ptid_get_pid (tp->ptid) == ptid_get_pid (ptid))
+ if (all || tp->ptid.pid () == ptid.pid ())
set_executing_thread (tp, executing);
}
else
if (all || ptid_is_pid (ptid))
{
for (tp = thread_list; tp; tp = tp->next)
- if (all || ptid_get_pid (tp->ptid) == ptid_get_pid (ptid))
+ if (all || tp->ptid.pid () == ptid.pid ())
tp->stop_requested = stop;
}
else
{
if (tp->state == THREAD_EXITED)
continue;
- if (all || ptid_get_pid (ptid) == ptid_get_pid (tp->ptid))
+ if (all || ptid.pid () == tp->ptid.pid ())
{
if (set_running_thread (tp, tp->executing))
any_started = 1;
return 0;
}
- if (pid != -1 && ptid_get_pid (thr->ptid) != pid)
+ if (pid != -1 && thr->ptid.pid () != pid)
{
if (requested_threads != NULL && *requested_threads != '\0')
error (_("Requested thread not found in requested process"));
ALL_THREADS (tp)
{
- if (ptid_get_pid (tp->ptid) == inf->pid
+ if (tp->ptid.pid () == inf->pid
&& tp->per_inf_num == thr_num)
break;
}
vax_bsd_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"));
vax_bsd_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"));
last_sig = GDB_SIGNAL_0;
DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n",
- ptid_get_pid (ptid), ptid_get_tid (ptid), step, sig));
+ ptid.pid (), ptid_get_tid (ptid), step, sig));
/* Get context for currently selected thread. */
th = thread_rec (ptid_get_tid (inferior_ptid), FALSE);
windows_nat_target::close ()
{
DEBUG_EVENTS (("gdb: windows_close, inferior_ptid=%d\n",
- ptid_get_pid (inferior_ptid)));
+ inferior_ptid.pid ()));
}
/* Convert pid to printable format. */
if (ptid_get_tid (ptid) != 0)
{
snprintf (buf, sizeof (buf), "Thread %d.0x%lx",
- ptid_get_pid (ptid), ptid_get_tid (ptid));
+ ptid.pid (), ptid_get_tid (ptid));
return buf;
}
ptid_t
windows_nat_target::get_ada_task_ptid (long lwp, long thread)
{
- return ptid_t (ptid_get_pid (inferior_ptid), 0, lwp);
+ return ptid_t (inferior_ptid.pid (), 0, lwp);
}
/* Implementation of the to_thread_name method. */
in the end before detaching the forked off process, thus making
this compatible with older Linux kernels too. */
- parent_pid = ptid_get_pid (parent->ptid);
+ parent_pid = parent->ptid.pid ();
parent_state = x86_debug_reg_state (parent_pid);
child_state = x86_debug_reg_state (child_pid);
*child_state = *parent_state;
/* GNU/Linux LWP ID's are process ID's. */
tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ tid = inferior_ptid.pid (); /* Not a threaded program. */
#ifdef __x86_64__
{
x86_cleanup_dregs (void)
{
/* Starting from scratch has the same effect. */
- x86_forget_process (ptid_get_pid (inferior_ptid));
+ x86_forget_process (inferior_ptid.pid ());
}
/* Insert a watchpoint to watch a memory region which starts at
enum target_hw_bp_type type, struct expression *cond)
{
struct x86_debug_reg_state *state
- = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = x86_debug_reg_state (inferior_ptid.pid ());
return x86_dr_insert_watchpoint (state, type, addr, len);
}
enum target_hw_bp_type type, struct expression *cond)
{
struct x86_debug_reg_state *state
- = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = x86_debug_reg_state (inferior_ptid.pid ());
return x86_dr_remove_watchpoint (state, type, addr, len);
}
x86_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
{
struct x86_debug_reg_state *state
- = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = x86_debug_reg_state (inferior_ptid.pid ());
return x86_dr_region_ok_for_watchpoint (state, addr, len);
}
x86_stopped_data_address (CORE_ADDR *addr_p)
{
struct x86_debug_reg_state *state
- = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = x86_debug_reg_state (inferior_ptid.pid ());
return x86_dr_stopped_data_address (state, addr_p);
}
x86_stopped_by_watchpoint ()
{
struct x86_debug_reg_state *state
- = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = x86_debug_reg_state (inferior_ptid.pid ());
return x86_dr_stopped_by_watchpoint (state);
}
x86_insert_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
{
struct x86_debug_reg_state *state
- = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = x86_debug_reg_state (inferior_ptid.pid ());
bp_tgt->placed_address = bp_tgt->reqstd_address;
return x86_dr_insert_watchpoint (state, hw_execute,
struct bp_target_info *bp_tgt)
{
struct x86_debug_reg_state *state
- = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = x86_debug_reg_state (inferior_ptid.pid ());
return x86_dr_remove_watchpoint (state, hw_execute,
bp_tgt->placed_address, 1);
x86_stopped_by_hw_breakpoint ()
{
struct x86_debug_reg_state *state
- = x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+ = x86_debug_reg_state (inferior_ptid.pid ());
return x86_dr_stopped_by_hw_breakpoint (state);
}