aboutsummaryrefslogtreecommitdiff
path: root/gdb/mips-tdep.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-09-29 14:24:38 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-10-10 10:44:35 -0400
commit99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee (patch)
tree7f642c989f7c7b49bd40ab5873fc12be632e6ea9 /gdb/mips-tdep.c
parent72c4529c85907a5e1e04960ff1362a5a185553a0 (diff)
downloadfsf-binutils-gdb-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.zip
fsf-binutils-gdb-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.tar.gz
fsf-binutils-gdb-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.tar.bz2
gdb: remove target_gdbarch
This function is just a wrapper around the current inferior's gdbarch. I find that having that wrapper just obscures where the arch is coming from, and that it's often used as "I don't know which arch to use so I'll use this magical target_gdbarch function that gets me an arch" when the arch should in fact come from something in the context (a thread, objfile, symbol, etc). I think that removing it and inlining `current_inferior ()->arch ()` everywhere will make it a bit clearer where that arch comes from and will trigger people into reflecting whether this is the right place to get the arch or not. Change-Id: I79f14b4e4934c88f91ca3a3155f5fc3ea2fadf6b Reviewed-By: John Baldwin <jhb@FreeBSD.org> Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/mips-tdep.c')
-rw-r--r--gdb/mips-tdep.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 4044daa..d40d28e 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1183,12 +1183,13 @@ show_mask_address (struct ui_file *file, int from_tty,
const char *additional_text = "";
if (mask_address_var == AUTO_BOOLEAN_AUTO)
{
- if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_mips)
+ if (gdbarch_bfd_arch_info (current_inferior ()->arch ())->arch
+ != bfd_arch_mips)
additional_text = _(" (current architecture is not MIPS)");
else
{
mips_gdbarch_tdep *tdep
- = gdbarch_tdep<mips_gdbarch_tdep> (target_gdbarch ());
+ = gdbarch_tdep<mips_gdbarch_tdep> (current_inferior ()->arch ());
if (mips_mask_address_p (tdep))
additional_text = _(" (currently \"on\")");
@@ -6926,7 +6927,8 @@ show_mipsfpu_command (const char *args, int from_tty)
{
const char *fpu;
- if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_mips)
+ if (gdbarch_bfd_arch_info (current_inferior ()->arch ())->arch
+ != bfd_arch_mips)
{
gdb_printf
("The MIPS floating-point coprocessor is unknown "
@@ -6934,7 +6936,7 @@ show_mipsfpu_command (const char *args, int from_tty)
return;
}
- switch (mips_get_fpu_type (target_gdbarch ()))
+ switch (mips_get_fpu_type (current_inferior ()->arch ()))
{
case MIPS_FPU_SINGLE:
fpu = "single-precision";
@@ -8850,7 +8852,8 @@ show_mips_abi (struct ui_file *file,
struct cmd_list_element *ignored_cmd,
const char *ignored_value)
{
- if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_mips)
+ if (gdbarch_bfd_arch_info (current_inferior ()->arch ())->arch
+ != bfd_arch_mips)
gdb_printf
(file,
"The MIPS ABI is unknown because the current architecture "
@@ -8858,7 +8861,7 @@ show_mips_abi (struct ui_file *file,
else
{
enum mips_abi global_abi = global_mips_abi ();
- enum mips_abi actual_abi = mips_abi (target_gdbarch ());
+ enum mips_abi actual_abi = mips_abi (current_inferior ()->arch ());
const char *actual_abi_str = mips_abi_strings[actual_abi];
if (global_abi == MIPS_ABI_UNKNOWN)