From 222312d359fe0a68f8583ba315583ee8cc94f252 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 30 May 2018 14:54:34 -0400 Subject: [PATCH] Remove regcache_get_ptid Remove regcache_get_ptid, change all callers to call the regcache method directly. gdb/ChangeLog: * regcache.h (regcache_get_ptid): Remove, update all callers to call regcache::ptid instead. * regcache.c (regcache_get_ptid): Remove. --- gdb/ChangeLog | 6 ++++++ gdb/aarch64-fbsd-nat.c | 4 ++-- gdb/aarch64-linux-nat.c | 8 ++++---- gdb/aix-thread.c | 8 ++++---- gdb/alpha-bsd-nat.c | 12 ++++++------ gdb/amd64-bsd-nat.c | 4 ++-- gdb/amd64-linux-nat.c | 8 ++++---- gdb/arm-fbsd-nat.c | 4 ++-- gdb/arm-linux-nat.c | 16 ++++++++-------- gdb/arm-nbsd-nat.c | 20 ++++++++++---------- gdb/bsd-uthread.c | 4 ++-- gdb/hppa-linux-nat.c | 4 ++-- gdb/hppa-nbsd-nat.c | 4 ++-- gdb/hppa-obsd-nat.c | 2 +- gdb/i386-bsd-nat.c | 4 ++-- gdb/i386-darwin-nat.c | 4 ++-- gdb/i386-gnu-nat.c | 4 ++-- gdb/i386-linux-nat.c | 8 ++++---- gdb/ia64-linux-nat.c | 4 ++-- gdb/linux-nat-trad.c | 4 ++-- gdb/m32r-linux-nat.c | 4 ++-- gdb/m68k-bsd-nat.c | 4 ++-- gdb/m68k-linux-nat.c | 8 ++++---- gdb/mips-fbsd-nat.c | 4 ++-- gdb/mips-linux-nat.c | 4 ++-- gdb/mips-nbsd-nat.c | 4 ++-- gdb/mips64-obsd-nat.c | 4 ++-- gdb/nto-procfs.c | 4 ++-- gdb/ppc-fbsd-nat.c | 4 ++-- gdb/ppc-linux-nat.c | 4 ++-- gdb/ppc-nbsd-nat.c | 4 ++-- gdb/ppc-obsd-nat.c | 4 ++-- gdb/procfs.c | 4 ++-- gdb/ravenscar-thread.c | 6 +++--- gdb/record-btrace.c | 6 +++--- gdb/regcache.c | 10 ---------- gdb/regcache.h | 8 ++++---- gdb/remote-sim.c | 4 ++-- gdb/remote.c | 4 ++-- gdb/rs6000-nat.c | 4 ++-- gdb/s390-linux-nat.c | 4 ++-- gdb/sh-nbsd-nat.c | 4 ++-- gdb/sol-thread.c | 4 ++-- gdb/sparc-nat.c | 4 ++-- gdb/spu-linux-nat.c | 4 ++-- gdb/spu-multiarch.c | 4 ++-- gdb/tilegx-linux-nat.c | 4 ++-- gdb/vax-bsd-nat.c | 4 ++-- gdb/windows-nat.c | 4 ++-- gdb/xtensa-linux-nat.c | 8 ++++---- 50 files changed, 135 insertions(+), 139 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 634207bdbf..1c09d21729 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2018-05-30 Simon Marchi + + * regcache.h (regcache_get_ptid): Remove, update all callers to + call regcache::ptid instead. + * regcache.c (regcache_get_ptid): Remove. + 2018-05-30 Simon Marchi * Makefile.in (ALL_TARGET_OBS): Add or1k-tdep.o. diff --git a/gdb/aarch64-fbsd-nat.c b/gdb/aarch64-fbsd-nat.c index a50656353c..2d0da7fd39 100644 --- a/gdb/aarch64-fbsd-nat.c +++ b/gdb/aarch64-fbsd-nat.c @@ -60,7 +60,7 @@ void aarch64_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum) { - pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t pid = get_ptrace_pid (regcache->ptid ()); struct gdbarch *gdbarch = regcache->arch (); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) @@ -93,7 +93,7 @@ void aarch64_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum) { - pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t pid = get_ptrace_pid (regcache->ptid ()); struct gdbarch *gdbarch = regcache->arch (); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 908b83a49a..3672a2f5ce 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -208,7 +208,7 @@ fetch_gregs_from_thread (struct regcache *regcache) and arm. */ gdb_static_assert (sizeof (regs) >= 18 * 4); - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); iovec.iov_base = ®s; if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) @@ -245,7 +245,7 @@ store_gregs_to_thread (const struct regcache *regcache) /* Make sure REGS can hold all registers contents on both aarch64 and arm. */ gdb_static_assert (sizeof (regs) >= 18 * 4); - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); iovec.iov_base = ®s; if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) @@ -289,7 +289,7 @@ fetch_fpregs_from_thread (struct regcache *regcache) and arm. */ gdb_static_assert (sizeof regs >= VFP_REGS_SIZE); - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); iovec.iov_base = ®s; @@ -336,7 +336,7 @@ store_fpregs_to_thread (const struct regcache *regcache) /* Make sure REGS can hold all VFP registers contents on both aarch64 and arm. */ gdb_static_assert (sizeof regs >= VFP_REGS_SIZE); - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); iovec.iov_base = ®s; diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index d328bdd872..6f4135b846 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -1365,11 +1365,11 @@ aix_thread_target::fetch_registers (struct regcache *regcache, int regno) pthdb_tid_t tid; struct target_ops *beneath = find_target_beneath (this); - if (!PD_TID (regcache_get_ptid (regcache))) + if (!PD_TID (regcache->ptid ())) beneath->fetch_registers (regcache, regno); else { - thread = find_thread_ptid (regcache_get_ptid (regcache)); + thread = find_thread_ptid (regcache->ptid ()); aix_thread_info *priv = get_aix_thread_info (thread); tid = priv->tid; @@ -1719,11 +1719,11 @@ aix_thread_target::store_registers (struct regcache *regcache, int regno) pthdb_tid_t tid; struct target_ops *beneath = find_target_beneath (this); - if (!PD_TID (regcache_get_ptid (regcache))) + if (!PD_TID (regcache->ptid ())) beneath->store_registers (regcache, regno); else { - thread = find_thread_ptid (regcache_get_ptid (regcache)); + thread = find_thread_ptid (regcache->ptid ()); aix_thread_info *priv = get_aix_thread_info (thread); tid = priv->tid; diff --git a/gdb/alpha-bsd-nat.c b/gdb/alpha-bsd-nat.c index 77271ec6f7..e889d22f33 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_get_ptid (regcache)), + if (ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()), (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_get_ptid (regcache)), + if (ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()), (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_get_ptid (regcache)), + if (ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()), (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_get_ptid (regcache)), + if (ptrace (PT_SETREGS, ptid_get_pid (regcache->ptid ()), (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_get_ptid (regcache)), + if (ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()), (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_get_ptid (regcache)), + if (ptrace (PT_SETFPREGS, ptid_get_pid (regcache->ptid ()), (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't write floating point status")); } diff --git a/gdb/amd64-bsd-nat.c b/gdb/amd64-bsd-nat.c index 74a1842de9..81ba835fc4 100644 --- a/gdb/amd64-bsd-nat.c +++ b/gdb/amd64-bsd-nat.c @@ -42,7 +42,7 @@ void amd64bsd_fetch_inferior_registers (struct regcache *regcache, int regnum) { struct gdbarch *gdbarch = regcache->arch (); - pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t pid = get_ptrace_pid (regcache->ptid ()); if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) { @@ -115,7 +115,7 @@ void amd64bsd_store_inferior_registers (struct regcache *regcache, int regnum) { struct gdbarch *gdbarch = regcache->arch (); - pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t pid = get_ptrace_pid (regcache->ptid ()); if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) { diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index 1cb4c2c627..17de388a2f 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -148,9 +148,9 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum) int tid; /* GNU/Linux LWP ID's are process ID's. */ - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); if (tid == 0) - tid = ptid_get_pid (regcache_get_ptid (regcache)); /* Not a threaded program. */ + tid = ptid_get_pid (regcache->ptid ()); /* Not a threaded program. */ if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) { @@ -226,9 +226,9 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum) int tid; /* GNU/Linux LWP ID's are process ID's. */ - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); if (tid == 0) - tid = ptid_get_pid (regcache_get_ptid (regcache)); /* Not a threaded program. */ + tid = ptid_get_pid (regcache->ptid ()); /* Not a threaded program. */ if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) { diff --git a/gdb/arm-fbsd-nat.c b/gdb/arm-fbsd-nat.c index be733ff746..34b13354f3 100644 --- a/gdb/arm-fbsd-nat.c +++ b/gdb/arm-fbsd-nat.c @@ -64,7 +64,7 @@ getvfpregs_supplies (struct gdbarch *gdbarch, int regnum) void arm_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum) { - pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t pid = get_ptrace_pid (regcache->ptid ()); struct gdbarch *gdbarch = regcache->arch (); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) @@ -98,7 +98,7 @@ arm_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum) void arm_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum) { - pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t pid = get_ptrace_pid (regcache->ptid ()); struct gdbarch *gdbarch = regcache->arch (); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 30030b4eb0..ccf812b21b 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -119,7 +119,7 @@ fetch_fpregs (struct regcache *regcache) gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE]; /* Get the thread id for the ptrace call. */ - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); /* Read the floating point state. */ if (have_ptrace_getregset == TRIBOOL_TRUE) @@ -156,7 +156,7 @@ store_fpregs (const struct regcache *regcache) gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE]; /* Get the thread id for the ptrace call. */ - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); /* Read the floating point state. */ if (have_ptrace_getregset == TRIBOOL_TRUE) @@ -210,7 +210,7 @@ fetch_regs (struct regcache *regcache) elf_gregset_t regs; /* Get the thread id for the ptrace call. */ - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); if (have_ptrace_getregset == TRIBOOL_TRUE) { @@ -237,7 +237,7 @@ store_regs (const struct regcache *regcache) elf_gregset_t regs; /* Get the thread id for the ptrace call. */ - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); /* Fetch the general registers. */ if (have_ptrace_getregset == TRIBOOL_TRUE) @@ -285,7 +285,7 @@ fetch_wmmx_regs (struct regcache *regcache) int ret, regno, tid; /* Get the thread id for the ptrace call. */ - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf); if (ret < 0) @@ -311,7 +311,7 @@ store_wmmx_regs (const struct regcache *regcache) int ret, regno, tid; /* Get the thread id for the ptrace call. */ - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf); if (ret < 0) @@ -350,7 +350,7 @@ fetch_vfp_regs (struct regcache *regcache) struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* Get the thread id for the ptrace call. */ - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); if (have_ptrace_getregset == TRIBOOL_TRUE) { @@ -379,7 +379,7 @@ store_vfp_regs (const struct regcache *regcache) struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* Get the thread id for the ptrace call. */ - tid = ptid_get_lwp (regcache_get_ptid (regcache)); + tid = ptid_get_lwp (regcache->ptid ()); if (have_ptrace_getregset == TRIBOOL_TRUE) { diff --git a/gdb/arm-nbsd-nat.c b/gdb/arm-nbsd-nat.c index 3a1ddeaf4e..3d64346008 100644 --- a/gdb/arm-nbsd-nat.c +++ b/gdb/arm-nbsd-nat.c @@ -87,7 +87,7 @@ fetch_register (struct regcache *regcache, int regno) struct reg inferior_registers; int ret; - ret = ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)), + ret = ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()), (PTRACE_TYPE_ARG3) &inferior_registers, 0); if (ret < 0) @@ -140,7 +140,7 @@ fetch_regs (struct regcache *regcache) int ret; int regno; - ret = ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)), + ret = ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()), (PTRACE_TYPE_ARG3) &inferior_registers, 0); if (ret < 0) @@ -158,7 +158,7 @@ fetch_fp_register (struct regcache *regcache, int regno) struct fpreg inferior_fp_registers; int ret; - ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)), + ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()), (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0); if (ret < 0) @@ -188,7 +188,7 @@ fetch_fp_regs (struct regcache *regcache) int ret; int regno; - ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)), + ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()), (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0); if (ret < 0) @@ -225,7 +225,7 @@ store_register (const struct regcache *regcache, int regno) struct reg inferior_registers; int ret; - ret = ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)), + ret = ptrace (PT_GETREGS, ptid_get_pid (regcache->ptid ()), (PTRACE_TYPE_ARG3) &inferior_registers, 0); if (ret < 0) @@ -288,7 +288,7 @@ store_register (const struct regcache *regcache, int regno) break; } - ret = ptrace (PT_SETREGS, ptid_get_pid (regcache_get_ptid (regcache)), + ret = ptrace (PT_SETREGS, ptid_get_pid (regcache->ptid ()), (PTRACE_TYPE_ARG3) &inferior_registers, 0); if (ret < 0) @@ -336,7 +336,7 @@ store_regs (const struct regcache *regcache) inferior_registers.r_pc = pc_val | psr_val; } - ret = ptrace (PT_SETREGS, ptid_get_pid (regcache_get_ptid (regcache)), + ret = ptrace (PT_SETREGS, ptid_get_pid (regcache->ptid ()), (PTRACE_TYPE_ARG3) &inferior_registers, 0); if (ret < 0) @@ -349,7 +349,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_get_ptid (regcache)), + ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache->ptid ()), (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0); if (ret < 0) @@ -371,7 +371,7 @@ store_fp_register (const struct regcache *regcache, int regno) break; } - ret = ptrace (PT_SETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)), + ret = ptrace (PT_SETFPREGS, ptid_get_pid (regcache->ptid ()), (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0); if (ret < 0) @@ -393,7 +393,7 @@ store_fp_regs (const struct regcache *regcache) regcache_raw_collect (regcache, ARM_FPS_REGNUM, (char *) &inferior_fp_registers.fpr_fpsr); - ret = ptrace (PT_SETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)), + ret = ptrace (PT_SETFPREGS, ptid_get_pid (regcache->ptid ()), (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0); if (ret < 0) diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 1505cfede7..9ead7c2b3d 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -321,7 +321,7 @@ bsd_uthread_target::fetch_registers (struct regcache *regcache, int regnum) struct gdbarch *gdbarch = regcache->arch (); struct bsd_uthread_ops *uthread_ops = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data); - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); CORE_ADDR addr = ptid_get_tid (ptid); struct target_ops *beneath = find_target_beneath (this); CORE_ADDR active_addr; @@ -355,7 +355,7 @@ bsd_uthread_target::store_registers (struct regcache *regcache, int regnum) struct bsd_uthread_ops *uthread_ops = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data); struct target_ops *beneath = find_target_beneath (this); - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); CORE_ADDR addr = ptid_get_tid (ptid); CORE_ADDR active_addr; scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid); diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c index bc6c234d51..39ae83fe6a 100644 --- a/gdb/hppa-linux-nat.c +++ b/gdb/hppa-linux-nat.c @@ -233,7 +233,7 @@ fetch_register (struct regcache *regcache, int regno) return; } - tid = get_ptrace_pid (regcache_get_ptid (regcache)); + tid = get_ptrace_pid (regcache->ptid ()); errno = 0; val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0); @@ -257,7 +257,7 @@ store_register (const struct regcache *regcache, int regno) if (gdbarch_cannot_store_register (gdbarch, regno)) return; - tid = get_ptrace_pid (regcache_get_ptid (regcache)); + tid = get_ptrace_pid (regcache->ptid ()); errno = 0; regcache_raw_collect (regcache, regno, &val); diff --git a/gdb/hppa-nbsd-nat.c b/gdb/hppa-nbsd-nat.c index 3547d65543..2ffa5bc79f 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum)) { diff --git a/gdb/hppa-obsd-nat.c b/gdb/hppa-obsd-nat.c index 43c2dcc2b8..2ef2f7ef2c 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); if (regnum == -1 || hppaobsd_gregset_supplies_p (regnum)) { diff --git a/gdb/i386-bsd-nat.c b/gdb/i386-bsd-nat.c index f7f27ceba0..cca4629843 100644 --- a/gdb/i386-bsd-nat.c +++ b/gdb/i386-bsd-nat.c @@ -130,7 +130,7 @@ i386bsd_collect_gregset (const struct regcache *regcache, void i386bsd_fetch_inferior_registers (struct regcache *regcache, int regnum) { - pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t pid = get_ptrace_pid (regcache->ptid ()); if (regnum == -1 || GETREGS_SUPPLIES (regnum)) { @@ -193,7 +193,7 @@ i386bsd_fetch_inferior_registers (struct regcache *regcache, int regnum) void i386bsd_store_inferior_registers (struct regcache *regcache, int regnum) { - pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t pid = get_ptrace_pid (regcache->ptid ()); if (regnum == -1 || GETREGS_SUPPLIES (regnum)) { diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c index e57b12693f..03adb20e98 100644 --- a/gdb/i386-darwin-nat.c +++ b/gdb/i386-darwin-nat.c @@ -59,7 +59,7 @@ static struct i386_darwin_nat_target darwin_target; void i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno) { - thread_t current_thread = ptid_get_tid (regcache_get_ptid (regcache)); + thread_t current_thread = ptid_get_tid (regcache->ptid ()); int fetched = 0; struct gdbarch *gdbarch = regcache->arch (); @@ -176,7 +176,7 @@ void i386_darwin_nat_target::store_registers (struct regcache *regcache, int regno) { - thread_t current_thread = ptid_get_tid (regcache_get_ptid (regcache)); + thread_t current_thread = ptid_get_tid (regcache->ptid ()); struct gdbarch *gdbarch = regcache->arch (); #ifdef BFD64 diff --git a/gdb/i386-gnu-nat.c b/gdb/i386-gnu-nat.c index 8bb036dac3..e5195f3eb6 100644 --- a/gdb/i386-gnu-nat.c +++ b/gdb/i386-gnu-nat.c @@ -108,7 +108,7 @@ gnu_fetch_registers (struct target_ops *ops, struct regcache *regcache, int regno) { struct proc *thread; - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); /* Make sure we know about new threads. */ inf_update_procs (gnu_current_inf); @@ -201,7 +201,7 @@ gnu_store_registers (struct target_ops *ops, { struct proc *thread; struct gdbarch *gdbarch = regcache->arch (); - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); /* Make sure we know about new threads. */ inf_update_procs (gnu_current_inf); diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 6538324306..054638ba1f 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -116,7 +116,7 @@ fetch_register (struct regcache *regcache, int regno) return; } - tid = get_ptrace_pid (regcache_get_ptid (regcache)); + tid = get_ptrace_pid (regcache->ptid ()); errno = 0; val = ptrace (PTRACE_PEEKUSER, tid, @@ -141,7 +141,7 @@ store_register (const struct regcache *regcache, int regno) if (i386_linux_gregset_reg_offset[regno] == -1) return; - tid = get_ptrace_pid (regcache_get_ptid (regcache)); + tid = get_ptrace_pid (regcache->ptid ()); errno = 0; regcache_raw_collect (regcache, regno, &val); @@ -475,7 +475,7 @@ i386_linux_nat_target::fetch_registers (struct regcache *regcache, int regno) return; } - tid = get_ptrace_pid (regcache_get_ptid (regcache)); + tid = get_ptrace_pid (regcache->ptid ()); /* Use the PTRACE_GETFPXREGS request whenever possible, since it transfers more registers in one system call, and we'll cache the @@ -552,7 +552,7 @@ i386_linux_nat_target::store_registers (struct regcache *regcache, int regno) return; } - tid = get_ptrace_pid (regcache_get_ptid (regcache)); + tid = get_ptrace_pid (regcache->ptid ()); /* Use the PTRACE_SETFPXREGS requests whenever possible, since it transfers more registers in one system call. But remember that diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index f73e17ac76..d095bde2ff 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -779,7 +779,7 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum) return; } - pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid = get_ptrace_pid (regcache->ptid ()); /* This isn't really an address, but ptrace thinks of it as one. */ addr = ia64_register_addr (gdbarch, regnum); @@ -833,7 +833,7 @@ ia64_linux_store_register (const struct regcache *regcache, int regnum) if (ia64_cannot_store_register (gdbarch, regnum)) return; - pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid = get_ptrace_pid (regcache->ptid ()); /* This isn't really an address, but ptrace thinks of it as one. */ addr = ia64_register_addr (gdbarch, regnum); diff --git a/gdb/linux-nat-trad.c b/gdb/linux-nat-trad.c index ce6788c0bc..ed75eeda82 100644 --- a/gdb/linux-nat-trad.c +++ b/gdb/linux-nat-trad.c @@ -45,7 +45,7 @@ linux_nat_trad_target::fetch_register (struct regcache *regcache, int regnum) return; } - pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid = get_ptrace_pid (regcache->ptid ()); size = register_size (gdbarch, regnum); buf = (gdb_byte *) alloca (size); @@ -104,7 +104,7 @@ linux_nat_trad_target::store_register (const struct regcache *regcache, || gdbarch_cannot_store_register (gdbarch, regnum)) return; - pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid = get_ptrace_pid (regcache->ptid ()); size = register_size (gdbarch, regnum); buf = (gdb_byte *) alloca (size); diff --git a/gdb/m32r-linux-nat.c b/gdb/m32r-linux-nat.c index 09a019a7b1..9d833fa19e 100644 --- a/gdb/m32r-linux-nat.c +++ b/gdb/m32r-linux-nat.c @@ -202,7 +202,7 @@ fill_fpregset (const struct regcache *regcache, void m32r_linux_nat_target::fetch_registers (struct regcache *regcache, int regno) { - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); /* Use the PTRACE_GETREGS request whenever possible, since it transfers more registers in one system call, and we'll cache the @@ -223,7 +223,7 @@ m32r_linux_nat_target::fetch_registers (struct regcache *regcache, int regno) void m32r_linux_nat_target::store_registers (struct regcache *regcache, int regno) { - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); /* Use the PTRACE_SETREGS request whenever possible, since it transfers more registers in one system call. */ diff --git a/gdb/m68k-bsd-nat.c b/gdb/m68k-bsd-nat.c index af907adb78..c44f736328 100644 --- a/gdb/m68k-bsd-nat.c +++ b/gdb/m68k-bsd-nat.c @@ -118,7 +118,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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum)) { @@ -147,7 +147,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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum)) { diff --git a/gdb/m68k-linux-nat.c b/gdb/m68k-linux-nat.c index e25154cdd7..409a4fd09d 100644 --- a/gdb/m68k-linux-nat.c +++ b/gdb/m68k-linux-nat.c @@ -119,7 +119,7 @@ fetch_register (struct regcache *regcache, int regno) long regaddr, val; int i; gdb_byte buf[M68K_MAX_REGISTER_SIZE]; - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); regaddr = 4 * regmap[regno]; for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long)) @@ -167,7 +167,7 @@ store_register (const struct regcache *regcache, int regno) long regaddr, val; int i; gdb_byte buf[M68K_MAX_REGISTER_SIZE]; - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); regaddr = 4 * regmap[regno]; @@ -416,7 +416,7 @@ m68k_linux_nat_target::fetch_registers (struct regcache *regcache, int regno) return; } - tid = get_ptrace_pid (regcache_get_ptid (regcache)); + tid = get_ptrace_pid (regcache->ptid ()); /* Use the PTRACE_GETFPXREGS request whenever possible, since it transfers more registers in one system call, and we'll cache the @@ -469,7 +469,7 @@ m68k_linux_nat_target::store_registers (struct regcache *regcache, int regno) return; } - tid = get_ptrace_pid (regcache_get_ptid (regcache)); + tid = get_ptrace_pid (regcache->ptid ()); /* Use the PTRACE_SETFPREGS requests whenever possible, since it transfers more registers in one system call. But remember that diff --git a/gdb/mips-fbsd-nat.c b/gdb/mips-fbsd-nat.c index 04fbb2ad1a..7761301b6f 100644 --- a/gdb/mips-fbsd-nat.c +++ b/gdb/mips-fbsd-nat.c @@ -63,7 +63,7 @@ getfpregs_supplies (struct gdbarch *gdbarch, int regnum) void mips_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum) { - pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t pid = get_ptrace_pid (regcache->ptid ()); struct gdbarch *gdbarch = regcache->arch (); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) @@ -94,7 +94,7 @@ mips_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum) void mips_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum) { - pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t pid = get_ptrace_pid (regcache->ptid ()); struct gdbarch *gdbarch = regcache->arch (); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 36831071fb..beb0ea0a26 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -270,7 +270,7 @@ mips_linux_nat_target::mips64_regsets_fetch_registers else is_dsp = 0; - tid = get_ptrace_pid (regcache_get_ptid (regcache)); + tid = get_ptrace_pid (regcache->ptid ()); if (regno == -1 || (!is_fp && !is_dsp)) { @@ -357,7 +357,7 @@ mips_linux_nat_target::mips64_regsets_store_registers else is_dsp = 0; - tid = get_ptrace_pid (regcache_get_ptid (regcache)); + tid = get_ptrace_pid (regcache->ptid ()); if (regno == -1 || (!is_fp && !is_dsp)) { diff --git a/gdb/mips-nbsd-nat.c b/gdb/mips-nbsd-nat.c index b9fc6279d0..4c61081a38 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); 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 7f14b09108..27e1ab6750 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index f0ef9b9eb4..fcd30016f2 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -917,7 +917,7 @@ nto_procfs_target::fetch_registers (struct regcache *regcache, int regno) reg; int regsize; - procfs_set_thread (regcache_get_ptid (regcache)); + procfs_set_thread (regcache->ptid ()); if (devctl (ctl_fd, DCMD_PROC_GETGREG, ®, sizeof (reg), ®size) == EOK) nto_supply_gregset (regcache, (char *) ®.greg); if (devctl (ctl_fd, DCMD_PROC_GETFPREG, ®, sizeof (reg), ®size) @@ -1393,7 +1393,7 @@ nto_procfs_target::store_registers (struct regcache *regcache, int regno) unsigned off; int len, regset, regsize, dev_set, err; char *data; - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); if (ptid_equal (ptid, null_ptid)) return; diff --git a/gdb/ppc-fbsd-nat.c b/gdb/ppc-fbsd-nat.c index 6ca4bbac39..89a7e6eb5c 100644 --- a/gdb/ppc-fbsd-nat.c +++ b/gdb/ppc-fbsd-nat.c @@ -127,7 +127,7 @@ void ppc_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regno) { gdb_gregset_t regs; - pid_t pid = ptid_get_lwp (regcache_get_ptid (regcache)); + pid_t pid = ptid_get_lwp (regcache->ptid ()); if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); @@ -153,7 +153,7 @@ void ppc_fbsd_nat_target::store_registers (struct regcache *regcache, int regno) { gdb_gregset_t regs; - pid_t pid = ptid_get_lwp (regcache_get_ptid (regcache)); + pid_t pid = ptid_get_lwp (regcache->ptid ()); if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index eb21f91c13..7606081f22 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -773,7 +773,7 @@ fetch_ppc_registers (struct regcache *regcache, int tid) void ppc_linux_nat_target::fetch_registers (struct regcache *regcache, int regno) { - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); if (regno == -1) fetch_ppc_registers (regcache, tid); @@ -2131,7 +2131,7 @@ ppc_linux_nat_target::masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask void ppc_linux_nat_target::store_registers (struct regcache *regcache, int regno) { - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); if (regno >= 0) store_register (regcache, tid, regno); diff --git a/gdb/ppc-nbsd-nat.c b/gdb/ppc-nbsd-nat.c index f6e3884a3d..037b261331 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) { diff --git a/gdb/ppc-obsd-nat.c b/gdb/ppc-obsd-nat.c index 4428dabd7b..88ba0c5c73 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); diff --git a/gdb/procfs.c b/gdb/procfs.c index 70619f1c15..e01d6647e1 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -2063,7 +2063,7 @@ procfs_target::fetch_registers (struct regcache *regcache, int regnum) { gdb_gregset_t *gregs; procinfo *pi; - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); int pid = ptid_get_pid (ptid); int tid = ptid_get_lwp (ptid); struct gdbarch *gdbarch = regcache->arch (); @@ -2112,7 +2112,7 @@ procfs_target::store_registers (struct regcache *regcache, int regnum) { gdb_gregset_t *gregs; procinfo *pi; - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); int pid = ptid_get_pid (ptid); int tid = ptid_get_lwp (ptid); struct gdbarch *gdbarch = regcache->arch (); diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 5f3e179dec..b8630c3f3a 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -416,7 +416,7 @@ void ravenscar_thread_target::fetch_registers (struct regcache *regcache, int regnum) { struct target_ops *beneath = find_target_beneath (this); - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); if (ravenscar_runtime_initialized () && is_ravenscar_task (ptid) @@ -437,7 +437,7 @@ ravenscar_thread_target::store_registers (struct regcache *regcache, int regnum) { target_ops *beneath = find_target_beneath (this); - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); if (ravenscar_runtime_initialized () && is_ravenscar_task (ptid) @@ -457,7 +457,7 @@ void ravenscar_thread_target::prepare_to_store (struct regcache *regcache) { target_ops *beneath = find_target_beneath (this); - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); if (ravenscar_runtime_initialized () && is_ravenscar_task (ptid) diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 0f01aceb93..35c8421525 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1536,7 +1536,7 @@ record_btrace_target::fetch_registers (struct regcache *regcache, int regno) struct btrace_insn_iterator *replay; struct thread_info *tp; - tp = find_thread_ptid (regcache_get_ptid (regcache)); + tp = find_thread_ptid (regcache->ptid ()); gdb_assert (tp != NULL); replay = tp->btrace.replay; @@ -1572,7 +1572,7 @@ record_btrace_target::store_registers (struct regcache *regcache, int regno) struct target_ops *t; if (!record_btrace_generating_corefile - && record_is_replaying (regcache_get_ptid (regcache))) + && record_is_replaying (regcache->ptid ())) error (_("Cannot write registers while replaying.")); gdb_assert (may_write_registers != 0); @@ -1586,7 +1586,7 @@ void record_btrace_target::prepare_to_store (struct regcache *regcache) { if (!record_btrace_generating_corefile - && record_is_replaying (regcache_get_ptid (regcache))) + && record_is_replaying (regcache->ptid ())) return; this->beneath->prepare_to_store (regcache); diff --git a/gdb/regcache.c b/gdb/regcache.c index 83bcbd22a3..9881e92468 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -223,16 +223,6 @@ reg_buffer::arch () const return m_descr->gdbarch; } -/* See regcache.h. */ - -ptid_t -regcache_get_ptid (const struct regcache *regcache) -{ - gdb_assert (!ptid_equal (regcache->ptid (), minus_one_ptid)); - - return regcache->ptid (); -} - /* Cleanup class for invalidating a register. */ class regcache_invalidator diff --git a/gdb/regcache.h b/gdb/regcache.h index d7bb8b5c93..7fcc43a83c 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -35,10 +35,6 @@ extern struct regcache *get_thread_arch_aspace_regcache (ptid_t, struct gdbarch *, struct address_space *); -/* Return REGCACHE's ptid. */ - -extern ptid_t regcache_get_ptid (const struct regcache *regcache); - enum register_status regcache_register_status (const struct regcache *regcache, int regnum); @@ -357,8 +353,12 @@ public: void collect_regset (const struct regset *regset, int regnum, void *buf, size_t size) const; + /* Return REGCACHE's ptid. */ + ptid_t ptid () const { + gdb_assert (m_ptid != minus_one_ptid); + return m_ptid; } diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 5fd24cbdb1..9c89ab9db7 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -469,7 +469,7 @@ void gdbsim_target::fetch_registers (struct regcache *regcache, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct inferior *inf = find_inferior_ptid (regcache_get_ptid (regcache)); + struct inferior *inf = find_inferior_ptid (regcache->ptid ()); struct sim_inferior_data *sim_data = get_sim_inferior_data (inf, SIM_INSTANCE_NEEDED); @@ -538,7 +538,7 @@ void gdbsim_target::store_registers (struct regcache *regcache, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct inferior *inf = find_inferior_ptid (regcache_get_ptid (regcache)); + struct inferior *inf = find_inferior_ptid (regcache->ptid ()); struct sim_inferior_data *sim_data = get_sim_inferior_data (inf, SIM_INSTANCE_NEEDED); diff --git a/gdb/remote.c b/gdb/remote.c index e7ade41c34..3df9ad4fbe 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8281,7 +8281,7 @@ remote_target::fetch_registers (struct regcache *regcache, int regnum) int i; set_remote_traceframe (); - set_general_thread (regcache_get_ptid (regcache)); + set_general_thread (regcache->ptid ()); if (regnum >= 0) { @@ -8438,7 +8438,7 @@ remote_target::store_registers (struct regcache *regcache, int regnum) int i; set_remote_traceframe (); - set_general_thread (regcache_get_ptid (regcache)); + set_general_thread (regcache->ptid ()); if (regnum >= 0) { diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index e9f064710a..689d8e815c 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); /* 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); /* Fetch the register's value from the register cache. */ regcache_raw_collect (regcache, regno, addr); diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index 3c65c5eaa5..abb06a9901 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -408,7 +408,7 @@ check_regset (int tid, int regset, int regsize) void s390_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum) { - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum)) fetch_regs (regcache, tid); @@ -462,7 +462,7 @@ s390_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum) void s390_linux_nat_target::store_registers (struct regcache *regcache, int regnum) { - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum)) store_regs (regcache, tid, regnum); diff --git a/gdb/sh-nbsd-nat.c b/gdb/sh-nbsd-nat.c index 6bd089e32b..062b5220ff 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno)) { diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 22dd8d6eaa..1023f7d17c 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -488,7 +488,7 @@ sol_thread_target::fetch_registers (struct regcache *regcache, int regnum) gdb_gregset_t *gregset_p = &gregset; gdb_fpregset_t *fpregset_p = &fpregset; struct target_ops *beneath = find_target_beneath (this); - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); if (!ptid_tid_p (ptid)) { @@ -540,7 +540,7 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum) td_err_e val; prgregset_t gregset; prfpregset_t fpregset; - ptid_t ptid = regcache_get_ptid (regcache); + ptid_t ptid = regcache->ptid (); if (!ptid_tid_p (ptid)) { diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c index 8b5c68619d..86a6b5a20a 100644 --- a/gdb/sparc-nat.c +++ b/gdb/sparc-nat.c @@ -152,7 +152,7 @@ sparc_fetch_inferior_registers (struct regcache *regcache, int regnum) These functions should instead be paramaterized with an explicit object (struct regcache, struct thread_info?) into which the LWPs registers can be written. */ - pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid = get_ptrace_pid (regcache->ptid ()); if (regnum == SPARC_G0_REGNUM) { @@ -193,7 +193,7 @@ sparc_store_inferior_registers (struct regcache *regcache, int regnum) /* NOTE: cagney/2002-12-02: See comment in fetch_inferior_registers about threaded assumptions. */ - pid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid = get_ptrace_pid (regcache->ptid ()); if (regnum == -1 || sparc_gregset_supplies_p (gdbarch, regnum)) { diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c index 45485b58ef..81bb5dd25f 100644 --- a/gdb/spu-linux-nat.c +++ b/gdb/spu-linux-nat.c @@ -516,7 +516,7 @@ spu_linux_nat_target::fetch_registers (struct regcache *regcache, int regno) /* Since we use functions that rely on inferior_ptid, we need to set and restore it. */ scoped_restore save_ptid - = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache)); + = make_scoped_restore (&inferior_ptid, regcache->ptid ()); /* We must be stopped on a spu_run system call. */ if (!parse_spufs_run (&fd, &addr)) @@ -567,7 +567,7 @@ spu_linux_nat_target::store_registers (struct regcache *regcache, int regno) /* Since we use functions that rely on inferior_ptid, we need to set and restore it. */ scoped_restore save_ptid - = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache)); + = make_scoped_restore (&inferior_ptid, regcache->ptid ()); /* We must be stopped on a spu_run system call. */ if (!parse_spufs_run (&fd, &addr)) diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c index 5da5e4e7fc..4a4d500b3b 100644 --- a/gdb/spu-multiarch.c +++ b/gdb/spu-multiarch.c @@ -189,7 +189,7 @@ spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno) /* Since we use functions that rely on inferior_ptid, we need to set and restore it. */ scoped_restore save_ptid - = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache)); + = make_scoped_restore (&inferior_ptid, regcache->ptid ()); /* This version applies only if we're currently in spu_run. */ if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) @@ -248,7 +248,7 @@ spu_multiarch_target::store_registers (struct regcache *regcache, int regno) /* Since we use functions that rely on inferior_ptid, we need to set and restore it. */ scoped_restore save_ptid - = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache)); + = make_scoped_restore (&inferior_ptid, regcache->ptid ()); /* This version applies only if we're currently in spu_run. */ if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) diff --git a/gdb/tilegx-linux-nat.c b/gdb/tilegx-linux-nat.c index 753d81859d..9b596c0342 100644 --- a/gdb/tilegx-linux-nat.c +++ b/gdb/tilegx-linux-nat.c @@ -137,7 +137,7 @@ tilegx_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum) { elf_gregset_t regs; - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0) perror_with_name (_("Couldn't get registers")); @@ -153,7 +153,7 @@ tilegx_linux_nat_target::store_registers (struct regcache *regcache, int regnum) { elf_gregset_t regs; - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0) perror_with_name (_("Couldn't get registers")); diff --git a/gdb/vax-bsd-nat.c b/gdb/vax-bsd-nat.c index 7f7b54a841..5f67061e05 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); 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_get_ptid (regcache)); + pid_t pid = ptid_get_pid (regcache->ptid ()); 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 608356e74b..3fd8415bfc 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -582,7 +582,7 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, void windows_nat_target::fetch_registers (struct regcache *regcache, int r) { - DWORD pid = ptid_get_tid (regcache_get_ptid (regcache)); + DWORD pid = ptid_get_tid (regcache->ptid ()); windows_thread_info *th = thread_rec (pid, TRUE); /* Check if TH exists. Windows sometimes uses a non-existent @@ -611,7 +611,7 @@ do_windows_store_inferior_registers (const struct regcache *regcache, void windows_nat_target::store_registers (struct regcache *regcache, int r) { - DWORD pid = ptid_get_tid (regcache_get_ptid (regcache)); + DWORD pid = ptid_get_tid (regcache->ptid ()); windows_thread_info *th = thread_rec (pid, TRUE); /* Check if TH exists. Windows sometimes uses a non-existent diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c index 8d9659b7f9..57a44e3023 100644 --- a/gdb/xtensa-linux-nat.c +++ b/gdb/xtensa-linux-nat.c @@ -220,7 +220,7 @@ supply_fpregset (struct regcache *regcache, static void fetch_gregs (struct regcache *regcache, int regnum) { - int tid = ptid_get_lwp (regcache_get_ptid (regcache)); + int tid = ptid_get_lwp (regcache->ptid ()); gdb_gregset_t regs; int areg; @@ -239,7 +239,7 @@ fetch_gregs (struct regcache *regcache, int regnum) static void store_gregs (struct regcache *regcache, int regnum) { - int tid = ptid_get_lwp (regcache_get_ptid (regcache)); + int tid = ptid_get_lwp (regcache->ptid ()); gdb_gregset_t regs; int areg; @@ -267,7 +267,7 @@ static int xtreg_high; static void fetch_xtregs (struct regcache *regcache, int regnum) { - int tid = ptid_get_lwp (regcache_get_ptid (regcache)); + int tid = ptid_get_lwp (regcache->ptid ()); const xtensa_regtable_t *ptr; char xtregs [XTENSA_ELF_XTREG_SIZE]; @@ -283,7 +283,7 @@ fetch_xtregs (struct regcache *regcache, int regnum) static void store_xtregs (struct regcache *regcache, int regnum) { - int tid = ptid_get_lwp (regcache_get_ptid (regcache)); + int tid = ptid_get_lwp (regcache->ptid ()); const xtensa_regtable_t *ptr; char xtregs [XTENSA_ELF_XTREG_SIZE]; -- 2.34.1