From 99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 29 Sep 2023 14:24:38 -0400 Subject: 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 Approved-By: Andrew Burgess --- gdb/arc-tdep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gdb/arc-tdep.c') diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c index 0b541c6..0740eff 100644 --- a/gdb/arc-tdep.c +++ b/gdb/arc-tdep.c @@ -27,6 +27,7 @@ #include "frame-base.h" #include "frame-unwind.h" #include "gdbcore.h" +#include "inferior.h" #include "reggroups.h" #include "gdbcmd.h" #include "objfiles.h" @@ -490,7 +491,7 @@ arc_insn_get_branch_target (const struct arc_instruction &insn) static void arc_insn_dump (const struct arc_instruction &insn) { - struct gdbarch *gdbarch = target_gdbarch (); + struct gdbarch *gdbarch = current_inferior ()->arch (); arc_print ("Dumping arc_instruction at %s\n", paddress (gdbarch, insn.address)); @@ -2441,7 +2442,7 @@ dump_arc_instruction_command (const char *args, int from_tty) CORE_ADDR address = value_as_address (val); struct arc_instruction insn; - struct gdb_non_printing_memory_disassembler dis (target_gdbarch ()); + gdb_non_printing_memory_disassembler dis (current_inferior ()->arch ()); arc_insn_decode (address, dis.disasm_info (), arc_delayed_print_insn, &insn); arc_insn_dump (insn); } -- cgit v1.1