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