aboutsummaryrefslogtreecommitdiff
path: root/gdb/rx-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/rx-tdep.c
parent72c4529c85907a5e1e04960ff1362a5a185553a0 (diff)
downloadgdb-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.zip
gdb-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.tar.gz
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/rx-tdep.c')
-rw-r--r--gdb/rx-tdep.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 7bd469d..87f1afd 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -36,6 +36,7 @@
#include "remote.h"
#include "target-descriptions.h"
#include "gdbarch.h"
+#include "inferior.h"
#include "elf/rx.h"
#include "elf-bfd.h"
@@ -142,7 +143,7 @@ check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
if (value.kind == pvk_register
&& value.k == 0
&& pv_is_register (addr, RX_SP_REGNUM)
- && size == register_size (target_gdbarch (), value.reg))
+ && size == register_size (current_inferior ()->arch (), value.reg))
result->reg_offset[value.reg] = addr.k;
}
@@ -198,7 +199,7 @@ rx_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
result->reg_offset[rn] = 1;
}
- pv_area stack (RX_SP_REGNUM, gdbarch_addr_bit (target_gdbarch ()));
+ pv_area stack (RX_SP_REGNUM, gdbarch_addr_bit (current_inferior ()->arch ()));
if (frame_type == RX_FRAME_TYPE_FAST_INTERRUPT)
{