diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index e864c35620ea..69658e4a9d53 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1164,8 +1164,11 @@ darwin_nat_target::cancel_breakpoint (ptid_t ptid)
   struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR pc;
 
+  inferior *inf = find_inferior_ptid (this, ptid);
+  gdb_assert (inf != nullptr);
+
   pc = regcache_read_pc (regcache) - gdbarch_decr_pc_after_break (gdbarch);
-  if (breakpoint_inserted_here_p (regcache->aspace (), pc))
+  if (breakpoint_inserted_here_p (inf->aspace, pc))
     {
       inferior_debug (4, "cancel_breakpoint for thread 0x%lx\n",
 		      (unsigned long) ptid.tid ());
diff --git a/gdb/displaced-stepping.c b/gdb/displaced-stepping.c
index c26888404b38..1e0b12831964 100644
--- a/gdb/displaced-stepping.c
+++ b/gdb/displaced-stepping.c
@@ -53,7 +53,6 @@ displaced_step_buffers::prepare (thread_info *thread, CORE_ADDR &displaced_pc)
     gdb_assert (buf.current_thread != thread);
 
   regcache *regcache = get_thread_regcache (thread);
-  const address_space *aspace = regcache->aspace ();
   gdbarch *arch = regcache->arch ();
   ULONGEST len = gdbarch_displaced_step_buffer_length (arch);
 
@@ -64,7 +63,7 @@ displaced_step_buffers::prepare (thread_info *thread, CORE_ADDR &displaced_pc)
 
   for (displaced_step_buffer &candidate : m_buffers)
     {
-      bool bp_in_range = breakpoint_in_range_p (aspace, candidate.addr, len);
+      bool bp_in_range = breakpoint_in_range_p (thread->inf->aspace, candidate.addr, len);
       bool is_free = candidate.current_thread == nullptr;
 
       if (!bp_in_range)
diff --git a/gdb/frame.c b/gdb/frame.c
index de3c7de440d2..1c1c28f5d535 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1619,14 +1619,15 @@ put_frame_register_bytes (frame_info_ptr frame, int regnum,
    CODE_ADDR.  */
 
 static frame_info_ptr
-create_sentinel_frame (struct program_space *pspace, struct regcache *regcache,
-		       CORE_ADDR stack_addr, CORE_ADDR code_addr)
+create_sentinel_frame (program_space *pspace, address_space *aspace,
+		       regcache *regcache, CORE_ADDR stack_addr,
+		       CORE_ADDR code_addr)
 {
   frame_info *frame = FRAME_OBSTACK_ZALLOC (struct frame_info);
 
   frame->level = -1;
   frame->pspace = pspace;
-  frame->aspace = regcache->aspace ();
+  frame->aspace = aspace;
   /* Explicitly initialize the sentinel frame's cache.  Provide it
      with the underlying regcache.  In the future additional
      information, such as the frame's thread will be added.  */
@@ -1687,8 +1688,8 @@ get_current_frame (void)
 
   if (sentinel_frame == NULL)
     sentinel_frame =
-      create_sentinel_frame (current_program_space, get_current_regcache (),
-			     0, 0).get ();
+      create_sentinel_frame (current_program_space, current_inferior ()->aspace,
+			     get_current_regcache (), 0, 0).get ();
 
   /* Set the current frame before computing the frame id, to avoid
      recursion inside compute_frame_id, in case the frame's
@@ -2014,6 +2015,7 @@ create_new_frame (frame_id id)
   frame_info *fi = FRAME_OBSTACK_ZALLOC (struct frame_info);
 
   fi->next = create_sentinel_frame (current_program_space,
+				    current_inferior ()->aspace,
 				    get_current_regcache (),
 				    id.stack_addr, id.code_addr).get ();
 
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 8a8439f6da55..03d2518c7c9d 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2432,7 +2432,6 @@ resume_1 (enum gdb_signal sig)
   struct regcache *regcache = get_current_regcache ();
   struct gdbarch *gdbarch = regcache->arch ();
   struct thread_info *tp = inferior_thread ();
-  const address_space *aspace = regcache->aspace ();
   ptid_t resume_ptid;
   /* This represents the user's step vs continue request.  When
      deciding whether "set scheduler-locking step" applies, it's the
@@ -2511,6 +2510,8 @@ resume_1 (enum gdb_signal sig)
 		       inferior_ptid.to_string ().c_str (),
 		       paddress (gdbarch, pc));
 
+  const address_space *aspace = tp->inf->aspace;
+
   /* Normally, by the time we reach `resume', the breakpoints are either
      removed or inserted, as appropriate.  The exception is if we're sitting
      at a permanent breakpoint; we need to step over it, but permanent
@@ -2624,8 +2625,8 @@ resume_1 (enum gdb_signal sig)
 	  if (target_is_non_stop_p ())
 	    stop_all_threads ("displaced stepping falling back on inline stepping");
 
-	  set_step_over_info (regcache->aspace (),
-			      regcache_read_pc (regcache), 0, tp->global_num);
+	  set_step_over_info (aspace, regcache_read_pc (regcache), 0,
+			      tp->global_num);
 
 	  step = maybe_software_singlestep (gdbarch);
 
@@ -2942,7 +2943,7 @@ thread_still_needs_step_over_bp (struct thread_info *tp)
     {
       struct regcache *regcache = get_thread_regcache (tp);
 
-      if (breakpoint_here_p (regcache->aspace (),
+      if (breakpoint_here_p (tp->inf->aspace,
 			     regcache_read_pc (regcache))
 	  == ordinary_breakpoint_here)
 	return true;
@@ -3284,7 +3285,6 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
 
   regcache = get_current_regcache ();
   gdbarch = regcache->arch ();
-  const address_space *aspace = regcache->aspace ();
 
   pc = regcache_read_pc_protected (regcache);
 
@@ -3304,6 +3304,8 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
 
   if (addr == (CORE_ADDR) -1)
     {
+      const address_space *aspace = cur_thr->inf->aspace;
+
       if (cur_thr->stop_pc_p ()
 	  && pc == cur_thr->stop_pc ()
 	  && breakpoint_here_p (aspace, pc) == ordinary_breakpoint_here
@@ -3786,7 +3788,7 @@ do_target_wait_1 (inferior *inf, ptid_t ptid,
 			       paddress (gdbarch, pc));
 	  discard = 1;
 	}
-      else if (!breakpoint_inserted_here_p (regcache->aspace (), pc))
+      else if (!breakpoint_inserted_here_p (tp->inf->aspace, pc))
 	{
 	  infrun_debug_printf ("previous breakpoint of %s, at %s gone",
 			       tp->ptid.to_string ().c_str (),
@@ -4645,7 +4647,7 @@ adjust_pc_after_break (struct thread_info *thread,
   if (decr_pc == 0)
     return;
 
-  const address_space *aspace = regcache->aspace ();
+  const address_space *aspace = thread->inf->aspace;
 
   /* Find the location where (if we've hit a breakpoint) the
      breakpoint would be.  */
@@ -4797,7 +4799,7 @@ handle_syscall_event (struct execution_control_state *ecs)
       infrun_debug_printf ("syscall number=%d", syscall_number);
 
       ecs->event_thread->control.stop_bpstat
-	= bpstat_stop_status_nowatch (regcache->aspace (),
+	= bpstat_stop_status_nowatch (ecs->event_thread->inf->aspace,
 				      ecs->event_thread->stop_pc (),
 				      ecs->event_thread, ecs->ws);
 
@@ -4994,7 +4996,7 @@ save_waitstatus (struct thread_info *tp, const target_waitstatus &ws)
       && ws.sig () == GDB_SIGNAL_TRAP)
     {
       struct regcache *regcache = get_thread_regcache (tp);
-      const address_space *aspace = regcache->aspace ();
+      const address_space *aspace = tp->inf->aspace;
       CORE_ADDR pc = regcache_read_pc (regcache);
 
       adjust_pc_after_break (tp, tp->pending_waitstatus ());
@@ -5573,7 +5575,7 @@ handle_inferior_event (struct execution_control_state *ecs)
     {
       struct regcache *regcache = get_thread_regcache (ecs->event_thread);
 
-      if (breakpoint_inserted_here_p (regcache->aspace (),
+      if (breakpoint_inserted_here_p (ecs->event_thread->inf->aspace,
 				      regcache_read_pc (regcache)))
 	{
 	  infrun_debug_printf ("Treating signal as SIGTRAP");
@@ -5606,7 +5608,7 @@ handle_inferior_event (struct execution_control_state *ecs)
 
 	    ecs->event_thread->set_stop_pc (regcache_read_pc (regcache));
 	    ecs->event_thread->control.stop_bpstat
-	      = bpstat_stop_status_nowatch (regcache->aspace (),
+	      = bpstat_stop_status_nowatch (ecs->event_thread->inf->aspace,
 					    ecs->event_thread->stop_pc (),
 					    ecs->event_thread, ecs->ws);
 
@@ -5800,10 +5802,9 @@ handle_inferior_event (struct execution_control_state *ecs)
 	       list yet at this point.  */
 
 	    child_regcache
-	      = get_thread_arch_aspace_regcache (parent_inf->process_target (),
-						 ecs->ws.child_ptid (),
-						 gdbarch,
-						 parent_inf->aspace);
+	      = get_thread_arch_regcache (parent_inf->process_target (),
+					  ecs->ws.child_ptid (),
+					  gdbarch);
 	    /* Read PC value of parent process.  */
 	    parent_pc = regcache_read_pc (regcache);
 
@@ -5848,7 +5849,7 @@ handle_inferior_event (struct execution_control_state *ecs)
 	(regcache_read_pc (get_thread_regcache (ecs->event_thread)));
 
       ecs->event_thread->control.stop_bpstat
-	= bpstat_stop_status_nowatch (get_current_regcache ()->aspace (),
+	= bpstat_stop_status_nowatch (ecs->event_thread->inf->aspace,
 				      ecs->event_thread->stop_pc (),
 				      ecs->event_thread, ecs->ws);
 
@@ -5974,7 +5975,7 @@ handle_inferior_event (struct execution_control_state *ecs)
 	(regcache_read_pc (get_thread_regcache (ecs->event_thread)));
 
       ecs->event_thread->control.stop_bpstat
-	= bpstat_stop_status_nowatch (get_current_regcache ()->aspace (),
+	= bpstat_stop_status_nowatch (ecs->event_thread->inf->aspace,
 				      ecs->event_thread->stop_pc (),
 				      ecs->event_thread, ecs->ws);
 
@@ -6364,7 +6365,7 @@ handle_signal_stop (struct execution_control_state *ecs)
       CORE_ADDR pc;
 
       regcache = get_thread_regcache (ecs->event_thread);
-      const address_space *aspace = regcache->aspace ();
+      const address_space *aspace = ecs->event_thread->inf->aspace;
 
       pc = regcache_read_pc (regcache);
 
@@ -6448,8 +6449,7 @@ handle_signal_stop (struct execution_control_state *ecs)
      inline function call sites).  */
   if (ecs->event_thread->control.step_range_end != 1)
     {
-      const address_space *aspace
-	= get_thread_regcache (ecs->event_thread)->aspace ();
+      const address_space *aspace = ecs->event_thread->inf->aspace;
 
       /* skip_inline_frames is expensive, so we avoid it if we can
 	 determine that the address is one where functions cannot have
@@ -6527,7 +6527,7 @@ handle_signal_stop (struct execution_control_state *ecs)
   /* See if there is a breakpoint/watchpoint/catchpoint/etc. that
      handles this event.  */
   ecs->event_thread->control.stop_bpstat
-    = bpstat_stop_status (get_current_regcache ()->aspace (),
+    = bpstat_stop_status (ecs->event_thread->inf->aspace,
 			  ecs->event_thread->stop_pc (),
 			  ecs->event_thread, ecs->ws, stop_chain);
 
@@ -8393,7 +8393,7 @@ keep_going_pass_signal (struct execution_control_state *ecs)
       if (remove_bp
 	  && (remove_wps || !use_displaced_stepping (ecs->event_thread)))
 	{
-	  set_step_over_info (regcache->aspace (),
+	  set_step_over_info (ecs->event_thread->inf->aspace,
 			      regcache_read_pc (regcache), remove_wps,
 			      ecs->event_thread->global_num);
 	}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index fd80fd975c14..7dee8291d4c4 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -2415,6 +2415,17 @@ stop_wait_callback (struct lwp_info *lp)
   return 0;
 }
 
+/* Get the inferior associated to LWP.  Must be called with an LWP that has
+   an associated inferior.  Always return non-nullptr.  */
+
+static inferior *
+lwp_inferior (const lwp_info *lwp)
+{
+  inferior *inf = find_inferior_ptid (linux_target, lwp->ptid);
+  gdb_assert (inf != nullptr);
+  return inf;
+}
+
 /* Return non-zero if LP has a wait status pending.  Discard the
    pending event and resume the LWP if the event that originally
    caused the stop became uninteresting.  */
@@ -2449,7 +2460,7 @@ status_callback (struct lwp_info *lp)
 	}
 
 #if !USE_SIGTRAP_SIGINFO
-      else if (!breakpoint_inserted_here_p (regcache->aspace (), pc))
+      else if (!breakpoint_inserted_here_p (lwp_inferior (lp)->aspace, pc))
 	{
 	  linux_nat_debug_printf ("previous breakpoint of %s, at %s gone",
 				  lp->ptid.to_string ().c_str (),
@@ -2548,7 +2559,7 @@ save_stop_reason (struct lwp_info *lp)
   if (!linux_target->low_status_is_event (lp->status))
     return;
 
-  inferior *inf = find_inferior_ptid (linux_target, lp->ptid);
+  inferior *inf = lwp_inferior (lp);
   if (inf->starting_up)
     return;
 
@@ -2603,15 +2614,14 @@ save_stop_reason (struct lwp_info *lp)
     }
 #else
   if ((!lp->step || lp->stop_pc == sw_bp_pc)
-      && software_breakpoint_inserted_here_p (regcache->aspace (),
-					      sw_bp_pc))
+      && software_breakpoint_inserted_here_p (inf->aspace, sw_bp_pc))
     {
       /* The LWP was either continued, or stepped a software
 	 breakpoint instruction.  */
       lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
     }
 
-  if (hardware_breakpoint_inserted_here_p (regcache->aspace (), pc))
+  if (hardware_breakpoint_inserted_here_p (inf->aspace, pc))
     lp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
 
   if (lp->stop_reason == TARGET_STOPPED_BY_NO_REASON)
@@ -3375,7 +3385,7 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid)
 	     immediately, and we're not waiting for this LWP.  */
 	  if (!lp->ptid.matches (wait_ptid))
 	    {
-	      if (breakpoint_inserted_here_p (regcache->aspace (), pc))
+	      if (breakpoint_inserted_here_p (lwp_inferior (lp)->aspace, pc))
 		leave_stopped = 1;
 	    }
 
@@ -4296,38 +4306,6 @@ linux_nat_target::stop (ptid_t ptid)
   iterate_over_lwps (ptid, linux_nat_stop_lwp);
 }
 
-/* When requests are passed down from the linux-nat layer to the
-   single threaded inf-ptrace layer, ptids of (lwpid,0,0) form are
-   used.  The address space pointer is stored in the inferior object,
-   but the common code that is passed such ptid can't tell whether
-   lwpid is a "main" process id or not (it assumes so).  We reverse
-   look up the "main" process id from the lwp here.  */
-
-struct address_space *
-linux_nat_target::thread_address_space (ptid_t ptid)
-{
-  struct lwp_info *lwp;
-  struct inferior *inf;
-  int pid;
-
-  if (ptid.lwp () == 0)
-    {
-      /* An (lwpid,0,0) ptid.  Look up the lwp object to get at the
-	 tgid.  */
-      lwp = find_lwp_pid (ptid);
-      pid = lwp->ptid.pid ();
-    }
-  else
-    {
-      /* A (pid,lwpid,0) ptid.  */
-      pid = ptid.pid ();
-    }
-
-  inf = find_inferior_pid (this, pid);
-  gdb_assert (inf != NULL);
-  return inf->aspace;
-}
-
 /* Return the cached value of the processor core for thread PTID.  */
 
 int
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index 770fe9244277..72c4bbefbb59 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -68,8 +68,6 @@ class linux_nat_target : public inf_ptrace_target
 
   const char *thread_name (struct thread_info *) override;
 
-  struct address_space *thread_address_space (ptid_t) override;
-
   bool stopped_by_watchpoint () override;
 
   bool stopped_data_address (CORE_ADDR *) override;
diff --git a/gdb/process-stratum-target.c b/gdb/process-stratum-target.c
index e1d41c86b9c3..5ea5ef202a71 100644
--- a/gdb/process-stratum-target.c
+++ b/gdb/process-stratum-target.c
@@ -26,20 +26,6 @@ process_stratum_target::~process_stratum_target ()
 {
 }
 
-struct address_space *
-process_stratum_target::thread_address_space (ptid_t ptid)
-{
-  /* Fall-back to the "main" address space of the inferior.  */
-  inferior *inf = find_inferior_ptid (this, ptid);
-
-  if (inf == NULL || inf->aspace == NULL)
-    internal_error (_("Can't determine the current "
-		      "address space of thread %s\n"),
-		    target_pid_to_str (ptid).c_str ());
-
-  return inf->aspace;
-}
-
 struct gdbarch *
 process_stratum_target::thread_architecture (ptid_t ptid)
 {
diff --git a/gdb/process-stratum-target.h b/gdb/process-stratum-target.h
index dcbca5a9c6ad..60e1ed0968f1 100644
--- a/gdb/process-stratum-target.h
+++ b/gdb/process-stratum-target.h
@@ -51,10 +51,6 @@ class process_stratum_target : public target_ops
   bool supports_non_stop () override { return false; }
   bool supports_disable_randomization () override { return false; }
 
-  /* This default implementation returns the inferior's address
-     space.  */
-  struct address_space *thread_address_space (ptid_t ptid) override;
-
   /* This default implementation always returns target_gdbarch ().  */
   struct gdbarch *thread_architecture (ptid_t ptid) override;
 
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 15c5b7d682ed..acab7e1ce06a 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -883,7 +883,7 @@ record_full_exec_insn (struct regcache *regcache,
 		       not doing the change at all if the watchpoint
 		       traps.  */
 		    if (hardware_watchpoint_inserted_in_range
-			(regcache->aspace (),
+			(current_inferior ()->aspace,
 			 entry->u.mem.addr, entry->u.mem.len))
 		      record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
 		  }
@@ -1210,7 +1210,7 @@ record_full_wait_1 (struct target_ops *ops,
 				    ret);
 		  regcache = get_current_regcache ();
 		  tmp_pc = regcache_read_pc (regcache);
-		  const struct address_space *aspace = regcache->aspace ();
+		  const address_space *aspace = current_inferior ()->aspace;
 
 		  if (target_stopped_by_watchpoint ())
 		    {
@@ -1280,7 +1280,7 @@ record_full_wait_1 (struct target_ops *ops,
 			record_full_resume_ptid);
       struct regcache *regcache = get_current_regcache ();
       struct gdbarch *gdbarch = regcache->arch ();
-      const struct address_space *aspace = regcache->aspace ();
+      const address_space *aspace = current_inferior ()->aspace;
       int continue_flag = 1;
       int first_record_full_end = 1;
 
diff --git a/gdb/regcache.c b/gdb/regcache.c
index af76fab1a34f..9ff40a7e6aaf 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -208,11 +208,10 @@ reg_buffer::reg_buffer (gdbarch *gdbarch, bool has_pseudo)
     }
 }
 
-regcache::regcache (process_stratum_target *target, gdbarch *gdbarch,
-		    const address_space *aspace_)
+regcache::regcache (process_stratum_target *target, gdbarch *gdbarch)
 /* The register buffers.  A read/write register cache can only hold
    [0 .. gdbarch_num_regs).  */
-  : detached_regcache (gdbarch, false), m_aspace (aspace_), m_target (target)
+  : detached_regcache (gdbarch, false), m_target (target)
 {
   m_ptid = minus_one_ptid;
 }
@@ -348,9 +347,8 @@ using target_pid_ptid_regcache_map
 static target_pid_ptid_regcache_map regcaches;
 
 struct regcache *
-get_thread_arch_aspace_regcache (process_stratum_target *target,
-				 ptid_t ptid, gdbarch *arch,
-				 struct address_space *aspace)
+get_thread_arch_regcache (process_stratum_target *target, ptid_t ptid,
+			  gdbarch *arch)
 {
   gdb_assert (target != nullptr);
 
@@ -369,7 +367,7 @@ get_thread_arch_aspace_regcache (process_stratum_target *target,
     }
 
   /* It does not exist, create it.  */
-  regcache *new_regcache = new regcache (target, arch, aspace);
+  regcache *new_regcache = new regcache (target, arch);
   new_regcache->set_ptid (ptid);
   /* Work around a problem with g++ 4.8 (PR96537): Call the regcache_up
      constructor explictly instead of implicitly.  */
@@ -378,17 +376,6 @@ get_thread_arch_aspace_regcache (process_stratum_target *target,
   return new_regcache;
 }
 
-struct regcache *
-get_thread_arch_regcache (process_stratum_target *target, ptid_t ptid,
-			  struct gdbarch *gdbarch)
-{
-  scoped_restore_current_inferior restore_current_inferior;
-  set_current_inferior (find_inferior_ptid (target, ptid));
-  address_space *aspace = target_thread_address_space (ptid);
-
-  return get_thread_arch_aspace_regcache (target, ptid, gdbarch, aspace);
-}
-
 static process_stratum_target *current_thread_target;
 static ptid_t current_thread_ptid;
 static struct gdbarch *current_thread_arch;
@@ -1607,25 +1594,23 @@ regcache_count (process_stratum_target *target, ptid_t ptid)
   return 0;
 };
 
-/* Wrapper around get_thread_arch_aspace_regcache that does some self checks.  */
+/* Wrapper around get_thread_arch_regcache that does some self checks.  */
 
 static void
-get_thread_arch_aspace_regcache_and_check (process_stratum_target *target,
+get_thread_arch_regcache_and_check (process_stratum_target *target,
 					   ptid_t ptid)
 {
   /* We currently only test with a single gdbarch.  Any gdbarch will do, so use
      the current inferior's gdbarch.  Also use the current inferior's address
      space.  */
   gdbarch *arch = current_inferior ()->gdbarch;
-  address_space *aspace = current_inferior ()->aspace;
   regcache *regcache
-    = get_thread_arch_aspace_regcache (target, ptid, arch, aspace);
+    = get_thread_arch_regcache (target, ptid, arch );
 
   SELF_CHECK (regcache != NULL);
   SELF_CHECK (regcache->target () == target);
   SELF_CHECK (regcache->ptid () == ptid);
   SELF_CHECK (regcache->arch () == arch);
-  SELF_CHECK (regcache->aspace () == aspace);
 }
 
 /* The data that the regcaches selftests must hold onto for the duration of the
@@ -1670,12 +1655,12 @@ populate_regcaches_for_test ()
     {
       for (long lwp : { 1, 2, 3 })
 	{
-	  get_thread_arch_aspace_regcache_and_check
+	  get_thread_arch_regcache_and_check
 	    (&data->test_target1, ptid_t (pid, lwp));
 	  expected_regcache_size++;
 	  SELF_CHECK (regcaches_size () == expected_regcache_size);
 
-	  get_thread_arch_aspace_regcache_and_check
+	  get_thread_arch_regcache_and_check
 	    (&data->test_target2, ptid_t (pid, lwp));
 	  expected_regcache_size++;
 	  SELF_CHECK (regcaches_size () == expected_regcache_size);
@@ -1686,15 +1671,15 @@ populate_regcaches_for_test ()
 }
 
 static void
-get_thread_arch_aspace_regcache_test ()
+get_thread_arch_regcache_test ()
 {
   /* populate_regcaches_for_test already tests most of the
-     get_thread_arch_aspace_regcache functionality.  */
+     get_thread_arch_regcache functionality.  */
   regcache_test_data_up data = populate_regcaches_for_test ();
   size_t regcaches_size_before = regcaches_size ();
 
   /* Test that getting an existing regcache doesn't create a new one.  */
-  get_thread_arch_aspace_regcache_and_check (&data->test_target1, ptid_t (2, 2));
+  get_thread_arch_regcache_and_check (&data->test_target1, ptid_t (2, 2));
   SELF_CHECK (regcaches_size () == regcaches_size_before);
 }
 
@@ -1815,7 +1800,7 @@ class readwrite_regcache : public regcache
 public:
   readwrite_regcache (process_stratum_target *target,
 		      struct gdbarch *gdbarch)
-    : regcache (target, gdbarch, nullptr)
+    : regcache (target, gdbarch)
   {}
 };
 
@@ -2094,10 +2079,10 @@ regcache_thread_ptid_changed ()
   gdb_assert (regcaches.empty ());
 
   /* Populate the regcaches container.  */
-  get_thread_arch_aspace_regcache (&target1.mock_target, old_ptid, arch,
-				   nullptr);
-  get_thread_arch_aspace_regcache (&target2.mock_target, old_ptid, arch,
-				   nullptr);
+  get_thread_arch_regcache (&target1.mock_target, old_ptid, arch
+				   );
+  get_thread_arch_regcache (&target2.mock_target, old_ptid, arch
+				   );
 
   gdb_assert (regcaches.size () == 2);
   gdb_assert (regcache_count (&target1.mock_target, old_ptid) == 1);
@@ -2141,8 +2126,8 @@ _initialize_regcache ()
   deprecate_cmd (c, "maintenance flush register-cache");
 
 #if GDB_SELF_TEST
-  selftests::register_test ("get_thread_arch_aspace_regcache",
-			    selftests::get_thread_arch_aspace_regcache_test);
+  selftests::register_test ("get_thread_arch_regcache",
+			    selftests::get_thread_arch_regcache_test);
   selftests::register_test ("registers_changed_ptid_all",
 			    selftests::registers_changed_ptid_all_test);
   selftests::register_test ("registers_changed_ptid_target",
diff --git a/gdb/regcache.h b/gdb/regcache.h
index b9ffab9950d2..1c37bbdc7b67 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -26,7 +26,6 @@
 struct regcache;
 struct regset;
 struct gdbarch;
-struct address_space;
 class thread_info;
 struct process_stratum_target;
 
@@ -38,10 +37,7 @@ extern struct regcache *get_thread_regcache (process_stratum_target *target,
 extern struct regcache *get_thread_regcache (thread_info *thread);
 
 extern struct regcache *get_thread_arch_regcache
-  (process_stratum_target *targ, ptid_t, struct gdbarch *);
-extern struct regcache *get_thread_arch_aspace_regcache
-  (process_stratum_target *target, ptid_t,
-   struct gdbarch *, struct address_space *);
+  (process_stratum_target *target, ptid_t, struct gdbarch *);
 
 extern enum register_status
   regcache_raw_read_signed (struct regcache *regcache,
@@ -338,12 +334,6 @@ class regcache : public detached_regcache
 public:
   DISABLE_COPY_AND_ASSIGN (regcache);
 
-  /* Return REGCACHE's address space.  */
-  const address_space *aspace () const
-  {
-    return m_aspace;
-  }
-
   /* Restore 'this' regcache.  The set of registers restored into
      the regcache determined by the restore_reggroup.
      Writes to regcache will go through to the target.  SRC is a
@@ -426,8 +416,7 @@ class regcache : public detached_regcache
   void debug_print_register (const char *func, int regno);
 
 protected:
-  regcache (process_stratum_target *target, gdbarch *gdbarch,
-	    const address_space *aspace);
+  regcache (process_stratum_target *target, gdbarch *gdbarch);
 
 private:
 
@@ -449,19 +438,14 @@ class regcache : public detached_regcache
   enum register_status write_part (int regnum, int offset, int len,
 				   const gdb_byte *in, bool is_raw);
 
-  /* The address space of this register cache (for registers where it
-     makes sense, like PC or SP).  */
-  const address_space * const m_aspace;
-
   /* If this is a read-write cache, which thread's registers is
      it connected to?  */
   process_stratum_target *m_target;
   ptid_t m_ptid;
 
   friend struct regcache *
-  get_thread_arch_aspace_regcache (process_stratum_target *target, ptid_t ptid,
-				   struct gdbarch *gdbarch,
-				   struct address_space *aspace);
+  get_thread_arch_regcache (process_stratum_target *target, ptid_t ptid,
+			    struct gdbarch *gdbarch);
 };
 
 using regcache_up = std::unique_ptr<regcache>;
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 57b66ce87b1e..d6f5ff229fef 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -132,7 +132,6 @@ struct dummy_target : public target_ops
   void dumpcore (const char *arg0) override;
   bool can_run_breakpoint_commands () override;
   struct gdbarch *thread_architecture (ptid_t arg0) override;
-  struct address_space *thread_address_space (ptid_t arg0) override;
   bool filesystem_is_local () override;
   void trace_init () override;
   void download_tracepoint (struct bp_location *arg0) override;
@@ -306,7 +305,6 @@ struct debug_target : public target_ops
   void dumpcore (const char *arg0) override;
   bool can_run_breakpoint_commands () override;
   struct gdbarch *thread_architecture (ptid_t arg0) override;
-  struct address_space *thread_address_space (ptid_t arg0) override;
   bool filesystem_is_local () override;
   void trace_init () override;
   void download_tracepoint (struct bp_location *arg0) override;
@@ -2960,32 +2958,6 @@ debug_target::thread_architecture (ptid_t arg0)
   return result;
 }
 
-struct address_space *
-target_ops::thread_address_space (ptid_t arg0)
-{
-  return this->beneath ()->thread_address_space (arg0);
-}
-
-struct address_space *
-dummy_target::thread_address_space (ptid_t arg0)
-{
-  return NULL;
-}
-
-struct address_space *
-debug_target::thread_address_space (ptid_t arg0)
-{
-  struct address_space * result;
-  gdb_printf (gdb_stdlog, "-> %s->thread_address_space (...)\n", this->beneath ()->shortname ());
-  result = this->beneath ()->thread_address_space (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->thread_address_space (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_struct_address_space_p (result);
-  gdb_puts ("\n", gdb_stdlog);
-  return result;
-}
-
 bool
 target_ops::filesystem_is_local ()
 {
diff --git a/gdb/target.c b/gdb/target.c
index 0cebecfafc37..e0cbd700e054 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3008,19 +3008,6 @@ target_get_osdata (const char *type)
   return target_read_stralloc (t, TARGET_OBJECT_OSDATA, type);
 }
 
-/* Determine the current address space of thread PTID.  */
-
-struct address_space *
-target_thread_address_space (ptid_t ptid)
-{
-  struct address_space *aspace;
-
-  aspace = current_inferior ()->top_target ()->thread_address_space (ptid);
-  gdb_assert (aspace != NULL);
-
-  return aspace;
-}
-
 /* See target.h.  */
 
 target_ops *
diff --git a/gdb/target.h b/gdb/target.h
index 2dac86c394d1..95ad41e83bcc 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -933,10 +933,6 @@ struct target_ops
     virtual struct gdbarch *thread_architecture (ptid_t)
       TARGET_DEFAULT_RETURN (NULL);
 
-    /* Determine current address space of thread PTID.  */
-    virtual struct address_space *thread_address_space (ptid_t)
-      TARGET_DEFAULT_RETURN (NULL);
-
     /* Target file operations.  */
 
     /* Return true if the filesystem seen by the current inferior
@@ -1533,10 +1529,6 @@ extern void target_store_registers (struct regcache *regcache, int regs);
 
 extern void target_prepare_to_store (regcache *regcache);
 
-/* Determine current address space of thread PTID.  */
-
-struct address_space *target_thread_address_space (ptid_t);
-
 /* Implement the "info proc" command.  This returns one if the request
    was handled, and zero otherwise.  It can also throw an exception if
    an error was encountered while attempting to handle the
