From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 6BD673858C52 for ; Mon, 6 Nov 2023 16:35:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6BD673858C52 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6BD673858C52 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699288558; cv=none; b=LAFPIM/R06i+XcVhyk7Bfi8F0zySBoaYeM0HWEUFZ0/zkryQqFeODrUx2RzRfqGQ7z+wuVHN7d4Htx6ayiY/kz6scSspnfmylCm7OJrNrLlZx+CKmrBIsard3UDJ9/eQYwEOHhFGGJNP70+LPVcP7my873t2hdMc963kV9kao9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699288558; c=relaxed/simple; bh=j4qjcMCewrMdRFf8uF4WAZTqqt9CCEbjstXla/FKQvg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Vvgnu8JsnrjKDhipfqgtbaVjyRaXpcpAG1YhO7/3sliiUUP17bTzhdatNbmMURaNtBfH9v0bLoDbkiZffmssWPtgv0GQ9LXu7ECPZjKBPvaVF4D/IdyDcqLhEHklWA5G+xa//ABYi43nSOTdUA6bfbCgDwd829sDoYqtW0QD0/U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smarchi-efficios.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id BD4641E11B; Mon, 6 Nov 2023 11:35:48 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/3] gdb: remove regcache's address space Date: Mon, 6 Nov 2023 11:33:24 -0500 Message-ID: <20231106163547.12579-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231106163547.12579-1-simon.marchi@efficios.com> References: <20231106163547.12579-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3496.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_SOFTFAIL,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: While looking at the regcache code, I noticed that the address space (passed to regcache when constructing it, and available through regcache::aspace) wasn't relevant for the regcache itself. Callers of regcache::aspace use that method because it appears to be a convenient way of getting the address space for a thread, if you already have the regcache. But there is always another way to get the address space, as the callers pretty much always know which thread they are dealing with. The regcache code itself doesn't use the address space. This patch removes anything related to address_space from the regcache code, and updates callers to get it from the thread in context. This removes a bit of unnecessary complexity from the regcache code. The current get_thread_arch_regcache function gets an address_space for the given thread using the target_thread_address_space function (which calls the target_ops::thread_address_space method). This suggest that there might have been the intention of supporting per-thread address spaces. But digging through the history, I did not find any such case. Maybe this method was just added because we needed a way to get an address space from a ptid (because constructing a regcache required an address space), and this seemed like the right way to do it, I don't know. The only implementations of thread_address_space and process_stratum_target::thread_address_space and linux_nat_target::thread_address_space, which essentially just return the inferior's address space. And thread_address_space is only used in the current get_thread_arch_regcache, which gets removed. So, I think that the thread_address_space target method can be removed, and we can assume that it's fine to use the inferior's address space everywhere. Callers of regcache::aspace are updated to get the address space from the relevant inferior, either using some context they already know about, or in last resort using the current global context. So, to summarize: - remove everything in regcache related to address spaces - in particular, remove get_thread_arch_regcache, and rename get_thread_arch_aspace_regcache to get_thread_arch_regcache - remove target_ops::thread_address_space, and target_thread_address_space - adjust all users of regcache::aspace to get the address space another way Change-Id: I04fd41b22c83fe486522af7851c75bcfb31c88c7 --- gdb/aarch64-fbsd-tdep.c | 3 +- gdb/amd64-fbsd-tdep.c | 6 ++-- gdb/arm-fbsd-tdep.c | 6 ++-- gdb/darwin-nat.c | 7 ++-- gdb/displaced-stepping.c | 3 +- gdb/frame.c | 12 ++++--- gdb/gcore-elf.c | 5 ++- gdb/i386-fbsd-tdep.c | 6 ++-- gdb/infrun.c | 43 +++++++++++------------ gdb/linux-nat.c | 56 +++++++++-------------------- gdb/linux-nat.h | 2 -- gdb/ppc-fbsd-tdep.c | 6 ++-- gdb/proc-service.c | 3 +- gdb/process-stratum-target.c | 14 -------- gdb/process-stratum-target.h | 4 --- gdb/record-full.c | 6 ++-- gdb/regcache.c | 68 ++++++++++++++---------------------- gdb/regcache.h | 27 +++----------- gdb/remote.c | 8 +++-- gdb/riscv-fbsd-tdep.c | 6 ++-- gdb/sol-thread.c | 20 +++++------ gdb/solib-svr4.c | 5 ++- gdb/target-delegates.c | 28 --------------- gdb/target.c | 13 ------- gdb/target.h | 8 ----- 25 files changed, 113 insertions(+), 252 deletions(-) diff --git a/gdb/aarch64-fbsd-tdep.c b/gdb/aarch64-fbsd-tdep.c index 1102eb0d13b8..681149b1c6ce 100644 --- a/gdb/aarch64-fbsd-tdep.c +++ b/gdb/aarch64-fbsd-tdep.c @@ -215,8 +215,7 @@ aarch64_fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, aarch64_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct regcache *regcache; - regcache = get_thread_arch_regcache (current_inferior ()->process_target (), - ptid, gdbarch); + regcache = get_thread_arch_regcache (current_inferior (), ptid, gdbarch); target_fetch_registers (regcache, tdep->tls_regnum_base); diff --git a/gdb/amd64-fbsd-tdep.c b/gdb/amd64-fbsd-tdep.c index 2b633cd479cc..5b0896fcd417 100644 --- a/gdb/amd64-fbsd-tdep.c +++ b/gdb/amd64-fbsd-tdep.c @@ -288,10 +288,8 @@ static CORE_ADDR amd64fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset) { - struct regcache *regcache; - - regcache = get_thread_arch_regcache (current_inferior ()->process_target (), - ptid, gdbarch); + regcache *regcache + = get_thread_arch_regcache (current_inferior (), ptid, gdbarch); target_fetch_registers (regcache, AMD64_FSBASE_REGNUM); diff --git a/gdb/arm-fbsd-tdep.c b/gdb/arm-fbsd-tdep.c index b6aa42a4fd05..90273a3f5ef8 100644 --- a/gdb/arm-fbsd-tdep.c +++ b/gdb/arm-fbsd-tdep.c @@ -271,10 +271,8 @@ arm_fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset) { arm_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - struct regcache *regcache; - - regcache = get_thread_arch_regcache (current_inferior ()->process_target (), - ptid, gdbarch); + regcache *regcache + = get_thread_arch_regcache (current_inferior (), ptid, gdbarch); target_fetch_registers (regcache, tdep->tls_regnum); diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 588e9e2a3457..0de476b022bb 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -1151,7 +1151,7 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr, } int -darwin_nat_target::cancel_breakpoint (ptid_t ptid) +darwin_nat_target::cancel_breakpoint (inferior *inf, ptid_t ptid) { /* Arrange for a breakpoint to be hit again later. We will handle the current event, eventually we will resume this thread, and this @@ -1166,7 +1166,7 @@ darwin_nat_target::cancel_breakpoint (ptid_t ptid) CORE_ADDR pc; 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 ()); @@ -1286,7 +1286,8 @@ darwin_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *status) && thread->event.ex_type == EXC_BREAKPOINT) { if (thread->single_step - || cancel_breakpoint (ptid_t (inf->pid, 0, thread->gdb_port))) + || cancel_breakpoint (inf, + ptid_t (inf->pid, 0, thread->gdb_port))) { gdb_assert (thread->msg_state == DARWIN_MESSAGE); darwin_send_reply (inf, thread); diff --git a/gdb/displaced-stepping.c b/gdb/displaced-stepping.c index 41c3c999d1e9..6c90fd2c9b64 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 7077016ccba4..2d63d6e4b4cc 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 @@ -2021,6 +2022,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/gcore-elf.c b/gdb/gcore-elf.c index 0142db82670d..8b4177cfe257 100644 --- a/gdb/gcore-elf.c +++ b/gdb/gcore-elf.c @@ -128,9 +128,8 @@ gcore_elf_build_thread_register_notes (struct gdbarch *gdbarch, struct thread_info *info, gdb_signal stop_signal, bfd *obfd, gdb::unique_xmalloc_ptr *note_data, int *note_size) { - struct regcache *regcache - = get_thread_arch_regcache (info->inf->process_target (), - info->ptid, gdbarch); + regcache *regcache + = get_thread_arch_regcache (info->inf, info->ptid, gdbarch); target_fetch_registers (regcache, -1); gcore_elf_collect_thread_registers (regcache, info->ptid, obfd, note_data, note_size, stop_signal); diff --git a/gdb/i386-fbsd-tdep.c b/gdb/i386-fbsd-tdep.c index f8c2758c2b0c..58d06e367670 100644 --- a/gdb/i386-fbsd-tdep.c +++ b/gdb/i386-fbsd-tdep.c @@ -354,10 +354,8 @@ static CORE_ADDR i386fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset) { - struct regcache *regcache; - - regcache = get_thread_arch_regcache (current_inferior ()->process_target (), - ptid, gdbarch); + regcache *regcache + = get_thread_arch_regcache (current_inferior (), ptid, gdbarch); target_fetch_registers (regcache, I386_GSBASE_REGNUM); diff --git a/gdb/infrun.c b/gdb/infrun.c index 4fde96800fb1..3a057764b149 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2455,7 +2455,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 @@ -2534,6 +2533,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 @@ -2648,8 +2649,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); @@ -2976,7 +2977,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; @@ -3419,7 +3420,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); @@ -3441,6 +3441,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 @@ -3869,7 +3871,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 (), @@ -4746,7 +4748,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. */ @@ -4898,7 +4900,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); @@ -5095,7 +5097,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 ()); @@ -5675,7 +5677,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"); @@ -5708,7 +5710,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); @@ -5902,10 +5904,8 @@ handle_inferior_event (struct execution_control_state *ecs) list yet at this point. */ child_regcache - = get_thread_arch_aspace_regcache (parent_inf, - ecs->ws.child_ptid (), - gdbarch, - parent_inf->aspace); + = get_thread_arch_regcache (parent_inf, ecs->ws.child_ptid (), + gdbarch); /* Read PC value of parent process. */ parent_pc = regcache_read_pc (regcache); @@ -5950,7 +5950,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); @@ -6076,7 +6076,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); @@ -6493,7 +6493,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); @@ -6577,8 +6577,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 @@ -6656,7 +6655,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); @@ -8527,7 +8526,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 1c9756c18bd7..d215ead0f110 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -2430,6 +2430,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. */ @@ -2465,7 +2476,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 (), @@ -2565,7 +2576,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; @@ -2620,15 +2631,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) @@ -3363,7 +3373,7 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, static int resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid) { - inferior *inf = find_inferior_ptid (linux_target, lp->ptid); + inferior *inf = lwp_inferior (lp); if (!lp->stopped) { @@ -3399,7 +3409,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 (inf->aspace, pc)) leave_stopped = 1; } @@ -4332,38 +4342,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/ppc-fbsd-tdep.c b/gdb/ppc-fbsd-tdep.c index 4355b6483fea..2238a22afd90 100644 --- a/gdb/ppc-fbsd-tdep.c +++ b/gdb/ppc-fbsd-tdep.c @@ -288,11 +288,9 @@ ppcfbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset) { ppc_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - struct regcache *regcache; int tp_offset, tp_regnum; - - regcache = get_thread_arch_regcache (current_inferior ()->process_target (), - ptid, gdbarch); + regcache *regcache + = get_thread_arch_regcache (current_inferior (), ptid, gdbarch); if (tdep->wordsize == 4) { diff --git a/gdb/proc-service.c b/gdb/proc-service.c index e41278dbe6a8..48f3dec55871 100644 --- a/gdb/proc-service.c +++ b/gdb/proc-service.c @@ -135,8 +135,7 @@ static struct regcache * get_ps_regcache (struct ps_prochandle *ph, lwpid_t lwpid) { inferior *inf = ph->thread->inf; - return get_thread_arch_regcache (inf->process_target (), - ptid_t (inf->pid, lwpid), + return get_thread_arch_regcache (inf, ptid_t (inf->pid, lwpid), inf->arch ()); } diff --git a/gdb/process-stratum-target.c b/gdb/process-stratum-target.c index 173c3ecad134..017d26e28df1 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 f4968ec47019..f35b59978f82 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 the current inferior's gdbarch. */ struct gdbarch *thread_architecture (ptid_t ptid) override; diff --git a/gdb/record-full.c b/gdb/record-full.c index 2ee08e6d54fb..1cea869e88bb 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -884,7 +884,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; } @@ -1218,7 +1218,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 ()) { @@ -1288,7 +1288,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 2e48c0258091..48a926ed4483 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -208,11 +208,10 @@ reg_buffer::reg_buffer (gdbarch *gdbarch, bool has_pseudo) } } -regcache::regcache (inferior *inf_for_target_calls, gdbarch *gdbarch, - const address_space *aspace_) +regcache::regcache (inferior *inf_for_target_calls, gdbarch *gdbarch) /* The register buffers. A read/write register cache can only hold [0 .. gdbarch_num_regs). */ - : detached_regcache (gdbarch, false), m_aspace (aspace_), + : detached_regcache (gdbarch, false), m_inf_for_target_calls (inf_for_target_calls) { m_ptid = minus_one_ptid; @@ -348,10 +347,9 @@ using target_pid_ptid_regcache_map target when appropriate. */ static target_pid_ptid_regcache_map regcaches; -struct regcache * -get_thread_arch_aspace_regcache (inferior *inf_for_target_calls, - ptid_t ptid, gdbarch *arch, - struct address_space *aspace) +regcache * +get_thread_arch_regcache (inferior *inf_for_target_calls, ptid_t ptid, + gdbarch *arch) { gdb_assert (inf_for_target_calls != nullptr); @@ -373,7 +371,7 @@ get_thread_arch_aspace_regcache (inferior *inf_for_target_calls, } /* It does not exist, create it. */ - regcache *new_regcache = new regcache (inf_for_target_calls, arch, aspace); + regcache *new_regcache = new regcache (inf_for_target_calls, arch); new_regcache->set_ptid (ptid); /* Work around a problem with g++ 4.8 (PR96537): Call the regcache_up constructor explicitly instead of implicitly. */ @@ -382,18 +380,6 @@ get_thread_arch_aspace_regcache (inferior *inf_for_target_calls, 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; - inferior *inf = find_inferior_ptid (target, ptid); - set_current_inferior (inf); - address_space *aspace = target_thread_address_space (ptid); - - return get_thread_arch_aspace_regcache (inf, ptid, gdbarch, aspace); -} - static process_stratum_target *current_thread_target; static ptid_t current_thread_ptid; static struct gdbarch *current_thread_arch; @@ -401,6 +387,8 @@ static struct gdbarch *current_thread_arch; struct regcache * get_thread_regcache (process_stratum_target *target, ptid_t ptid) { + inferior *inf = find_inferior_ptid (target, ptid); + if (!current_thread_arch || target != current_thread_target || current_thread_ptid != ptid) @@ -411,11 +399,11 @@ get_thread_regcache (process_stratum_target *target, ptid_t ptid) current_thread_target = target; scoped_restore_current_inferior restore_current_inferior; - set_current_inferior (find_inferior_ptid (target, ptid)); + set_current_inferior (inf); current_thread_arch = target_thread_architecture (ptid); } - return get_thread_arch_regcache (target, ptid, current_thread_arch); + return get_thread_arch_regcache (inf, ptid, current_thread_arch); } /* See regcache.h. */ @@ -1618,24 +1606,22 @@ 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 (inferior *inf_for_target_calls, - ptid_t ptid) +get_thread_arch_regcache_and_check (inferior *inf_for_target_calls, + 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 = inf_for_target_calls->arch (); - address_space *aspace = inf_for_target_calls->aspace; - regcache *regcache = get_thread_arch_aspace_regcache (inf_for_target_calls, - ptid, arch, aspace); + regcache *regcache + = get_thread_arch_regcache (inf_for_target_calls, ptid, arch); SELF_CHECK (regcache != NULL); 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 @@ -1683,12 +1669,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_ctx_1.mock_inferior, 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_ctx_2.mock_inferior, ptid_t (pid, lwp)); expected_regcache_size++; SELF_CHECK (regcaches_size () == expected_regcache_size); @@ -1699,16 +1685,16 @@ 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_ctx_1.mock_inferior, - ptid_t (2, 2)); + get_thread_arch_regcache_and_check (&data->test_ctx_1.mock_inferior, + ptid_t (2, 2)); SELF_CHECK (regcaches_size () == regcaches_size_before); } @@ -1835,7 +1821,7 @@ class readwrite_regcache : public regcache public: readwrite_regcache (inferior *inf_for_target_calls, struct gdbarch *gdbarch) - : regcache (inf_for_target_calls, gdbarch, nullptr) + : regcache (inf_for_target_calls, gdbarch) {} }; @@ -2116,10 +2102,8 @@ regcache_thread_ptid_changed () gdb_assert (regcaches.empty ()); /* Populate the regcaches container. */ - get_thread_arch_aspace_regcache (&target1.mock_inferior, old_ptid, arch, - nullptr); - get_thread_arch_aspace_regcache (&target2.mock_inferior, old_ptid, arch, - nullptr); + get_thread_arch_regcache (&target1.mock_inferior, old_ptid, arch); + get_thread_arch_regcache (&target2.mock_inferior, old_ptid, arch); gdb_assert (regcaches.size () == 2); gdb_assert (regcache_count (&target1.mock_target, old_ptid) == 1); @@ -2163,8 +2147,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 57ddac465f09..f73f08a44ab7 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; struct inferior; @@ -38,11 +37,8 @@ extern struct regcache *get_thread_regcache (process_stratum_target *target, /* Get the regcache of THREAD. */ 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 - (inferior *inf_for_target_calls, ptid_t, - struct gdbarch *, struct address_space *); +extern regcache *get_thread_arch_regcache (inferior *inf_for_target_calls, + ptid_t ptid, gdbarch *arch); extern enum register_status regcache_raw_read_signed (struct regcache *regcache, @@ -339,12 +335,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 @@ -422,8 +412,7 @@ class regcache : public detached_regcache void debug_print_register (const char *func, int regno); protected: - regcache (inferior *inf_for_target_calls, gdbarch *gdbarch, - const address_space *aspace); + regcache (inferior *inf_for_target_calls, gdbarch *gdbarch); private: @@ -445,10 +434,6 @@ 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; - /* The inferior to switch to, to make target calls. This may not be the inferior of thread M_PTID. For instance, this @@ -462,10 +447,8 @@ class regcache : public detached_regcache it connected to? */ ptid_t m_ptid; - friend struct regcache * - get_thread_arch_aspace_regcache (inferior *inf_for_target_calls, ptid_t ptid, - struct gdbarch *gdbarch, - struct address_space *aspace); + friend regcache *get_thread_arch_regcache (inferior *inf_for_target_calls, + ptid_t ptid, gdbarch *gdbarch); }; using regcache_up = std::unique_ptr; diff --git a/gdb/remote.c b/gdb/remote.c index 69271048da24..4c406d6aec56 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8308,11 +8308,14 @@ remote_target::process_stop_reply (struct stop_reply *stop_reply, && status->kind () != TARGET_WAITKIND_SIGNALLED && status->kind () != TARGET_WAITKIND_NO_RESUMED) { + remote_notice_new_inferior (ptid, false); + /* Expedited registers. */ if (!stop_reply->regcache.empty ()) { - struct regcache *regcache - = get_thread_arch_regcache (this, ptid, stop_reply->arch); + regcache *regcache + = get_thread_arch_regcache (find_inferior_ptid (this, ptid), ptid, + stop_reply->arch); for (cached_reg_t ® : stop_reply->regcache) { @@ -8323,7 +8326,6 @@ remote_target::process_stop_reply (struct stop_reply *stop_reply, stop_reply->regcache.clear (); } - remote_notice_new_inferior (ptid, false); remote_thread_info *remote_thr = get_remote_thread_info (this, ptid); remote_thr->core = stop_reply->core; remote_thr->stop_reason = stop_reply->stop_reason; diff --git a/gdb/riscv-fbsd-tdep.c b/gdb/riscv-fbsd-tdep.c index 8ae4a1953bcc..9050cf425ec1 100644 --- a/gdb/riscv-fbsd-tdep.c +++ b/gdb/riscv-fbsd-tdep.c @@ -166,10 +166,8 @@ static CORE_ADDR riscv_fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset) { - struct regcache *regcache; - - regcache = get_thread_arch_regcache (current_inferior ()->process_target (), - ptid, gdbarch); + regcache *regcache + = get_thread_arch_regcache (current_inferior (), ptid, gdbarch); target_fetch_registers (regcache, RISCV_TP_REGNUM); diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 537acdb57548..61331f9d40fc 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -845,9 +845,8 @@ ps_err_e ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset) { ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0); - struct regcache *regcache - = get_thread_arch_regcache (current_inferior ()->process_target (), - ptid, current_inferior ()->arch ()); + regcache *regcache = get_thread_arch_regcache (current_inferior (), ptid, + current_inferior ()->arch ()); target_fetch_registers (regcache, -1); fill_gregset (regcache, (gdb_gregset_t *) gregset, -1); @@ -862,9 +861,8 @@ ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid, const prgregset_t gregset) { ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0); - struct regcache *regcache - = get_thread_arch_regcache (current_inferior ()->process_target (), - ptid, current_inferior ()->arch ()); + regcache *regcache = get_thread_arch_regcache (current_inferior (), ptid, + current_inferior ()->arch ()); supply_gregset (regcache, (const gdb_gregset_t *) gregset); target_store_registers (regcache, -1); @@ -915,9 +913,8 @@ ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid, prfpregset_t *fpregset) { ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0); - struct regcache *regcache - = get_thread_arch_regcache (current_inferior ()->process_target (), - ptid, current_inferior ()->arch ()); + regcache *regcache = get_thread_arch_regcache (current_inferior (), ptid, + current_inferior ()->arch ()); target_fetch_registers (regcache, -1); fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1); @@ -932,9 +929,8 @@ ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid, const prfpregset_t * fpregset) { ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0); - struct regcache *regcache - = get_thread_arch_regcache (current_inferior ()->process_target (), - ptid, current_inferior ()->arch ()); + regcache *regcache = get_thread_arch_regcache (current_inferior (), ptid, + current_inferior ()->arch ()); supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset); target_store_registers (regcache, -1); diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index e21190a30f15..b02e8094ac6b 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -2399,9 +2399,8 @@ enable_break (struct svr4_info *info, int from_tty) most cases. */ if (!load_addr_found) { - struct regcache *regcache - = get_thread_arch_regcache (current_inferior ()->process_target (), - inferior_ptid, + regcache *regcache + = get_thread_arch_regcache (current_inferior (), inferior_ptid, current_inferior ()->arch ()); load_addr = (regcache_read_pc (regcache) diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 580fc768dd1c..f06249d49680 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; @@ -307,7 +306,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; @@ -2962,32 +2960,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) -{ - gdb_printf (gdb_stdlog, "-> %s->thread_address_space (...)\n", this->beneath ()->shortname ()); - struct address_space * 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_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 f688ff33e3b0..cd648fd2e9ed 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2992,19 +2992,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 68b269fb3e61..94510b0ba22a 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -938,10 +938,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 -- 2.42.0