gdb: add inferior::{arch, set_arch}

Make the inferior's gdbarch field private, and add getters and setters.
This helped me by allowing putting breakpoints on set_arch to know when
the inferior's arch was set.  A subsequent patch in this series also
adds more things in set_arch.

Change-Id: I0005bd1ef4cd6b612af501201cec44e457998eec
Reviewed-By: John Baldwin <jhb@FreeBSD.org>
Approved-By: Andrew Burgess <aburgess@redhat.com>
This commit is contained in:
Simon Marchi
2023-09-29 14:24:35 -04:00
parent ae0d827fa4
commit 27b1f19f8f
25 changed files with 63 additions and 55 deletions

View File

@@ -2615,7 +2615,7 @@ linux_displaced_step_prepare (gdbarch *arch, thread_info *thread,
/* Figure out the location of the buffers. They are contiguous, starting
at DISP_STEP_BUF_ADDR. They are all of size BUF_LEN. */
CORE_ADDR disp_step_buf_addr
= linux_displaced_step_location (thread->inf->gdbarch);
= linux_displaced_step_location (thread->inf->arch ());
int buf_len = gdbarch_displaced_step_buffer_length (arch);
linux_gdbarch_data *gdbarch_data = get_linux_gdbarch_data (arch);
@@ -2701,7 +2701,7 @@ linux_get_hwcap ()
{
return linux_get_hwcap (target_read_auxv (),
current_inferior ()->top_target (),
current_inferior ()->gdbarch);
current_inferior ()->arch ());
}
/* See linux-tdep.h. */
@@ -2720,7 +2720,7 @@ linux_get_hwcap2 ()
{
return linux_get_hwcap2 (target_read_auxv (),
current_inferior ()->top_target (),
current_inferior ()->gdbarch);
current_inferior ()->arch ());
}
/* Display whether the gcore command is using the