]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove target_gdbarch
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 29 Sep 2023 18:24:38 +0000 (14:24 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 10 Oct 2023 14:44:35 +0000 (10:44 -0400)
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>
93 files changed:
gdb/aarch64-linux-nat.c
gdb/ada-lang.c
gdb/ada-tasks.c
gdb/aix-thread.c
gdb/arc-tdep.c
gdb/arch-utils.c
gdb/arm-tdep.c
gdb/auxv.c
gdb/break-catch-syscall.c
gdb/breakpoint.c
gdb/bsd-uthread.c
gdb/btrace.c
gdb/cli/cli-dump.c
gdb/compile/compile-c-symbols.c
gdb/compile/compile-cplus-symbols.c
gdb/compile/compile-object-load.c
gdb/corefile.c
gdb/corelow.c
gdb/cp-namespace.c
gdb/cp-support.c
gdb/d-namespace.c
gdb/darwin-nat-info.c
gdb/dcache.c
gdb/disasm.c
gdb/elfread.c
gdb/fbsd-nat.c
gdb/filesystem.c
gdb/frame-unwind.c
gdb/gcore.c
gdb/gdbarch.h
gdb/gnu-nat.c
gdb/i386-darwin-nat.c
gdb/i386-tdep.c
gdb/ia64-vms-tdep.c
gdb/infcmd.c
gdb/infrun.c
gdb/jit.c
gdb/linux-nat.c
gdb/memattr.c
gdb/mep-tdep.c
gdb/mi/mi-interp.c
gdb/mi/mi-main.c
gdb/microblaze-tdep.c
gdb/mips-linux-nat.c
gdb/mips-linux-tdep.c
gdb/mips-tdep.c
gdb/moxie-tdep.c
gdb/msp430-tdep.c
gdb/netbsd-nat.c
gdb/nto-procfs.c
gdb/nto-tdep.c
gdb/ppc-linux-nat.c
gdb/printcmd.c
gdb/process-stratum-target.h
gdb/procfs.c
gdb/progspace.c
gdb/python/py-finishbreakpoint.c
gdb/python/py-inferior.c
gdb/python/py-objfile.c
gdb/python/py-progspace.c
gdb/python/py-record-btrace.c
gdb/python/python.c
gdb/ravenscar-thread.c
gdb/record-btrace.c
gdb/record-full.c
gdb/regcache-dump.c
gdb/remote-sim.c
gdb/remote.c
gdb/rl78-tdep.c
gdb/rs6000-aix-nat.c
gdb/rust-parse.c
gdb/rx-tdep.c
gdb/s390-linux-nat.c
gdb/sol-thread.c
gdb/solib-darwin.c
gdb/solib-dsbt.c
gdb/solib-frv.c
gdb/solib-svr4.c
gdb/solib.c
gdb/sparc64-tdep.c
gdb/symfile-mem.c
gdb/symfile.c
gdb/symtab.c
gdb/target-descriptions.c
gdb/target.c
gdb/target.h
gdb/tracefile-tfile.c
gdb/tracefile.c
gdb/tracepoint.c
gdb/value.c
gdb/windows-nat.c
gdb/windows-tdep.c
gdb/z80-tdep.c

index eb54db4bff4809acf3328b676fd15a28d3247fcd..0e87aaa9b7add4dee5aea44d149c7154a869b07f 100644 (file)
@@ -836,8 +836,8 @@ ps_err_e
 ps_get_thread_area (struct ps_prochandle *ph,
                    lwpid_t lwpid, int idx, void **base)
 {
-  int is_64bit_p
-    = (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 64);
+  gdbarch *arch = current_inferior ()->arch ();
+  int is_64bit_p = (gdbarch_bfd_arch_info (arch)->bits_per_word == 64);
 
   return aarch64_ps_get_thread_area (ph, lwpid, idx, base, is_64bit_p);
 }
index a37e56375341e4888cbf67934602ce8a020da793..9bb649e901d87c1be348e39a0e3cdf9214841560 100644 (file)
@@ -4914,7 +4914,7 @@ ada_lookup_simple_minsym (const char *name, struct objfile *objfile)
     = ada_get_symbol_name_matcher (lookup_name);
 
   gdbarch_iterate_over_objfiles_in_search_order
-    (objfile != NULL ? objfile->arch () : target_gdbarch (),
+    (objfile != NULL ? objfile->arch () : current_inferior ()->arch (),
      [&result, lookup_name, match_name] (struct objfile *obj)
        {
         for (minimal_symbol *msymbol : obj->msymbols ())
@@ -6448,7 +6448,8 @@ ada_tag_value_at_base_address (struct value *obj)
 
   struct type *offset_type
     = language_lookup_primitive_type (language_def (language_ada),
-                                     target_gdbarch(), "storage_offset");
+                                     current_inferior ()->arch (),
+                                     "storage_offset");
   ptr_type = lookup_pointer_type (offset_type);
   val = value_cast (ptr_type, tag);
   if (!val)
@@ -13766,7 +13767,7 @@ public:
        struct gdbarch *gdbarch;
 
        if (block == NULL)
-         gdbarch = target_gdbarch ();
+         gdbarch = current_inferior ()->arch ();
        else
          gdbarch = block->gdbarch ();
        sym.symbol
index 1de6b0fc930b43d6f2874193ef79f4cfa9168e69..047566e6228e8318c22ceaa47a31a07ce7bd0abb 100644 (file)
@@ -604,8 +604,9 @@ ada_get_tcb_types_info (void)
   if (first_id_sym.minsym != nullptr)
     {
       CORE_ADDR addr = first_id_sym.value_address ();
+      gdbarch *arch = current_inferior ()->arch ();
       /* This symbol always has type uint32_t.  */
-      struct type *u32type = builtin_type (target_gdbarch ())->builtin_uint32;
+      struct type *u32type = builtin_type (arch)->builtin_uint32;
       first_id = value_as_long (value_at (u32type, addr));
     }
 
@@ -959,7 +960,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
         contains debug information on the task type (due to implicit with of
         Ada.Tasking).  */
       data->known_tasks_element =
-       builtin_type (target_gdbarch ())->builtin_data_ptr;
+       builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
       data->known_tasks_length = MAX_NUMBER_OF_KNOWN_TASKS;
       return;
     }
@@ -990,7 +991,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
 
       /* Fallback to default values.  */
       data->known_tasks_element =
-       builtin_type (target_gdbarch ())->builtin_data_ptr;
+       builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
       data->known_tasks_length = 1;
       return;
     }
@@ -1253,7 +1254,7 @@ info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf)
 
   /* Print the Ada task ID.  */
   gdb_printf (_("Ada Task: %s\n"),
-             paddress (target_gdbarch (), task_info->task_id));
+             paddress (current_inferior ()->arch (), task_info->task_id));
 
   /* Print the name of the task.  */
   if (task_info->name[0] != '\0')
index 2077491d3cf79ce000eb7a6ced8d9db105fe324a..945b7f6c6974db2f005db2e84c0dd2309c09247c 100644 (file)
@@ -1054,7 +1054,7 @@ pd_enable (inferior *inf)
     return;
 
   /* Check application word size.  */
-  data->arch64 = register_size (target_gdbarch (), 0) == 8;
+  data->arch64 = register_size (current_inferior ()->arch (), 0) == 8;
 
   /* Check whether the application is pthreaded.  */
   stub_name = NULL;
@@ -1069,7 +1069,8 @@ pd_enable (inferior *inf)
   if (ms.minsym == NULL)
     return;
   data->pd_brk_addr = ms.value_address ();
-  if (!create_thread_event_breakpoint (target_gdbarch (), data->pd_brk_addr))
+  if (!create_thread_event_breakpoint (current_inferior ()->arch (),
+                                      data->pd_brk_addr))
     return;
 
   /* Prepare for thread debugging.  */
index 0b541c6335aef7a98219ae28b6d2926742a9c680..0740eff02e456661a09c17813693e6c39951fada 100644 (file)
@@ -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);
 }
index 5768259d94fcea94149e2f4d7a8f24cd70a3664d..60a50ea5b2c7335fadea3b63d4e184a450a5585d 100644 (file)
@@ -609,7 +609,7 @@ gdbarch_update_p (struct gdbarch_info info)
 
   /* If it is the same old architecture, accept the request (but don't
      swap anything).  */
-  if (new_gdbarch == target_gdbarch ())
+  if (new_gdbarch == current_inferior ()->arch ())
     {
       if (gdbarch_debug)
        gdb_printf (gdb_stdlog, "gdbarch_update_p: "
@@ -850,7 +850,7 @@ get_current_arch (void)
   if (has_stack_frames ())
     return get_frame_arch (get_selected_frame (NULL));
   else
-    return target_gdbarch ();
+    return current_inferior ()->arch ();
 }
 
 int
@@ -1490,14 +1490,6 @@ gdbarch_initialized_p (gdbarch *arch)
   return arch->initialized_p;
 }
 
-/* Return the current inferior's arch.  */
-
-struct gdbarch *
-target_gdbarch (void)
-{
-  return current_inferior ()->arch ();
-}
-
 void _initialize_gdbarch_utils ();
 void
 _initialize_gdbarch_utils ()
index 7e069d187708defe2c3a9ab1db8e3ee2c81e4102..a0ad1fb7a82146fd3f3a3bd13cf2bd04b25aa693 100644 (file)
@@ -9483,7 +9483,8 @@ static void
 arm_update_current_architecture (void)
 {
   /* If the current architecture is not ARM, we have nothing to do.  */
-  if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_arm)
+  gdbarch *arch = current_inferior ()->arch ();
+  if (gdbarch_bfd_arch_info (arch)->arch != bfd_arch_arm)
     return;
 
   /* Update the architecture.  */
@@ -9516,11 +9517,11 @@ static void
 show_fp_model (struct ui_file *file, int from_tty,
               struct cmd_list_element *c, const char *value)
 {
+  gdbarch *arch = current_inferior ()->arch ();
   if (arm_fp_model == ARM_FLOAT_AUTO
-      && gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_arm)
+      && gdbarch_bfd_arch_info (arch)->arch == bfd_arch_arm)
     {
-      arm_gdbarch_tdep *tdep
-       = gdbarch_tdep<arm_gdbarch_tdep> (target_gdbarch ());
+      arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (arch);
 
       gdb_printf (file, _("\
 The current ARM floating point model is \"auto\" (currently \"%s\").\n"),
@@ -9556,11 +9557,11 @@ static void
 arm_show_abi (struct ui_file *file, int from_tty,
             struct cmd_list_element *c, const char *value)
 {
+  gdbarch *arch = current_inferior ()->arch ();
   if (arm_abi_global == ARM_ABI_AUTO
-      && gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_arm)
+      && gdbarch_bfd_arch_info (arch)->arch == bfd_arch_arm)
     {
-      arm_gdbarch_tdep *tdep
-       = gdbarch_tdep<arm_gdbarch_tdep> (target_gdbarch ());
+      arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (arch);
 
       gdb_printf (file, _("\
 The current ARM ABI is \"auto\" (currently \"%s\").\n"),
index 45f3e920d80dc047d7f635f06fe3dde0da032642..61acd48fc98540378f0a5e3cec25068d54df1c81 100644 (file)
@@ -83,7 +83,8 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
 {
   struct bound_minimal_symbol msym;
   CORE_ADDR data_address, pointer_address;
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  gdbarch *arch = current_inferior ()->arch ();
+  type *ptr_type = builtin_type (arch)->builtin_data_ptr;
   size_t ptr_size = ptr_type->length ();
   size_t auxv_pair_size = 2 * ptr_size;
   gdb_byte *ptr_buf = (gdb_byte *) alloca (ptr_size);
@@ -284,7 +285,7 @@ int
 default_auxv_parse (struct target_ops *ops, const gdb_byte **readptr,
                    const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
 {
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
   struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
   const int sizeof_auxv_type = ptr_type->length ();
 
@@ -428,6 +429,7 @@ fprint_auxv_entry (struct ui_file *file, const char *name,
                   const char *description, enum auxv_format format,
                   CORE_ADDR type, CORE_ADDR val)
 {
+  gdbarch *arch = current_inferior ()->arch ();
   gdb_printf (file, ("%-4s %-20s %-30s "),
              plongest (type), name, description);
   switch (format)
@@ -436,7 +438,7 @@ fprint_auxv_entry (struct ui_file *file, const char *name,
       gdb_printf (file, ("%s\n"), plongest (val));
       break;
     case AUXV_FORMAT_HEX:
-      gdb_printf (file, ("%s\n"), paddress (target_gdbarch (), val));
+      gdb_printf (file, ("%s\n"), paddress (arch, val));
       break;
     case AUXV_FORMAT_STR:
       {
@@ -444,8 +446,8 @@ fprint_auxv_entry (struct ui_file *file, const char *name,
 
        get_user_print_options (&opts);
        if (opts.addressprint)
-         gdb_printf (file, ("%s "), paddress (target_gdbarch (), val));
-       val_print_string (builtin_type (target_gdbarch ())->builtin_char,
+         gdb_printf (file, ("%s "), paddress (arch, val));
+       val_print_string (builtin_type (arch)->builtin_char,
                          NULL, val, -1, file, &opts);
        gdb_printf (file, ("\n"));
       }
@@ -567,7 +569,7 @@ default_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
 static int
 fprint_target_auxv (struct ui_file *file)
 {
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
   CORE_ADDR type, val;
   int ents = 0;
   const gdb::optional<gdb::byte_vector> &auxv = target_read_auxv ();
@@ -579,9 +581,8 @@ fprint_target_auxv (struct ui_file *file)
   const gdb_byte *ptr = data;
   size_t len = auxv->size ();
 
-  while (parse_auxv (current_inferior ()->top_target (),
-                    current_inferior ()->arch (),
-                    &ptr, data + len, &type, &val) > 0)
+  while (parse_auxv (current_inferior ()->top_target (), gdbarch, &ptr,
+                    data + len, &type, &val) > 0)
     {
       gdbarch_print_auxv_entry (gdbarch, file, type, val);
       ++ents;
index 9bdfcf73efa31956af45ea765e9c0a1989b97729..a00ecebebbd802fae36eaa3ee8bd6d8dbdb5226d 100644 (file)
@@ -359,7 +359,7 @@ static std::vector<int>
 catch_syscall_split_args (const char *arg)
 {
   std::vector<int> result;
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
 
   while (*arg != '\0')
     {
index db7d2e6a8e53a723b52ae93456bfd7cde76ad4f3..2edcbf6d4904644732f891fa61d213c45b01e0ce 100644 (file)
@@ -597,7 +597,7 @@ show_debug_breakpoint (struct ui_file *file, int from_tty,
 int
 breakpoints_should_be_inserted_now (void)
 {
-  if (gdbarch_has_global_breakpoints (target_gdbarch ()))
+  if (gdbarch_has_global_breakpoints (current_inferior ()->arch ()))
     {
       /* If breakpoints are global, they should be inserted even if no
         thread under gdb's control is running, or even if there are
@@ -3224,7 +3224,7 @@ update_inserted_breakpoint_locations (void)
         to select an inferior to insert breakpoint to.  In fact, even
         if we aren't attached to any process yet, we should still
         insert breakpoints.  */
-      if (!gdbarch_has_global_breakpoints (target_gdbarch ())
+      if (!gdbarch_has_global_breakpoints (current_inferior ()->arch ())
          && (inferior_ptid == null_ptid || !target_has_execution ()))
        continue;
 
@@ -3284,7 +3284,7 @@ insert_breakpoint_locations (void)
         to select an inferior to insert breakpoint to.  In fact, even
         if we aren't attached to any process yet, we should still
         insert breakpoints.  */
-      if (!gdbarch_has_global_breakpoints (target_gdbarch ())
+      if (!gdbarch_has_global_breakpoints (current_inferior ()->arch ())
          && (inferior_ptid == null_ptid || !target_has_execution ()))
        continue;
 
@@ -4243,7 +4243,7 @@ breakpoint_init_inferior (enum inf_context context)
 
   /* If breakpoint locations are shared across processes, then there's
      nothing to do.  */
-  if (gdbarch_has_global_breakpoints (target_gdbarch ()))
+  if (gdbarch_has_global_breakpoints (current_inferior ()->arch ()))
     return;
 
   mark_breakpoints_out ();
@@ -6615,7 +6615,7 @@ print_one_breakpoint_location (struct breakpoint *b,
       /* For backward compatibility, don't display inferiors in CLI unless
         there are several.  Always display for MI. */
       if (allflag
-         || (!gdbarch_has_global_breakpoints (target_gdbarch ())
+         || (!gdbarch_has_global_breakpoints (current_inferior ()->arch ())
              && (program_spaces.size () > 1
                  || number_of_inferiors () > 1)
              /* LOC is for existing B, it cannot be in
@@ -7299,7 +7299,7 @@ int
 breakpoint_address_match (const address_space *aspace1, CORE_ADDR addr1,
                          const address_space *aspace2, CORE_ADDR addr2)
 {
-  return ((gdbarch_has_global_breakpoints (target_gdbarch ())
+  return ((gdbarch_has_global_breakpoints (current_inferior ()->arch ())
           || aspace1 == aspace2)
          && addr1 == addr2);
 }
@@ -7315,7 +7315,7 @@ breakpoint_address_match_range (const address_space *aspace1,
                                int len1, const address_space *aspace2,
                                CORE_ADDR addr2)
 {
-  return ((gdbarch_has_global_breakpoints (target_gdbarch ())
+  return ((gdbarch_has_global_breakpoints (current_inferior ()->arch ())
           || aspace1 == aspace2)
          && addr2 >= addr1 && addr2 < addr1 + len1);
 }
@@ -7349,7 +7349,7 @@ breakpoint_location_address_range_overlap (struct bp_location *bl,
                                           const address_space *aspace,
                                           CORE_ADDR addr, int len)
 {
-  if (gdbarch_has_global_breakpoints (target_gdbarch ())
+  if (gdbarch_has_global_breakpoints (current_inferior ()->arch ())
       || bl->pspace->aspace == aspace)
     {
       int bl_len = bl->length != 0 ? bl->length : 1;
index e27e88add869fd53828f9d28b98819434a2f87ae..8765fb77283d4454d1b446903b7dc771e13ffe46 100644 (file)
@@ -125,7 +125,7 @@ bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch,
 static void
 bsd_uthread_check_magic (CORE_ADDR addr)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   ULONGEST magic = read_memory_unsigned_integer (addr, 4, byte_order);
 
   if (magic != BSD_UTHREAD_PTHREAD_MAGIC)
@@ -169,7 +169,7 @@ bsd_uthread_lookup_address (const char *name, struct objfile *objfile)
 static int
 bsd_uthread_lookup_offset (const char *name, struct objfile *objfile)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   CORE_ADDR addr;
 
   addr = bsd_uthread_lookup_address (name, objfile);
@@ -182,7 +182,8 @@ bsd_uthread_lookup_offset (const char *name, struct objfile *objfile)
 static CORE_ADDR
 bsd_uthread_read_memory_address (CORE_ADDR addr)
 {
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
   return read_memory_typed_address (addr, ptr_type);
 }
 
@@ -193,7 +194,7 @@ bsd_uthread_read_memory_address (CORE_ADDR addr)
 static int
 bsd_uthread_activate (struct objfile *objfile)
 {
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
   struct bsd_uthread_ops *ops = get_bsd_uthread (gdbarch);
 
   /* Skip if the thread stratum has already been activated.  */
@@ -374,7 +375,7 @@ ptid_t
 bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status,
                          target_wait_flags options)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   CORE_ADDR addr;
   process_stratum_target *beneath
     = as_process_stratum_target (this->beneath ());
@@ -432,7 +433,7 @@ bsd_uthread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
 bool
 bsd_uthread_target::thread_alive (ptid_t ptid)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   CORE_ADDR addr = ptid.tid ();
 
   if (addr != 0)
@@ -513,7 +514,7 @@ static const char * const bsd_uthread_state[] =
 const char *
 bsd_uthread_target::extra_thread_info (thread_info *info)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   CORE_ADDR addr = info->ptid.tid ();
 
   if (addr != 0)
index a7b6e810cdcb4da3e90be6b8e08e6919c19792a8..3f72b9c91e51f4c9e7a6e9d0dbb346ff38692e3a 100644 (file)
@@ -1058,11 +1058,10 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
   switch_to_thread (tp);
 
   struct btrace_thread_info *btinfo;
-  struct gdbarch *gdbarch;
   unsigned int blk;
   int level;
 
-  gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
   btinfo = &tp->btrace;
   blk = btrace->blocks->size ();
 
index 08984f6fdf3005e7382065bde1a5c08dbe8b0042..28512bd3172beec1046bfe736e9dd27440943600 100644 (file)
@@ -33,6 +33,7 @@
 #include "gdbsupport/filestuff.h"
 #include "gdbsupport/byte-vector.h"
 #include "gdbarch.h"
+#include "inferior.h"
 
 static gdb::unique_xmalloc_ptr<char>
 scan_expression (const char **cmd, const char *def)
@@ -426,10 +427,10 @@ restore_one_section (bfd *ibfd, asection *isec,
 
   if (load_offset != 0 || load_start != 0 || load_end != 0)
     gdb_printf (" into memory (%s to %s)\n",
-               paddress (target_gdbarch (),
+               paddress (current_inferior ()->arch (),
                          (unsigned long) sec_start
                          + sec_offset + load_offset),
-               paddress (target_gdbarch (),
+               paddress (current_inferior ()->arch (),
                          (unsigned long) sec_start + sec_offset
                          + load_offset + sec_load_count));
   else
index 617297c3263fcd5386376d04ada2c2fe7729d4b8..5982178170c46156d58bc1f007485eeff91528cf 100644 (file)
@@ -30,8 +30,8 @@
 #include "exceptions.h"
 #include "gdbtypes.h"
 #include "dwarf2/loc.h"
+#include "inferior.h"
 
-\f
 
 /* Compute the name of the pointer representing a local symbol's
    address.  */
@@ -95,7 +95,7 @@ convert_one_symbol (compile_c_instance *context,
          kind = GCC_C_SYMBOL_FUNCTION;
          addr = sym.symbol->value_block ()->entry_pc ();
          if (is_global && sym.symbol->type ()->is_gnu_ifunc ())
-           addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
+           addr = gnu_ifunc_resolve_addr (current_inferior ()->arch (), addr);
          break;
 
        case LOC_CONST:
@@ -286,7 +286,7 @@ convert_symbol_bmsym (compile_c_instance *context,
     case mst_text_gnu_ifunc:
       type = builtin_type (objfile)->nodebug_text_gnu_ifunc_symbol;
       kind = GCC_C_SYMBOL_FUNCTION;
-      addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
+      addr = gnu_ifunc_resolve_addr (current_inferior ()->arch (), addr);
       break;
 
     case mst_data:
@@ -407,7 +407,8 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
                        identifier);
          result = sym->value_block ()->entry_pc ();
          if (sym->type ()->is_gnu_ifunc ())
-           result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
+           result = gnu_ifunc_resolve_addr (current_inferior ()->arch (),
+                                            result);
          found = 1;
        }
       else
@@ -424,7 +425,8 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
                            identifier);
              result = msym.value_address ();
              if (msym.minsym->type () == mst_text_gnu_ifunc)
-               result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
+               result = gnu_ifunc_resolve_addr (current_inferior ()->arch (),
+                                                result);
              found = 1;
            }
        }
index ab18e631247bc207c013ce0dfeb8864ebdef8eed..1edbf8f64b5fb6733a29b31b28245ef950aec991 100644 (file)
@@ -34,6 +34,7 @@
 #include "cp-support.h"
 #include "gdbcmd.h"
 #include "compile-c.h"
+#include "inferior.h"
 
 /* Convert a given symbol, SYM, to the compiler's representation.
    INSTANCE is the compiler instance.  IS_GLOBAL is true if the
@@ -89,7 +90,8 @@ convert_one_symbol (compile_cplus_instance *instance,
            kind = GCC_CP_SYMBOL_FUNCTION;
            addr = sym.symbol->value_block()->start ();
            if (is_global && sym.symbol->type ()->is_gnu_ifunc ())
-             addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
+             addr = gnu_ifunc_resolve_addr (current_inferior ()->arch (),
+                                            addr);
          }
          break;
 
@@ -300,7 +302,7 @@ convert_symbol_bmsym (compile_cplus_instance *instance,
         function return type cannot be function  */
       type = builtin_type (objfile)->nodebug_text_symbol;
       kind = GCC_CP_SYMBOL_FUNCTION;
-      addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
+      addr = gnu_ifunc_resolve_addr (current_inferior ()->arch (), addr);
       break;
 
     case mst_data:
@@ -445,7 +447,8 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
                        identifier);
          result = sym->value_block ()->start ();
          if (sym->type ()->is_gnu_ifunc ())
-           result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
+           result = gnu_ifunc_resolve_addr (current_inferior ()->arch (),
+                                            result);
          found = 1;
        }
       else
@@ -462,7 +465,8 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
                            identifier);
              result = msym.value_address ();
              if (msym.minsym->type () == mst_text_gnu_ifunc)
-               result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
+               result = gnu_ifunc_resolve_addr (current_inferior ()->arch (),
+                                                result);
              found = 1;
            }
        }
index 013b6a9a4275d4156e63b3e0b96202f716a48b0f..d1727c30657bb7d3d77fb00bf02426047d201854 100644 (file)
@@ -52,7 +52,8 @@ munmap_list::~munmap_list ()
     {
       try
        {
-         gdbarch_infcall_munmap (target_gdbarch (), item.addr, item.size);
+         gdbarch_infcall_munmap (current_inferior ()->arch (),
+                                 item.addr, item.size);
        }
       catch (const gdb_exception_error &ex)
        {
@@ -130,7 +131,7 @@ setup_sections_data::setup_one_section (asection *sect)
                    "module \"%s\" section \"%s\" size %s prot %u\n",
                    bfd_get_filename (m_bfd),
                    bfd_section_name (sect),
-                   paddress (target_gdbarch (),
+                   paddress (current_inferior ()->arch (),
                              bfd_section_size (sect)),
                    prot);
     }
@@ -145,14 +146,14 @@ setup_sections_data::setup_one_section (asection *sect)
 
       if (m_last_size != 0)
        {
-         addr = gdbarch_infcall_mmap (target_gdbarch (), m_last_size,
-                                      m_last_prot);
+         addr = gdbarch_infcall_mmap (current_inferior ()->arch (),
+                                      m_last_size, m_last_prot);
          munmap_list.add (addr, m_last_size);
          if (compile_debug)
            gdb_printf (gdb_stdlog,
                        "allocated %s bytes at %s prot %u\n",
-                       paddress (target_gdbarch (), m_last_size),
-                       paddress (target_gdbarch (), addr),
+                       paddress (current_inferior ()->arch (), m_last_size),
+                       paddress (current_inferior ()->arch (), addr),
                        m_last_prot);
        }
       else
@@ -161,8 +162,8 @@ setup_sections_data::setup_one_section (asection *sect)
       if ((addr & (m_last_max_alignment - 1)) != 0)
        error (_("Inferior compiled module address %s "
                 "is not aligned to BFD required %s."),
-              paddress (target_gdbarch (), addr),
-              paddress (target_gdbarch (), m_last_max_alignment));
+              paddress (current_inferior ()->arch (), addr),
+              paddress (current_inferior ()->arch (), m_last_max_alignment));
 
       for (sect_iter = m_last_section_first; sect_iter != sect;
           sect_iter = sect_iter->next)
@@ -387,8 +388,8 @@ copy_sections (bfd *abfd, asection *sect, void *data)
     error (_("Cannot write compiled module \"%s\" section \"%s\" "
             "to inferior memory range %s-%s."),
           bfd_get_filename (abfd), bfd_section_name (sect),
-          paddress (target_gdbarch (), inferior_addr),
-          paddress (target_gdbarch (),
+          paddress (current_inferior ()->arch (), inferior_addr),
+          paddress (current_inferior ()->arch (),
                     inferior_addr + bfd_section_size (sect)));
 }
 
@@ -546,7 +547,7 @@ get_regs_type (struct symbol *func_sym, struct objfile *objfile)
 static void
 store_regs (struct type *regs_type, CORE_ADDR regs_base)
 {
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
   int fieldno;
 
   for (fieldno = 0; fieldno < regs_type->num_fields (); fieldno++)
@@ -666,16 +667,19 @@ compile_object_load (const compile_file_names &file_names,
     {
     case COMPILE_I_SIMPLE_SCOPE:
       expect_parameters = 1;
-      expect_return_type = builtin_type (target_gdbarch ())->builtin_void;
+      expect_return_type
+       = builtin_type (current_inferior ()->arch ())->builtin_void;
       break;
     case COMPILE_I_RAW_SCOPE:
       expect_parameters = 0;
-      expect_return_type = builtin_type (target_gdbarch ())->builtin_void;
+      expect_return_type
+       = builtin_type (current_inferior ()->arch ())->builtin_void;
       break;
     case COMPILE_I_PRINT_ADDRESS_SCOPE:
     case COMPILE_I_PRINT_VALUE_SCOPE:
       expect_parameters = 2;
-      expect_return_type = builtin_type (target_gdbarch ())->builtin_void;
+      expect_return_type
+       = builtin_type (current_inferior ()->arch ())->builtin_void;
       break;
     default:
       internal_error (_("invalid scope %d"), scope);
@@ -759,7 +763,7 @@ compile_object_load (const compile_file_names &file_names,
            gdb_printf (gdb_stdlog,
                        "Connecting ELF symbol \"%s\" to the .toc section (%s)\n",
                        sym->name,
-                       paddress (target_gdbarch (), sym->value));
+                       paddress (current_inferior ()->arch (), sym->value));
          continue;
        }
 
@@ -775,17 +779,17 @@ compile_object_load (const compile_file_names &file_names,
            gdb_printf (gdb_stdlog,
                        "ELF mst_text symbol \"%s\" relocated to %s\n",
                        sym->name,
-                       paddress (target_gdbarch (), sym->value));
+                       paddress (current_inferior ()->arch (), sym->value));
          break;
        case mst_text_gnu_ifunc:
-         sym->value = gnu_ifunc_resolve_addr (target_gdbarch (),
+         sym->value = gnu_ifunc_resolve_addr (current_inferior ()->arch (),
                                               bmsym.value_address ());
          if (compile_debug)
            gdb_printf (gdb_stdlog,
                        "ELF mst_text_gnu_ifunc symbol \"%s\" "
                        "relocated to %s\n",
                        sym->name,
-                       paddress (target_gdbarch (), sym->value));
+                       paddress (current_inferior ()->arch (), sym->value));
          break;
        default:
          warning (_("Could not find symbol \"%s\" "
@@ -805,7 +809,7 @@ compile_object_load (const compile_file_names &file_names,
   else
     {
       /* Use read-only non-executable memory protection.  */
-      regs_addr = gdbarch_infcall_mmap (target_gdbarch (),
+      regs_addr = gdbarch_infcall_mmap (current_inferior ()->arch (),
                                        regs_type->length (),
                                        GDB_MMAP_PROT_READ);
       gdb_assert (regs_addr != 0);
@@ -813,9 +817,9 @@ compile_object_load (const compile_file_names &file_names,
       if (compile_debug)
        gdb_printf (gdb_stdlog,
                    "allocated %s bytes at %s for registers\n",
-                   paddress (target_gdbarch (),
+                   paddress (current_inferior ()->arch (),
                              regs_type->length ()),
-                   paddress (target_gdbarch (), regs_addr));
+                   paddress (current_inferior ()->arch (), regs_addr));
       store_regs (regs_type, regs_addr);
     }
 
@@ -826,7 +830,7 @@ compile_object_load (const compile_file_names &file_names,
       if (out_value_type == NULL)
        return NULL;
       check_typedef (out_value_type);
-      out_value_addr = gdbarch_infcall_mmap (target_gdbarch (),
+      out_value_addr = gdbarch_infcall_mmap (current_inferior ()->arch (),
                                             out_value_type->length (),
                                             (GDB_MMAP_PROT_READ
                                              | GDB_MMAP_PROT_WRITE));
@@ -836,9 +840,9 @@ compile_object_load (const compile_file_names &file_names,
       if (compile_debug)
        gdb_printf (gdb_stdlog,
                    "allocated %s bytes at %s for printed value\n",
-                   paddress (target_gdbarch (),
+                   paddress (current_inferior ()->arch (),
                              out_value_type->length ()),
-                   paddress (target_gdbarch (), out_value_addr));
+                   paddress (current_inferior ()->arch (), out_value_addr));
     }
 
   compile_module_up retval (new struct compile_module);
index 1fbefd2eb8f93e41d0a14150532a28f655093530..c27061a3ae354037ecdaad0982994acbaa17515b 100644 (file)
@@ -188,7 +188,8 @@ memory_error (enum target_xfer_status err, CORE_ADDR memaddr)
   enum errors exception = GDB_NO_ERROR;
 
   /* Build error string.  */
-  std::string str = memory_error_message (err, target_gdbarch (), memaddr);
+  std::string str
+    = memory_error_message (err, current_inferior ()->arch (), memaddr);
 
   /* Choose the right error to throw.  */
   switch (err)
index c0b26239fd9a0c12635a722a46021d6369d6ae50..4da5e4fa5d461c8602958dd83891aa19887ac754 100644 (file)
@@ -1365,7 +1365,7 @@ bool
 core_target::fetch_memtags (CORE_ADDR address, size_t len,
                            gdb::byte_vector &tags, int type)
 {
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
 
   /* Make sure we have a way to decode the memory tag notes.  */
   if (!gdbarch_decode_memtag_section_p (gdbarch))
index d4a47eaac1f4f7b71ec0f9a7e0ad43d30d88cdf4..975e789f18ab5f902a9ba19883a74f2e4c23f683 100644 (file)
@@ -32,6 +32,7 @@
 #include "buildsym.h"
 #include "language.h"
 #include "namespace.h"
+#include "inferior.h"
 #include <map>
 #include <string>
 #include <string.h>
@@ -196,7 +197,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
       struct gdbarch *gdbarch;
 
       if (block == NULL)
-       gdbarch = target_gdbarch ();
+       gdbarch = current_inferior ()->arch ();
       else
        gdbarch = block->gdbarch ();
       sym.symbol
index 2af0218dba06e4112af5a8abffd21bef8b16ffcf..e02e859b99abf5ad3a8825e6a8b7a7da4a83d9a3 100644 (file)
@@ -43,6 +43,7 @@
 #include "event-top.h"
 #include "run-on-main-thread.h"
 #include "typeprint.h"
+#include "inferior.h"
 
 #define d_left(dc) (dc)->u.s_binary.left
 #define d_right(dc) (dc)->u.s_binary.right
@@ -1467,7 +1468,7 @@ add_symbol_overload_list_qualified (const char *func_name,
   struct objfile *current_objfile = block ? block->objfile () : nullptr;
 
   gdbarch_iterate_over_objfiles_in_search_order
-    (current_objfile ? current_objfile->arch () : target_gdbarch (),
+    (current_objfile ? current_objfile->arch () : current_inferior ()->arch (),
      [func_name, surrounding_static_block, &overload_list]
      (struct objfile *obj)
        {
index 6153e5b32394eeb08c88e1690939b5cbcbde9eee..69474ba08d92ae5ccf6d0473633e326b62a744bc 100644 (file)
@@ -25,6 +25,7 @@
 #include "d-lang.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "gdbarch.h"
+#include "inferior.h"
 
 /* This returns the length of first component of NAME, which should be
    the demangled name of a D variable/function/method/etc.
@@ -92,7 +93,7 @@ d_lookup_symbol (const struct language_defn *langdef,
       struct gdbarch *gdbarch;
 
       if (block == NULL)
-       gdbarch = target_gdbarch ();
+       gdbarch = current_inferior ()->arch ();
       else
        gdbarch = block->gdbarch ();
       sym.symbol
index d5f633bccae242a4f0a09ff63c0ebb04011aba50..07b06b32f76d8c9de819e98af7179c6ff2da4f20 100644 (file)
@@ -570,9 +570,10 @@ darwin_debug_regions (task_t task, mach_vm_address_t address, int max)
 
       if (print)
        {
+         gdbarch *arch = current_inferior ()->arch ();
          gdb_printf (_("%s-%s %s/%s  %s %s %s"),
-                     paddress (target_gdbarch (), prev_address),
-                     paddress (target_gdbarch (), prev_address + prev_size),
+                     paddress (arch, prev_address),
+                     paddress (arch, prev_address + prev_size),
                      unparse_protection (prev_info.protection),
                      unparse_protection (prev_info.max_protection),
                      unparse_inheritance (prev_info.inheritance),
@@ -618,7 +619,7 @@ darwin_debug_regions_recurse (task_t task)
 
   ui_out_emit_table table_emitter (uiout, 9, -1, "regions");
 
-  if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
+  if (gdbarch_addr_bit (current_inferior ()->arch ()) <= 32)
     {
       uiout->table_header (10, ui_left, "start", "Start");
       uiout->table_header (10, ui_left, "end", "End");
@@ -654,9 +655,10 @@ darwin_debug_regions_recurse (task_t task)
 
       {
        ui_out_emit_tuple tuple_emitter (uiout, "regions-row");
+       gdbarch *arch = current_inferior ()->arch ();
 
-       uiout->field_core_addr ("start", target_gdbarch (), r_start);
-       uiout->field_core_addr ("end", target_gdbarch (), r_start + r_size);
+       uiout->field_core_addr ("start", arch, r_start);
+       uiout->field_core_addr ("end", arch, r_start + r_size);
        uiout->field_string ("min-prot",
                             unparse_protection (r_info.protection));
        uiout->field_string ("max-prot",
index c075625cb6324162a8faa6a4cffb60466f7dba3d..8a5fb13acf5cd09492568db36cc0d996e9f11260 100644 (file)
@@ -576,7 +576,8 @@ dcache_print_line (DCACHE *dcache, int index)
   db = (struct dcache_block *) n->value;
 
   gdb_printf (_("Line %d: address %s [%d hits]\n"),
-             index, paddress (target_gdbarch (), db->addr), db->refs);
+             index, paddress (current_inferior ()->arch (), db->addr),
+             db->refs);
 
   for (j = 0; j < dcache->line_size; j++)
     {
@@ -636,7 +637,8 @@ dcache_info_1 (DCACHE *dcache, const char *exp)
       struct dcache_block *db = (struct dcache_block *) n->value;
 
       gdb_printf (_("Line %d: address %s [%d hits]\n"),
-                 i, paddress (target_gdbarch (), db->addr), db->refs);
+                 i, paddress (current_inferior ()->arch (), db->addr),
+                 db->refs);
       i++;
       refcount += db->refs;
 
index aa5c6dab6901e70d54c8eb3c5ff83f588639c391..2e866f6865e12dd04eba9479a8b88bd1ad757115 100644 (file)
@@ -33,6 +33,7 @@
 #include "valprint.h"
 #include "cli/cli-style.h"
 #include "objfiles.h"
+#include "inferior.h"
 
 /* Disassemble functions.
    FIXME: We should get rid of all the duplicate code in gdb that does
@@ -59,7 +60,8 @@ show_use_libopcodes_styling  (struct ui_file *file, int from_tty,
                              struct cmd_list_element *c,
                              const char *value)
 {
-  gdb_non_printing_memory_disassembler dis (target_gdbarch ());
+  gdbarch *arch = current_inferior ()->arch ();
+  gdb_non_printing_memory_disassembler dis (arch);
   bool supported = dis.disasm_info ()->created_styled_output;
 
   if (supported || !use_libopcodes_styling)
@@ -71,7 +73,7 @@ show_use_libopcodes_styling  (struct ui_file *file, int from_tty,
         turned on!  */
       gdb_printf (file, _("Use of libopcodes styling support is \"off\""
                          " (not supported on architecture \"%s\")\n"),
-                 gdbarch_bfd_arch_info (target_gdbarch ())->printable_name);
+                 gdbarch_bfd_arch_info (arch)->printable_name);
     }
 }
 
@@ -81,7 +83,8 @@ static void
 set_use_libopcodes_styling (const char *args, int from_tty,
                            struct cmd_list_element *c)
 {
-  gdb_non_printing_memory_disassembler dis (target_gdbarch ());
+  gdbarch *arch = current_inferior ()->arch ();
+  gdb_non_printing_memory_disassembler dis (arch);
   bool supported = dis.disasm_info ()->created_styled_output;
 
   /* If the current architecture doesn't support libopcodes styling then we
@@ -93,7 +96,7 @@ set_use_libopcodes_styling (const char *args, int from_tty,
     {
       use_libopcodes_styling_option = use_libopcodes_styling;
       error (_("Use of libopcodes styling not supported on architecture \"%s\"."),
-            gdbarch_bfd_arch_info (target_gdbarch ())->printable_name);
+            gdbarch_bfd_arch_info (arch)->printable_name);
     }
   else
     use_libopcodes_styling = use_libopcodes_styling_option;
index 8704b52f35bbc0a51b1c9378ef96ead02610153f..7900dfbc388f7259e94a680e9c6bf5d758a81cb0 100644 (file)
@@ -781,7 +781,7 @@ elf_gnu_ifunc_resolve_by_cache (const char *name, CORE_ADDR *addr_p)
      To search other namespaces, we would need to provide context, e.g. in
      form of an objfile in that namespace.  */
   gdbarch_iterate_over_objfiles_in_search_order
-    (target_gdbarch (),
+    (current_inferior ()->arch (),
      [name, &addr_p, &found] (struct objfile *objfile)
        {
         htab_t htab;
@@ -835,7 +835,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
      To search other namespaces, we would need to provide context, e.g. in
      form of an objfile in that namespace.  */
   gdbarch_iterate_over_objfiles_in_search_order
-    (target_gdbarch (),
+    (current_inferior ()->arch (),
      [name, name_got_plt, &addr_p, &found] (struct objfile *objfile)
        {
         bfd *obfd = objfile->obfd.get ();
index 55a36f240257e77e4ccae459315186bb52546010..0e0d0cdf621d17219595e40592a2a75d0f0dcfc8 100644 (file)
@@ -178,7 +178,7 @@ fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
        {
          gdb_printf ("Save segment, %ld bytes at %s (%c%c%c)\n",
                      (long) size,
-                     paddress (target_gdbarch (), kve->kve_start),
+                     paddress (current_inferior ()->arch (), kve->kve_start),
                      kve->kve_protection & KVME_PROT_READ ? 'r' : '-',
                      kve->kve_protection & KVME_PROT_WRITE ? 'w' : '-',
                      kve->kve_protection & KVME_PROT_EXEC ? 'x' : '-');
index 27a806e1ba0da13045a68f0778cab98e39112f74..a1342442a2c47ec666061cc727cc443cd4a99d40 100644 (file)
@@ -21,6 +21,7 @@
 #include "filesystem.h"
 #include "gdbarch.h"
 #include "gdbcmd.h"
+#include "inferior.h"
 
 const char file_system_kind_auto[] = "auto";
 const char file_system_kind_unix[] = "unix";
@@ -39,7 +40,7 @@ effective_target_file_system_kind (void)
 {
   if (target_file_system_kind == file_system_kind_auto)
     {
-      if (gdbarch_has_dos_based_file_system (target_gdbarch ()))
+      if (gdbarch_has_dos_based_file_system (current_inferior ()->arch ()))
        return file_system_kind_dos_based;
       else
        return file_system_kind_unix;
index 866b2e6b4a67d2db5e8cf5bcd689390e0e40a5e4..927b6256b0b3a4d2b46990c49ca80580b93bbb1e 100644 (file)
@@ -29,6 +29,7 @@
 #include "gdbarch.h"
 #include "dwarf2/frame-tailcall.h"
 #include "cli/cli-cmds.h"
+#include "inferior.h"
 
 struct frame_unwind_table_entry
 {
@@ -344,7 +345,7 @@ frame_unwind_got_address (frame_info_ptr frame, int regnum,
 static void
 maintenance_info_frame_unwinders (const char *args, int from_tty)
 {
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
   struct frame_unwind_table *table = get_frame_unwind_table (gdbarch);
 
   ui_out *uiout = current_uiout;
index 05cad94526e7e6584bcd845f44c030c7751edc18..a55b96f08f3448aaa79500aa56a3a77460dc3939 100644 (file)
@@ -71,16 +71,16 @@ write_gcore_file_1 (bfd *obfd)
   gdb::unique_xmalloc_ptr<char> note_data;
   int note_size = 0;
   asection *note_sec = NULL;
+  gdbarch *arch = current_inferior ()->arch ();
 
   /* An external target method must build the notes section.  */
   /* FIXME: uweigand/2011-10-06: All architectures that support core file
      generation should be converted to gdbarch_make_corefile_notes; at that
      point, the target vector method can be removed.  */
-  if (!gdbarch_make_corefile_notes_p (target_gdbarch ()))
+  if (!gdbarch_make_corefile_notes_p (arch))
     note_data = target_make_corefile_notes (obfd, &note_size);
   else
-    note_data = gdbarch_make_corefile_notes (target_gdbarch (), obfd,
-                                            &note_size);
+    note_data = gdbarch_make_corefile_notes (arch, obfd, &note_size);
 
   if (note_data == NULL || note_size == 0)
     error (_("Target does not support core file generation."));
@@ -166,7 +166,8 @@ gcore_command (const char *args, int from_tty)
 static enum bfd_architecture
 default_gcore_arch (void)
 {
-  const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch ());
+  const bfd_arch_info *bfdarch
+    = gdbarch_bfd_arch_info (current_inferior ()->arch ());
 
   if (bfdarch != NULL)
     return bfdarch->arch;
@@ -179,9 +180,10 @@ default_gcore_arch (void)
 static const char *
 default_gcore_target (void)
 {
+  gdbarch *arch = current_inferior ()->arch ();
   /* The gdbarch may define a target to use for core files.  */
-  if (gdbarch_gcore_bfd_target_p (target_gdbarch ()))
-    return gdbarch_gcore_bfd_target (target_gdbarch ());
+  if (gdbarch_gcore_bfd_target_p (arch))
+    return gdbarch_gcore_bfd_target (arch);
 
   /* Otherwise, try to fall back to the exec target.  This will probably
      not work for non-ELF targets.  */
@@ -394,10 +396,9 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
   if (read == 0 && write == 0 && exec == 0 && modified == 0)
     {
       if (info_verbose)
-       {
-         gdb_printf ("Ignore segment, %s bytes at %s\n",
-                     plongest (size), paddress (target_gdbarch (), vaddr));
-       }
+       gdb_printf ("Ignore segment, %s bytes at %s\n",
+                   plongest (size), paddress (current_inferior ()->arch (),
+                   vaddr));
 
       return 0;
     }
@@ -453,10 +454,9 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
     }
 
   if (info_verbose)
-    {
-      gdb_printf ("Save segment, %s bytes at %s\n",
-                 plongest (size), paddress (target_gdbarch (), vaddr));
-    }
+    gdb_printf ("Save segment, %s bytes at %s\n",
+               plongest (size), paddress (current_inferior ()->arch (),
+               vaddr));
 
   bfd_set_section_size (osec, size);
   bfd_set_section_vma (osec, vaddr);
@@ -486,8 +486,9 @@ gcore_create_memtag_section_callback (CORE_ADDR vaddr, unsigned long size,
   /* Ask the architecture to create a memory tag section for this particular
      memory map entry.  It will be populated with contents later, as we can't
      start writing the contents before we have all the sections sorted out.  */
+  gdbarch *arch = current_inferior ()->arch ();
   asection *memtag_section
-    = gdbarch_create_memtag_section (target_gdbarch (), obfd, vaddr, size);
+    = gdbarch_create_memtag_section (arch, obfd, vaddr, size);
 
   if (memtag_section == nullptr)
     {
@@ -501,7 +502,7 @@ gcore_create_memtag_section_callback (CORE_ADDR vaddr, unsigned long size,
       gdb_printf (gdb_stdout, "Saved memory tag segment, %s bytes "
                              "at %s\n",
                  plongest (bfd_section_size (memtag_section)),
-                 paddress (target_gdbarch (), vaddr));
+                 paddress (arch, vaddr));
     }
 
   return 0;
@@ -594,7 +595,8 @@ gcore_copy_callback (bfd *obfd, asection *osec)
          warning (_("Memory read failed for corefile "
                     "section, %s bytes at %s."),
                   plongest (size),
-                  paddress (target_gdbarch (), bfd_section_vma (osec)));
+                  paddress (current_inferior ()->arch (),
+                            bfd_section_vma (osec)));
          break;
        }
       if (!bfd_set_section_contents (obfd, osec, memhunk.data (),
@@ -620,7 +622,7 @@ gcore_copy_memtag_section_callback (bfd *obfd, asection *osec)
     return;
 
   /* Fill the section with memory tag contents.  */
-  if (!gdbarch_fill_memtag_section (target_gdbarch (), osec))
+  if (!gdbarch_fill_memtag_section (current_inferior ()->arch (), osec))
     error (_("Failed to fill memory tag section for core file."));
 }
 
@@ -628,18 +630,17 @@ static int
 gcore_memory_sections (bfd *obfd)
 {
   /* Try gdbarch method first, then fall back to target method.  */
-  if (!gdbarch_find_memory_regions_p (target_gdbarch ())
-      || gdbarch_find_memory_regions (target_gdbarch (),
-                                     gcore_create_callback, obfd) != 0)
+  gdbarch *arch = current_inferior ()->arch ();
+  if (!gdbarch_find_memory_regions_p (arch)
+      || gdbarch_find_memory_regions (arch, gcore_create_callback, obfd) != 0)
     {
       if (target_find_memory_regions (gcore_create_callback, obfd) != 0)
        return 0;                       /* FIXME: error return/msg?  */
     }
 
   /* Take care of dumping memory tags, if there are any.  */
-  if (!gdbarch_find_memory_regions_p (target_gdbarch ())
-      || gdbarch_find_memory_regions (target_gdbarch (),
-                                     gcore_create_memtag_section_callback,
+  if (!gdbarch_find_memory_regions_p (arch)
+      || gdbarch_find_memory_regions (arch, gcore_create_memtag_section_callback,
                                      obfd) != 0)
     {
       if (target_find_memory_regions (gcore_create_memtag_section_callback,
index 5285f29b18b88bebc45838638b70a72fdc745841..82d42c9d2208e3fd6511f3ff87abfc99704c6f50 100644 (file)
@@ -72,21 +72,6 @@ struct gdbarch_tdep_base
 
 using gdbarch_tdep_up = std::unique_ptr<gdbarch_tdep_base>;
 
-/* The architecture associated with the inferior through the
-   connection to the target.
-
-   The architecture vector provides some information that is really a
-   property of the inferior, accessed through a particular target:
-   ptrace operations; the layout of certain RSP packets; the solib_ops
-   vector; etc.  To differentiate architecture accesses to
-   per-inferior/target properties from
-   per-thread/per-frame/per-objfile properties, accesses to
-   per-inferior/target properties should be made through this
-   gdbarch.  */
-
-/* This is a convenience wrapper for 'current_inferior ()->gdbarch'.  */
-extern struct gdbarch *target_gdbarch (void);
-
 /* Callback type for the 'iterate_over_objfiles_in_search_order'
    gdbarch  method.  */
 
index 90caee8a9d46b4cd1ab3c2b587f832deb225303b..4608f24780699ac13b999853a68ee83b179a589b 100644 (file)
@@ -2467,14 +2467,14 @@ gnu_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
   if (writebuf != NULL)
     {
       inf_debug (gnu_current_inf, "writing %s[%s] <-- %s",
-                paddress (target_gdbarch (), memaddr), pulongest (len),
+                paddress (current_inferior ()->arch (), memaddr), pulongest (len),
                 host_address_to_string (writebuf));
       res = gnu_write_inferior (task, memaddr, writebuf, len);
     }
   else
     {
       inf_debug (gnu_current_inf, "reading %s[%s] --> %s",
-                paddress (target_gdbarch (), memaddr), pulongest (len),
+                paddress (current_inferior ()->arch (), memaddr), pulongest (len),
                 host_address_to_string (readbuf));
       res = gnu_read_inferior (task, memaddr, readbuf, len);
     }
@@ -2529,7 +2529,7 @@ gnu_xfer_auxv (gdb_byte *readbuf, const gdb_byte *writebuf,
   auxv[1].a_un.a_val = 0;
 
   inf_debug (gnu_current_inf, "reading auxv %s[%s] --> %s",
-            paddress (target_gdbarch (), memaddr), pulongest (len),
+            paddress (current_inferior ()->arch (), memaddr), pulongest (len),
             host_address_to_string (readbuf));
 
   if (memaddr + len > sizeof (auxv))
index 284c6771d07c5798f6f53029b89557fb61f97536..8aeef2049d700f644542adfbd43845b915fcf10a 100644 (file)
@@ -475,7 +475,7 @@ i386_darwin_dr_get_control (void)
 void
 darwin_check_osabi (darwin_inferior *inf, thread_t thread)
 {
-  if (gdbarch_osabi (target_gdbarch ()) == GDB_OSABI_UNKNOWN)
+  if (gdbarch_osabi (current_inferior ()->arch ()) == GDB_OSABI_UNKNOWN)
     {
       /* Attaching to a process.  Let's figure out what kind it is.  */
       x86_thread_state_t gp_regs;
@@ -492,7 +492,7 @@ darwin_check_osabi (darwin_inferior *inf, thread_t thread)
 
       gdbarch_info info;
       gdbarch_info_fill (&info);
-      info.byte_order = gdbarch_byte_order (target_gdbarch ());
+      info.byte_order = gdbarch_byte_order (current_inferior ()->arch ());
       info.osabi = GDB_OSABI_DARWIN;
       if (gp_regs.tsh.flavor == x86_THREAD_STATE64)
        info.bfd_arch_info = bfd_lookup_arch (bfd_arch_i386,
@@ -516,7 +516,7 @@ darwin_check_osabi (darwin_inferior *inf, thread_t thread)
 static int
 i386_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   static const gdb_byte darwin_syscall[] = { 0xcd, 0x80 }; /* int 0x80 */
   gdb_byte buf[sizeof (darwin_syscall)];
 
@@ -549,7 +549,7 @@ i386_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
 static int
 amd64_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   static const gdb_byte darwin_syscall[] = { 0x0f, 0x05 }; /* syscall */
   gdb_byte buf[sizeof (darwin_syscall)];
 
index d54236818026de2298fb9fb9db68d4866befc2ae..560f16aa0e3242fbf3a1c0703e3201423231a108 100644 (file)
@@ -3451,7 +3451,8 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
            result_value->mark_bytes_unavailable (0, 16);
          else
            {
-             enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+             bfd_endian byte_order
+               = gdbarch_byte_order (current_inferior ()->arch ());
              LONGEST upper, lower;
              int size = builtin_type (gdbarch)->builtin_data_ptr->length ();
 
@@ -3635,7 +3636,8 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
        {
          ULONGEST upper, lower;
          int size = builtin_type (gdbarch)->builtin_data_ptr->length ();
-         enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+         bfd_endian byte_order
+           = gdbarch_byte_order (current_inferior ()->arch ());
 
          /* New values from input value.  */
          regnum -= tdep->bnd0_regnum;
index 1ed0d2dfb71399145ea278b91d3b9ba5c15b0c25..000052fcbf947e4018221110fa94bcb69506b6ca 100644 (file)
@@ -34,7 +34,7 @@ ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip,
                           unw_proc_info_t *pi,
                           int need_unwind_info, void *arg)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   gdb_byte buf[32];
   const char *annex = core_addr_to_string (ip);
   LONGEST res;
index fd85d27466ac71987644e3ae81c1bce4a8a91699..cf8cd52795584f638dbb92cbbef2db41a26d2e8c 100644 (file)
@@ -287,7 +287,7 @@ post_create_inferior (int from_tty)
 
          /* If the solist is global across processes, there's no need to
             refetch it here.  */
-         if (!gdbarch_has_global_solist (target_gdbarch ()))
+         if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
            solib_add (nullptr, 0, auto_solib_add);
        }
     }
@@ -2015,7 +2015,7 @@ info_program_command (const char *args, int from_tty)
 
   target_files_info ();
   gdb_printf (_("Program stopped at %s.\n"),
-             paddress (target_gdbarch (), tp->stop_pc ()));
+             paddress (current_inferior ()->arch (), tp->stop_pc ()));
   if (tp->control.stop_step)
     gdb_printf (_("It stopped after being stepped.\n"));
   else if (stat != 0)
@@ -2661,7 +2661,7 @@ attach_command (const char *args, int from_tty)
 
   scoped_disable_commit_resumed disable_commit_resumed ("attaching");
 
-  if (gdbarch_has_global_solist (target_gdbarch ()))
+  if (gdbarch_has_global_solist (current_inferior ()->arch ()))
     /* Don't complain if all processes share the same symbol
        space.  */
     ;
@@ -2873,7 +2873,7 @@ detach_command (const char *args, int from_tty)
 
   /* If the solist is global across inferiors, don't clear it when we
      detach from a single inferior.  */
-  if (!gdbarch_has_global_solist (target_gdbarch ()))
+  if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
     no_shared_libraries (nullptr, from_tty);
 
   if (deprecated_detach_hook)
index 784f0b96ebf566d26af5ed6ee502c1283d879b85..4fde96800fb1c3b17950acba5e9ff5b100d00431 100644 (file)
@@ -5300,7 +5300,8 @@ handle_one (const wait_one_event &event)
 
          infrun_debug_printf ("saved stop_pc=%s for %s "
                               "(currently_stepping=%d)",
-                              paddress (target_gdbarch (), t->stop_pc ()),
+                              paddress (current_inferior ()->arch (),
+                                        t->stop_pc ()),
                               t->ptid.to_string ().c_str (),
                               currently_stepping (t));
        }
@@ -6334,7 +6335,8 @@ finish_step_over (struct execution_control_state *ecs)
 
          infrun_debug_printf ("saved stop_pc=%s for %s "
                               "(currently_stepping=%d)",
-                              paddress (target_gdbarch (), tp->stop_pc ()),
+                              paddress (current_inferior ()->arch (),
+                                        tp->stop_pc ()),
                               tp->ptid.to_string ().c_str (),
                               currently_stepping (tp));
 
@@ -8018,8 +8020,9 @@ keep_going_stepped_thread (struct thread_info *tp)
       ptid_t resume_ptid;
 
       infrun_debug_printf ("expected thread advanced also (%s -> %s)",
-                          paddress (target_gdbarch (), tp->prev_pc),
-                          paddress (target_gdbarch (), tp->stop_pc ()));
+                          paddress (current_inferior ()->arch (), tp->prev_pc),
+                          paddress (current_inferior ()->arch (),
+                                    tp->stop_pc ()));
 
       /* Clear the info of the previous step-over, as it's no longer
         valid (if the thread was trying to step over a breakpoint, it
index 1997be77b83514748107761b03fa33d2d38a3021..9e8325ab80347caaa7c065a6ef0949c3a1d0d57d 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -1229,7 +1229,8 @@ jit_inferior_execd_hook (inferior *exec_inf, inferior *follow_inf)
 void
 jit_breakpoint_re_set (void)
 {
-  jit_breakpoint_re_set_internal (target_gdbarch (), current_program_space);
+  jit_breakpoint_re_set_internal (current_inferior ()->arch (),
+                                 current_program_space);
 }
 
 /* This function cleans up any code entries left over when the
index 7e36ced62921afaa236d81c6fdc8949660a032ba..9148dda4aada12caf3789bd3185f10e16b3d398c 100644 (file)
@@ -2448,8 +2448,9 @@ status_callback (struct lwp_info *lp)
        {
          linux_nat_debug_printf ("PC of %s changed.  was=%s, now=%s",
                                  lp->ptid.to_string ().c_str (),
-                                 paddress (target_gdbarch (), lp->stop_pc),
-                                 paddress (target_gdbarch (), pc));
+                                 paddress (current_inferior ()->arch (),
+                                           lp->stop_pc),
+                                 paddress (current_inferior ()->arch (), pc));
          discard = 1;
        }
 
@@ -2458,7 +2459,8 @@ status_callback (struct lwp_info *lp)
        {
          linux_nat_debug_printf ("previous breakpoint of %s, at %s gone",
                                  lp->ptid.to_string ().c_str (),
-                                 paddress (target_gdbarch (), lp->stop_pc));
+                                 paddress (current_inferior ()->arch (),
+                                           lp->stop_pc));
 
          discard = 1;
        }
@@ -3725,7 +3727,7 @@ linux_nat_target::xfer_partial (enum target_object object,
         by linux_proc_xfer_partial.
 
         Compare ADDR_BIT first to avoid a compiler warning on shift overflow.  */
-      int addr_bit = gdbarch_addr_bit (target_gdbarch ());
+      int addr_bit = gdbarch_addr_bit (current_inferior ()->arch ());
 
       if (addr_bit < (sizeof (ULONGEST) * HOST_CHAR_BIT))
        offset &= ((ULONGEST) 1 << addr_bit) - 1;
index fafd909a714d1a7324875c2d34837c8b2261efa4..8b0e3ef7b7eab5a1fe3207a3a7865062d5612f50 100644 (file)
@@ -29,6 +29,7 @@
 #include "cli/cli-utils.h"
 #include <algorithm>
 #include "gdbarch.h"
+#include "inferior.h"
 
 static std::vector<mem_region> user_mem_region_list, target_mem_region_list;
 static std::vector<mem_region> *mem_region_list = &target_mem_region_list;
@@ -354,10 +355,10 @@ info_mem_command (const char *args, int from_tty)
   gdb_printf ("Num ");
   gdb_printf ("Enb ");
   gdb_printf ("Low Addr   ");
-  if (gdbarch_addr_bit (target_gdbarch ()) > 32)
+  if (gdbarch_addr_bit (current_inferior ()->arch ()) > 32)
     gdb_printf ("        ");
   gdb_printf ("High Addr  ");
-  if (gdbarch_addr_bit (target_gdbarch ()) > 32)
+  if (gdbarch_addr_bit (current_inferior ()->arch ()) > 32)
     gdb_printf ("        ");
   gdb_printf ("Attrs ");
   gdb_printf ("\n");
@@ -369,14 +370,14 @@ info_mem_command (const char *args, int from_tty)
       gdb_printf ("%-3d %-3c\t",
                  m.number,
                  m.enabled_p ? 'y' : 'n');
-      if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
+      if (gdbarch_addr_bit (current_inferior ()->arch ()) <= 32)
        tmp = hex_string_custom (m.lo, 8);
       else
        tmp = hex_string_custom (m.lo, 16);
       
       gdb_printf ("%s ", tmp);
 
-      if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
+      if (gdbarch_addr_bit (current_inferior ()->arch ()) <= 32)
        {
          if (m.hi == 0)
            tmp = "0x100000000";
index 85c2e229a5c3d734dcc089731b59504e863be17c..a84df4e1f53ccc5fbd12ce478ba8e644df9d18c1 100644 (file)
@@ -263,7 +263,7 @@ me_module_register_set (CONFIG_ATTR me_module,
        specifically excluding the generic coprocessor register sets.  */
 
   mep_gdbarch_tdep *tdep
-    = gdbarch_tdep<mep_gdbarch_tdep> (target_gdbarch ());
+    = gdbarch_tdep<mep_gdbarch_tdep> (current_inferior ()->arch ());
   CGEN_CPU_DESC desc = tdep->cpu_desc;
   const CGEN_HW_ENTRY *hw;
 
@@ -859,7 +859,7 @@ current_me_module (void)
   else
     {
       mep_gdbarch_tdep *tdep
-       = gdbarch_tdep<mep_gdbarch_tdep> (target_gdbarch ());
+       = gdbarch_tdep<mep_gdbarch_tdep> (current_inferior ()->arch ());
       return tdep->me_module;
     }
 }
index b3b0f5bb1f512324a9c8e7fc6884536b660042b2..0d3c8235c2c1c342d049410ef327f5da265dd109 100644 (file)
@@ -726,13 +726,13 @@ mi_interp::on_target_resumed (ptid_t ptid)
 void
 mi_output_solib_attribs (ui_out *uiout, struct so_list *solib)
 {
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
 
   uiout->field_string ("id", solib->so_original_name);
   uiout->field_string ("target-name", solib->so_original_name);
   uiout->field_string ("host-name", solib->so_name);
   uiout->field_signed ("symbols-loaded", solib->symbols_loaded);
-  if (!gdbarch_has_global_solist (target_gdbarch ()))
+  if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
       uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
 
   ui_out_emit_list list_emitter (uiout, "ranges");
@@ -776,7 +776,7 @@ mi_interp::on_solib_unloaded (so_list *solib)
   uiout->field_string ("id", solib->so_original_name);
   uiout->field_string ("target-name", solib->so_original_name);
   uiout->field_string ("host-name", solib->so_name);
-  if (!gdbarch_has_global_solist (target_gdbarch ()))
+  if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
     uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
 
   gdb_flush (this->event_channel);
@@ -821,7 +821,7 @@ mi_interp::on_memory_changed (inferior *inferior, CORE_ADDR memaddr,
   ui_out_redirect_pop redir (mi_uiout, this->event_channel);
 
   mi_uiout->field_fmt ("thread-group", "i%d", inferior->num);
-  mi_uiout->field_core_addr ("addr", target_gdbarch (), memaddr);
+  mi_uiout->field_core_addr ("addr", current_inferior ()->arch (), memaddr);
   mi_uiout->field_string ("len", hex_string (len));
 
   /* Append 'type=code' into notification if MEMADDR falls in the range of
index 4f18ef7db2545b829307c6f4918a8c25972d921f..944c9116731fc5e24c4ecbe266c0f0eec4643eaa 100644 (file)
@@ -2714,7 +2714,7 @@ mi_cmd_trace_frame_collected (const char *command, const char *const *argv,
 
     for (const mem_range &r : available_memory)
       {
-       struct gdbarch *gdbarch = target_gdbarch ();
+       gdbarch *gdbarch = current_inferior ()->arch ();
 
        ui_out_emit_tuple tuple_emitter (uiout, NULL);
 
index f254a54305c3541ff86686f89dec2272b4dcfd3c..74e70405b3a8205f960bf6f6105d868e71eeb697 100644 (file)
@@ -115,7 +115,7 @@ microblaze_register_type (struct gdbarch *gdbarch, int regnum)
 static unsigned long
 microblaze_fetch_instruction (CORE_ADDR pc)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   gdb_byte buf[4];
 
   /* If we can't read the instruction at PC, return zero.  */
index 8a7cc95f2a472fa8f9ddbabaaf7ac6ae61807fef..8d21049b8cfc683acb23cdded9327256278ff1ec 100644 (file)
@@ -516,7 +516,7 @@ mips_show_dr (const char *func, CORE_ADDR addr,
   if (addr || len)
     gdb_printf (gdb_stdlog,
                " (addr=%s, len=%d, type=%s)",
-               paddress (target_gdbarch (), addr), len,
+               paddress (current_inferior ()->arch (), addr), len,
                type == hw_write ? "data-write"
                : (type == hw_read ? "data-read"
                   : (type == hw_access ? "data-read/write"
@@ -526,10 +526,10 @@ mips_show_dr (const char *func, CORE_ADDR addr,
 
   for (i = 0; i < MAX_DEBUG_REGISTER; i++)
     gdb_printf (gdb_stdlog, "\tDR%d: lo=%s, hi=%s\n", i,
-               paddress (target_gdbarch (),
+               paddress (current_inferior ()->arch (),
                          mips_linux_watch_get_watchlo (&watch_mirror,
                                                        i)),
-               paddress (target_gdbarch (),
+               paddress (current_inferior ()->arch (),
                          mips_linux_watch_get_watchhi (&watch_mirror,
                                                        i)));
 }
index 9f5d5b32408510c1c6d3752e5188a300bc27bcd7..371bc73c9b205fbf042b130336218cafdf36003e 100644 (file)
@@ -39,6 +39,7 @@
 #include "linux-tdep.h"
 #include "xml-syscall.h"
 #include "gdbsupport/gdb_signals.h"
+#include "inferior.h"
 
 #include "features/mips-linux.c"
 #include "features/mips-dsp-linux.c"
@@ -599,8 +600,8 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc)
 {
   gdb_byte buf[28], *p;
   ULONGEST insn, insn1;
-  int n64 = (mips_abi (target_gdbarch ()) == MIPS_ABI_N64);
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  int n64 = (mips_abi (current_inferior ()->arch ()) == MIPS_ABI_N64);
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
 
   if (in_mips_stubs_section (pc))
     return 1;
index 4044daa24131517b6cafb7ab536a7e4bdf6a7947..d40d28e85de5ef69b063a4378d123ea5fd21c58a 100644 (file)
@@ -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)
index 9154d488499a77d7219f9c034216d9d1c8a022bc..600fb060b1e9ced41066e036ddb87008fba17324 100644 (file)
@@ -279,7 +279,7 @@ moxie_process_readu (CORE_ADDR addr, gdb_byte *buf,
        gdb_printf (gdb_stderr,
                    _("Process record: error reading memory at "
                      "addr 0x%s len = %d.\n"),
-                   paddress (target_gdbarch (), addr), length);
+                   paddress (current_inferior ()->arch  (), addr), length);
       return -1;
     }
 
@@ -628,7 +628,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
   if (record_debug > 1)
     gdb_printf (gdb_stdlog, "Process record: moxie_process_record "
                "addr = 0x%s\n",
-               paddress (target_gdbarch (), addr));
+               paddress (current_inferior ()->arch  (), addr));
 
   inst = (uint16_t) moxie_process_readu (addr, buf, 2, byte_order);
 
index 2768e4e3a21d94d2a41dac350087801d25839845..97d9073efbbef52e6c1dacf50e49a39c1643bda4 100644 (file)
@@ -35,6 +35,7 @@
 #include "dwarf2/frame.h"
 #include "reggroups.h"
 #include "gdbarch.h"
+#include "inferior.h"
 
 #include "elf/msp430.h"
 #include "opcode/msp430-decode.h"
@@ -328,7 +329,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, MSP430_SP_REGNUM)
-      && size == register_size (target_gdbarch (), value.reg))
+      && size == register_size (current_inferior ()->arch  (), value.reg))
     result->reg_offset[value.reg] = addr.k;
 }
 
index d1614ec07839b0d9e7c6e6f36f585522f0c92561..0cfcb45038ccb80f8a317006cb1a7038ef263c73 100644 (file)
@@ -250,7 +250,7 @@ nbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
        {
          gdb_printf ("Save segment, %ld bytes at %s (%c%c%c)\n",
                      (long) size,
-                     paddress (target_gdbarch (), kve->kve_start),
+                     paddress (current_inferior ()->arch  (), kve->kve_start),
                      kve->kve_protection & KVME_PROT_READ ? 'r' : '-',
                      kve->kve_protection & KVME_PROT_WRITE ? 'w' : '-',
                      kve->kve_protection & KVME_PROT_EXEC ? 'x' : '-');
index 61c18fdc8254440b66cd04d2f592b9498e257f5f..08bb8699b7c0bfa28e5d615a37a8f3f2dfc0814c 100644 (file)
@@ -275,8 +275,9 @@ nto_procfs_target::open (const char *arg, int from_tty)
          else
            {
              if (sysinfo->type !=
-                 nto_map_arch_to_cputype (gdbarch_bfd_arch_info
-                                          (target_gdbarch ())->arch_name))
+                 nto_map_arch_to_cputype
+                   (gdbarch_bfd_arch_info
+                    (current_inferior ()->arch ())->arch_name))
                error (_("Invalid target CPU."));
            }
        }
index 1ad0f0129690334543444665e74742f8e270ab65..9ece8b5fb39bcbd3d7ac84476871de570fdf7a0e 100644 (file)
@@ -102,14 +102,15 @@ nto_find_and_open_solib (const char *solib, unsigned o_flags,
   "%s/lib:%s/usr/lib:%s/usr/photon/lib:%s/usr/photon/dll:%s/lib/dll"
 
   nto_root = nto_target ();
-  if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0)
+  gdbarch *gdbarch = current_inferior ()->arch ();
+  if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name, "i386") == 0)
     {
       arch = "x86";
       endian = "";
     }
-  else if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
+  else if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name,
                   "rs6000") == 0
-          || strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
+          || strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name,
                   "powerpc") == 0)
     {
       arch = "ppc";
@@ -117,8 +118,8 @@ nto_find_and_open_solib (const char *solib, unsigned o_flags,
     }
   else
     {
-      arch = gdbarch_bfd_arch_info (target_gdbarch ())->arch_name;
-      endian = gdbarch_byte_order (target_gdbarch ())
+      arch = gdbarch_bfd_arch_info (gdbarch)->arch_name;
+      endian = gdbarch_byte_order (gdbarch)
               == BFD_ENDIAN_BIG ? "be" : "le";
     }
 
@@ -162,14 +163,15 @@ nto_init_solib_absolute_prefix (void)
   const char *arch;
 
   nto_root = nto_target ();
-  if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0)
+  gdbarch *gdbarch = current_inferior ()->arch ();
+  if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name, "i386") == 0)
     {
       arch = "x86";
       endian = "";
     }
-  else if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
+  else if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name,
                   "rs6000") == 0
-          || strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
+          || strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name,
                   "powerpc") == 0)
     {
       arch = "ppc";
@@ -177,8 +179,8 @@ nto_init_solib_absolute_prefix (void)
     }
   else
     {
-      arch = gdbarch_bfd_arch_info (target_gdbarch ())->arch_name;
-      endian = gdbarch_byte_order (target_gdbarch ())
+      arch = gdbarch_bfd_arch_info (gdbarch)->arch_name;
+      endian = gdbarch_byte_order (gdbarch)
               == BFD_ENDIAN_BIG ? "be" : "le";
     }
 
@@ -253,12 +255,13 @@ lm_addr (struct so_list *so)
 static CORE_ADDR
 nto_truncate_ptr (CORE_ADDR addr)
 {
-  if (gdbarch_ptr_bit (target_gdbarch ()) == sizeof (CORE_ADDR) * 8)
+  gdbarch *gdbarch = current_inferior ()->arch ();
+  if (gdbarch_ptr_bit (gdbarch) == sizeof (CORE_ADDR) * 8)
     /* We don't need to truncate anything, and the bit twiddling below
        will fail due to overflow problems.  */
     return addr;
   else
-    return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (target_gdbarch ())) - 1);
+    return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (gdbarch)) - 1);
 }
 
 static Elf_Internal_Phdr *
@@ -455,7 +458,7 @@ nto_read_auxv_from_initial_stack (CORE_ADDR initial_stack, gdb_byte *readbuf,
   if (target_read_memory (initial_stack + data_ofs, targ32, 4) != 0)
     return 0;
 
-  byte_order = gdbarch_byte_order (target_gdbarch ());
+  byte_order = gdbarch_byte_order (current_inferior ()->arch ());
 
   anint = extract_unsigned_integer (targ32, sizeof (targ32), byte_order);
 
index d14aba694e539d182438207f1141ea799d8dc9b4..a0205119f005534bae14612b111d75be77e0100b 100644 (file)
@@ -1920,7 +1920,7 @@ ppc_linux_nat_target::auxv_parse (const gdb_byte **readptr,
 
   int sizeof_auxv_field = ppc_linux_target_wordsize (tid);
 
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   const gdb_byte *ptr = *readptr;
 
   if (endptr == ptr)
index d29a57f89b559645f1617c76c61b6e10e108f231..5e9c8a5b222c370ca755774bb98b838dad593881 100644 (file)
@@ -55,6 +55,7 @@
 #include "gdbsupport/gdb_optional.h"
 #include "gdbsupport/gdb-safe-ctype.h"
 #include "gdbsupport/rsp-low.h"
+#include "inferior.h"
 
 /* Chain containing all defined memory-tag subcommands.  */
 
@@ -1132,7 +1133,7 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
            = value_from_ulongest (builtin_type (gdbarch)->builtin_data_ptr,
                                   tag_laddr);
 
-         if (gdbarch_tagged_address_p (target_gdbarch (), v_addr))
+         if (gdbarch_tagged_address_p (current_inferior ()->arch  (), v_addr))
            {
              /* Fetch the allocation tag.  */
              struct value *tag
@@ -1287,7 +1288,7 @@ should_validate_memtags (struct value *value)
     return false;
 
   /* We do.  Check whether it includes any tags.  */
-  return gdbarch_tagged_address_p (target_gdbarch (), value);
+  return gdbarch_tagged_address_p (current_inferior ()->arch  (), value);
 }
 
 /* Helper for parsing arguments for print_command_1.  */
@@ -1342,21 +1343,20 @@ print_command_1 (const char *args, int voidprint)
        {
          try
            {
+             gdbarch *arch = current_inferior ()->arch ();
+
              if (should_validate_memtags (val)
-                 && !gdbarch_memtag_matches_p (target_gdbarch (), val))
+                 && !gdbarch_memtag_matches_p (arch, val))
                {
                  /* Fetch the logical tag.  */
                  struct value *tag
-                   = gdbarch_get_memtag (target_gdbarch (), val,
-                                         memtag_type::logical);
-                 std::string ltag
-                   = gdbarch_memtag_to_string (target_gdbarch (), tag);
+                   = gdbarch_get_memtag (arch, val, memtag_type::logical);
+                 std::string ltag = gdbarch_memtag_to_string (arch, tag);
 
                  /* Fetch the allocation tag.  */
-                 tag = gdbarch_get_memtag (target_gdbarch (), val,
+                 tag = gdbarch_get_memtag (arch, val,
                                            memtag_type::allocation);
-                 std::string atag
-                   = gdbarch_memtag_to_string (target_gdbarch (), tag);
+                 std::string atag = gdbarch_memtag_to_string (arch, tag);
 
                  gdb_printf (_("Logical tag (%s) does not match the "
                                "allocation tag (%s).\n"),
@@ -2977,7 +2977,7 @@ static void
 show_addr_not_tagged (CORE_ADDR address)
 {
   error (_("Address %s not in a region mapped with a memory tagging flag."),
-        paddress (target_gdbarch (), address));
+        paddress (current_inferior ()->arch (), address));
 }
 
 /* Convenience function for error checking in memory-tag commands.  */
@@ -3010,18 +3010,18 @@ memory_tag_print_tag_command (const char *args, enum memtag_type tag_type)
   value_print_options print_opts;
 
   struct value *val = process_print_command_args (args, &print_opts, true);
+  gdbarch *arch = current_inferior ()->arch ();
 
   /* If the address is not in a region memory mapped with a memory tagging
      flag, it is no use trying to access/manipulate its allocation tag.
 
      It is OK to manipulate the logical tag though.  */
   if (tag_type == memtag_type::allocation
-      && !gdbarch_tagged_address_p (target_gdbarch (), val))
+      && !gdbarch_tagged_address_p (arch, val))
     show_addr_not_tagged (value_as_address (val));
 
-  struct value *tag_value
-    = gdbarch_get_memtag (target_gdbarch (), val, tag_type);
-  std::string tag = gdbarch_memtag_to_string (target_gdbarch (), tag_value);
+  value *tag_value = gdbarch_get_memtag (arch, val, tag_type);
+  std::string tag = gdbarch_memtag_to_string (arch, tag_value);
 
   if (tag.empty ())
     gdb_printf (_("%s tag unavailable.\n"),
@@ -3099,6 +3099,7 @@ memory_tag_with_logical_tag_command (const char *args, int from_tty)
   gdb::byte_vector tags;
   struct value *val;
   value_print_options print_opts;
+  gdbarch *arch = current_inferior ()->arch ();
 
   /* Parse the input.  */
   parse_with_logical_tag_input (args, &val, tags, &print_opts);
@@ -3116,12 +3117,11 @@ memory_tag_with_logical_tag_command (const char *args, int from_tty)
      length.  */
 
   /* Cast to (void *).  */
-  val = value_cast (builtin_type (target_gdbarch ())->builtin_data_ptr,
+  val = value_cast (builtin_type (current_inferior ()->arch ())->builtin_data_ptr,
                    val);
 
   /* Length doesn't matter for a logical tag.  Pass 0.  */
-  if (!gdbarch_set_memtags (target_gdbarch (), val, 0, tags,
-                           memtag_type::logical))
+  if (!gdbarch_set_memtags (arch, val, 0, tags,  memtag_type::logical))
     gdb_printf (_("Could not update the logical tag data.\n"));
   else
     {
@@ -3174,7 +3174,7 @@ parse_set_allocation_tag_input (const char *args, struct value **val,
 
   /* If the address is not in a region memory mapped with a memory tagging
      flag, it is no use trying to access/manipulate its allocation tag.  */
-  if (!gdbarch_tagged_address_p (target_gdbarch (), *val))
+  if (!gdbarch_tagged_address_p (current_inferior ()->arch (), *val))
     show_addr_not_tagged (value_as_address (*val));
 }
 
@@ -3197,7 +3197,7 @@ memory_tag_set_allocation_tag_command (const char *args, int from_tty)
   /* Parse the input.  */
   parse_set_allocation_tag_input (args, &val, &length, tags);
 
-  if (!gdbarch_set_memtags (target_gdbarch (), val, length, tags,
+  if (!gdbarch_set_memtags (current_inferior ()->arch (), val, length, tags,
                            memtag_type::allocation))
     gdb_printf (_("Could not update the allocation tag(s).\n"));
   else
@@ -3220,41 +3220,39 @@ memory_tag_check_command (const char *args, int from_tty)
   value_print_options print_opts;
 
   struct value *val = process_print_command_args (args, &print_opts, true);
+  gdbarch *arch = current_inferior ()->arch ();
 
   /* If the address is not in a region memory mapped with a memory tagging
      flag, it is no use trying to access/manipulate its allocation tag.  */
-  if (!gdbarch_tagged_address_p (target_gdbarch (), val))
+  if (!gdbarch_tagged_address_p (arch, val))
     show_addr_not_tagged (value_as_address (val));
 
   CORE_ADDR addr = value_as_address (val);
 
   /* Check if the tag is valid.  */
-  if (!gdbarch_memtag_matches_p (target_gdbarch (), val))
+  if (!gdbarch_memtag_matches_p (arch, val))
     {
-      struct value *tag
-       = gdbarch_get_memtag (target_gdbarch (), val, memtag_type::logical);
-      std::string ltag
-       = gdbarch_memtag_to_string (target_gdbarch (), tag);
+      value *tag = gdbarch_get_memtag (arch, val, memtag_type::logical);
+      std::string ltag = gdbarch_memtag_to_string (arch, tag);
 
-      tag = gdbarch_get_memtag (target_gdbarch (), val,
-                               memtag_type::allocation);
-      std::string atag
-       = gdbarch_memtag_to_string (target_gdbarch (), tag);
+      tag = gdbarch_get_memtag (arch, val, memtag_type::allocation);
+      std::string atag = gdbarch_memtag_to_string (arch, tag);
 
       gdb_printf (_("Logical tag (%s) does not match"
                    " the allocation tag (%s) for address %s.\n"),
                  ltag.c_str (), atag.c_str (),
-                 paddress (target_gdbarch (), addr));
+                 paddress (current_inferior ()->arch (), addr));
     }
   else
     {
       struct value *tag
-       = gdbarch_get_memtag (target_gdbarch (), val, memtag_type::logical);
+       = gdbarch_get_memtag (current_inferior ()->arch (), val,
+                             memtag_type::logical);
       std::string ltag
-       = gdbarch_memtag_to_string (target_gdbarch (), tag);
+       = gdbarch_memtag_to_string (current_inferior ()->arch (), tag);
 
       gdb_printf (_("Memory tags for address %s match (%s).\n"),
-                 paddress (target_gdbarch (), addr), ltag.c_str ());
+                 paddress (current_inferior ()->arch (), addr), ltag.c_str ());
     }
 }
 
index 35cfd9c1cca6a8d0c4f84d59c26ade6a2f16fbe0..f4968ec47019135d00aed67ee6ea62d274bfb068 100644 (file)
@@ -55,7 +55,8 @@ public:
      space.  */
   struct address_space *thread_address_space (ptid_t ptid) override;
 
-  /* This default implementation always returns target_gdbarch ().  */
+  /* This default implementation always returns the current inferior's
+     gdbarch.  */
   struct gdbarch *thread_architecture (ptid_t ptid) override;
 
   /* Default implementations for process_stratum targets.  Return true
index 48e9f3dd4b5f422d6749672098a5a4bcc59fbc1e..0e8a08f99d3091afcab32d56762b05c82800a8a7 100644 (file)
@@ -174,7 +174,7 @@ procfs_target::auxv_parse (const gdb_byte **readptr,
                           const gdb_byte *endptr, CORE_ADDR *typep,
                           CORE_ADDR *valp)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   const gdb_byte *ptr = *readptr;
 
   if (endptr == ptr)
@@ -711,9 +711,10 @@ proc_watchpoint_address (procinfo *pi, CORE_ADDR *addr)
     if (!proc_get_status (pi))
       return 0;
 
-  *addr = (CORE_ADDR) gdbarch_pointer_to_address (target_gdbarch (),
-           builtin_type (target_gdbarch ())->builtin_data_ptr,
-           (gdb_byte *) &pi->prstatus.pr_lwp.pr_info.si_addr);
+  gdbarch *arch = current_inferior ()->arch ();
+  *addr = gdbarch_pointer_to_address
+           (arch, builtin_type (arch)->builtin_data_ptr,
+            (gdb_byte *) &pi->prstatus.pr_lwp.pr_info.si_addr);
   return 1;
 }
 
@@ -1517,12 +1518,12 @@ proc_parent_pid (procinfo *pi)
 static void *
 procfs_address_to_host_pointer (CORE_ADDR addr)
 {
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  gdbarch *arch = current_inferior ()->arch ();
+  type *ptr_type = builtin_type (arch)->builtin_data_ptr;
   void *ptr;
 
   gdb_assert (sizeof (ptr) == ptr_type->length ());
-  gdbarch_address_to_pointer (target_gdbarch (), ptr_type,
-                             (gdb_byte *) &ptr, addr);
+  gdbarch_address_to_pointer (arch, ptr_type, (gdb_byte *) &ptr, addr);
   return ptr;
 }
 
@@ -3013,7 +3014,8 @@ procfs_target::can_use_hw_breakpoint (enum bptype type, int cnt, int othertype)
      procfs_address_to_host_pointer will reveal that an internal error
      will be generated when the host and target pointer sizes are
      different.  */
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
 
   if (sizeof (void *) != ptr_type->length ())
     return 0;
@@ -3061,7 +3063,7 @@ procfs_target::insert_watchpoint (CORE_ADDR addr, int len,
                                  struct expression *cond)
 {
   if (!target_have_steppable_watchpoint ()
-      && !gdbarch_have_nonsteppable_watchpoint (target_gdbarch ()))
+      && !gdbarch_have_nonsteppable_watchpoint (current_inferior ()->arch ()))
     /* When a hardware watchpoint fires off the PC will be left at
        the instruction following the one which caused the
        watchpoint.  It will *NOT* be necessary for GDB to step over
@@ -3224,7 +3226,7 @@ info_mappings_callback (struct prmap *map, find_memory_region_ftype ignore,
 
   pr_off = (unsigned int) map->pr_offset;
 
-  if (gdbarch_addr_bit (target_gdbarch ()) == 32)
+  if (gdbarch_addr_bit (current_inferior ()->arch ()) == 32)
     gdb_printf ("\t%#10lx %#10lx %#10lx %#10x %7s\n",
                (unsigned long) map->pr_vaddr,
                (unsigned long) map->pr_vaddr + map->pr_size - 1,
@@ -3251,7 +3253,7 @@ info_proc_mappings (procinfo *pi, int summary)
     return;    /* No output for summary mode.  */
 
   gdb_printf (_("Mapped address spaces:\n\n"));
-  if (gdbarch_ptr_bit (target_gdbarch ()) == 32)
+  if (gdbarch_ptr_bit (current_inferior ()->arch ()) == 32)
     gdb_printf ("\t%10s %10s %10s %10s %7s\n",
                "Start Addr",
                "  End Addr",
index 1dbcd5875ddbd9ee6cc981ca7e8f6cc3bd7a6865..555fa79ccce8dfb2c22a44893d840f45d87ad215 100644 (file)
@@ -58,7 +58,8 @@ address_space::address_space ()
 struct address_space *
 maybe_new_address_space (void)
 {
-  int shared_aspace = gdbarch_has_shared_address_space (target_gdbarch ());
+  int shared_aspace
+    = gdbarch_has_shared_address_space (current_inferior ()->arch ());
 
   if (shared_aspace)
     {
@@ -121,7 +122,7 @@ program_space::~program_space ()
   /* Defer breakpoint re-set because we don't want to create new
      locations for this pspace which we're tearing down.  */
   clear_symtab_users (SYMFILE_DEFER_BP_RESET);
-  if (!gdbarch_has_shared_address_space (target_gdbarch ()))
+  if (!gdbarch_has_shared_address_space (current_inferior ()->arch ()))
     delete this->aspace;
 }
 
@@ -402,7 +403,8 @@ maintenance_info_program_spaces_command (const char *args, int from_tty)
 void
 update_address_spaces (void)
 {
-  int shared_aspace = gdbarch_has_shared_address_space (target_gdbarch ());
+  int shared_aspace
+    = gdbarch_has_shared_address_space (current_inferior ()->arch ());
 
   init_address_spaces ();
 
@@ -422,7 +424,7 @@ update_address_spaces (void)
       }
 
   for (inferior *inf : all_inferiors ())
-    if (gdbarch_has_global_solist (target_gdbarch ()))
+    if (gdbarch_has_global_solist (current_inferior ()->arch ()))
       inf->aspace = maybe_new_address_space ();
     else
       inf->aspace = inf->pspace->aspace;
index 42a7e0706d2a930973ca209c1e9082d0efce03d5..627eb2975426ea206a20ec1ae4f4a43173173bd8 100644 (file)
@@ -427,7 +427,7 @@ bpfinishpy_handle_stop (struct bpstat *bs, int print_frame)
 static void
 bpfinishpy_handle_exit (struct inferior *inf)
 {
-  gdbpy_enter enter_py (target_gdbarch ());
+  gdbpy_enter enter_py (current_inferior ()->arch ());
 
   for (breakpoint &bp : all_breakpoints_safe ())
     bpfinishpy_detect_out_scope_cb (&bp, nullptr, true);
index 50d20c33b9d97e761adf656b800104877e3b090a..c0bd6a698954261008a687dc41a24fab2f918e0f 100644 (file)
@@ -107,7 +107,7 @@ python_on_resume (ptid_t ptid)
   if (!gdb_python_initialized)
     return;
 
-  gdbpy_enter enter_py (target_gdbarch ());
+  gdbpy_enter enter_py (current_inferior ()->arch ());
 
   if (emit_continue_event (ptid) < 0)
     gdbpy_print_stack ();
@@ -119,7 +119,7 @@ python_on_resume (ptid_t ptid)
 static void
 python_on_inferior_call_pre (ptid_t thread, CORE_ADDR address)
 {
-  gdbpy_enter enter_py (target_gdbarch ());
+  gdbpy_enter enter_py (current_inferior ()->arch ());
 
   if (emit_inferior_call_event (INFERIOR_CALL_PRE, thread, address) < 0)
     gdbpy_print_stack ();
@@ -131,7 +131,7 @@ python_on_inferior_call_pre (ptid_t thread, CORE_ADDR address)
 static void
 python_on_inferior_call_post (ptid_t thread, CORE_ADDR address)
 {
-  gdbpy_enter enter_py (target_gdbarch ());
+  gdbpy_enter enter_py (current_inferior ()->arch ());
 
   if (emit_inferior_call_event (INFERIOR_CALL_POST, thread, address) < 0)
     gdbpy_print_stack ();
@@ -144,7 +144,7 @@ python_on_inferior_call_post (ptid_t thread, CORE_ADDR address)
 static void
 python_on_memory_change (struct inferior *inferior, CORE_ADDR addr, ssize_t len, const bfd_byte *data)
 {
-  gdbpy_enter enter_py (target_gdbarch ());
+  gdbpy_enter enter_py (current_inferior ()->arch ());
 
   if (emit_memory_changed_event (addr, len) < 0)
     gdbpy_print_stack ();
@@ -157,7 +157,7 @@ python_on_memory_change (struct inferior *inferior, CORE_ADDR addr, ssize_t len,
 static void
 python_on_register_change (frame_info_ptr frame, int regnum)
 {
-  gdbpy_enter enter_py (target_gdbarch ());
+  gdbpy_enter enter_py (current_inferior ()->arch ());
 
   if (emit_register_changed_event (frame, regnum) < 0)
     gdbpy_print_stack ();
@@ -171,7 +171,7 @@ python_inferior_exit (struct inferior *inf)
   if (!gdb_python_initialized)
     return;
 
-  gdbpy_enter enter_py (target_gdbarch ());
+  gdbpy_enter enter_py (current_inferior ()->arch ());
 
   if (inf->has_exit_code)
     exit_code = &inf->exit_code;
@@ -202,7 +202,7 @@ python_all_objfiles_removed (program_space *pspace)
   if (!gdb_python_initialized)
     return;
 
-  gdbpy_enter enter_py (target_gdbarch ());
+  gdbpy_enter enter_py (current_inferior ()->arch ());
 
   if (emit_clear_objfiles_event (pspace) < 0)
     gdbpy_print_stack ();
index ad72f3f0423319d1ae4b659ee0f4a8e7847b2b64..bb5d0d92aba847e8d5c7dee609f44196099ce8c2 100644 (file)
@@ -25,6 +25,7 @@
 #include "build-id.h"
 #include "symtab.h"
 #include "python.h"
+#include "inferior.h"
 
 struct objfile_object
 {
@@ -618,7 +619,7 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
   struct objfile *objfile = nullptr;
   if (by_build_id)
     gdbarch_iterate_over_objfiles_in_search_order
-      (target_gdbarch (),
+      (current_inferior ()->arch (),
        [&objfile, name] (struct objfile *obj)
         {
           /* Don't return separate debug files.  */
@@ -641,7 +642,7 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
         }, gdbpy_current_objfile);
   else
     gdbarch_iterate_over_objfiles_in_search_order
-      (target_gdbarch (),
+      (current_inferior ()->arch (),
        [&objfile, name] (struct objfile *obj)
         {
           /* Don't return separate debug files.  */
index 72a5d4f4c625f9dfbf2490dd664fff4d139a3e13..f636ffd0460da6c96f4d071b83ce8a72884036ae 100644 (file)
@@ -28,6 +28,7 @@
 #include "block.h"
 #include "py-event.h"
 #include "observable.h"
+#include "inferior.h"
 
 struct pspace_object
 {
@@ -69,11 +70,11 @@ struct pspace_deleter
        this is one time when the current program space and current inferior
        are not in sync: All inferiors that use PSPACE may no longer exist.
        We don't need to do much here, and since "there is always an inferior"
-       using target_gdbarch suffices.
+       using the current inferior's arch suffices.
        Note: We cannot call get_current_arch because it may try to access
        the target, which may involve accessing data in the pspace currently
        being deleted.  */
-    struct gdbarch *arch = target_gdbarch ();
+    gdbarch *arch = current_inferior ()->arch ();
 
     gdbpy_enter enter_py (arch);
     gdbpy_ref<pspace_object> object (obj);
index 7978f3332c6f60524abfbbb0b4fb5ea6affe5899..822ae18e25eb10c15077e63fc3a77a6094a6557e 100644 (file)
@@ -302,7 +302,7 @@ recpy_bt_insn_decoded (PyObject *self, void *closure)
 
   try
     {
-      gdb_print_insn (target_gdbarch (), insn->pc, &strfile, NULL);
+      gdb_print_insn (current_inferior ()->arch (), insn->pc, &strfile, NULL);
     }
   catch (const gdb_exception &except)
     {
index e56d2463d597f114f3c53dfe50bfbf1cec2a4338..d3dea088c3b81585bf3664cc89404a4b1fd761a8 100644 (file)
@@ -254,7 +254,7 @@ gdbpy_enter::get_gdbarch ()
 void
 gdbpy_enter::finalize ()
 {
-  python_gdbarch = target_gdbarch ();
+  python_gdbarch = current_inferior ()->arch ();
 }
 
 /* A helper class to save and restore the GIL, but without touching
index 68d336bee991495f68d74d7c84bd42148a006d39..3558cfd3875d4ef93b0e2a337c8facfe5b0ef14f 100644 (file)
@@ -383,7 +383,7 @@ get_running_thread_id (int cpu)
   gdb_byte *buf;
   CORE_ADDR object_addr;
   struct type *builtin_type_void_data_ptr
-    = builtin_type (target_gdbarch ())->builtin_data_ptr;
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
 
   if (!object_msym.minsym)
     return 0;
@@ -648,7 +648,8 @@ ravenscar_thread_target::get_fpu_state (struct regcache *regcache,
   if (fpu_context.minsym == nullptr)
     return NO_FP_REGISTERS;
 
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
   ptr_type = lookup_pointer_type (ptr_type);
   value *val = value_from_pointer (ptr_type, fpu_context.value_address ());
 
@@ -874,7 +875,7 @@ ravenscar_inferior_created (inferior *inf)
   const char *err_msg;
 
   if (!ravenscar_task_support
-      || gdbarch_ravenscar_ops (target_gdbarch ()) == NULL
+      || gdbarch_ravenscar_ops (current_inferior ()->arch ()) == NULL
       || !has_ravenscar_runtime ())
     return;
 
index 97447d3e8f88a82ed2b2ddf89b32360f20244f96..abab79f3132cf8bef82e4e35f9e91ec59b65d1dd 100644 (file)
@@ -793,7 +793,7 @@ btrace_insn_history (struct ui_out *uiout,
 
   flags |= DISASSEMBLY_SPECULATIVE;
 
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
   btrace_line_range last_lines = btrace_mk_line_range (NULL, 0, 0);
 
   ui_out_emit_list list_emitter (uiout, "asm_insns");
index faf8b595d22c7d34ce44a5ac3130fd29162b1934..f072bdd7f88210234acb4af50be8b28896ab2ceb 100644 (file)
@@ -640,14 +640,14 @@ record_full_arch_list_add_mem (CORE_ADDR addr, int len)
     gdb_printf (gdb_stdlog,
                "Process record: add mem addr = %s len = %d to "
                "record list.\n",
-               paddress (target_gdbarch (), addr), len);
+               paddress (current_inferior ()->arch (), addr), len);
 
   if (!addr)   /* FIXME: Why?  Some arch must permit it...  */
     return 0;
 
   rec = record_full_mem_alloc (addr, len);
 
-  if (record_read_memory (target_gdbarch (), addr,
+  if (record_read_memory (current_inferior ()->arch (), addr,
                          record_full_get_loc (rec), len))
     {
       record_full_mem_release (rec);
@@ -945,7 +945,7 @@ record_full_open_1 (const char *name, int from_tty)
     error (_("Process record target can't debug inferior in non-stop mode "
             "(non-stop)."));
 
-  if (!gdbarch_process_record_p (target_gdbarch ()))
+  if (!gdbarch_process_record_p (current_inferior ()->arch ()))
     error (_("Process record: the current architecture doesn't support "
             "record function."));
 
@@ -1650,7 +1650,7 @@ record_full_target::xfer_partial (enum target_object object,
          if (!query (_("Because GDB is in replay mode, writing to memory "
                        "will make the execution log unusable from this "
                        "point onward.  Write memory at address %s?"),
-                      paddress (target_gdbarch (), offset)))
+                      paddress (current_inferior ()->arch (), offset)))
            error (_("Process record canceled the operation."));
 
          /* Destroy the record from here forward.  */
@@ -2810,6 +2810,8 @@ maintenance_print_record_instruction (const char *args, int from_tty)
     }
   gdb_assert (to_print != nullptr);
 
+  gdbarch *arch = current_inferior ()->arch ();
+
   /* Go back to the start of the instruction.  */
   while (to_print->prev != nullptr && to_print->prev->type != record_full_end)
     to_print = to_print->prev;
@@ -2825,14 +2827,12 @@ maintenance_print_record_instruction (const char *args, int from_tty)
        {
          case record_full_reg:
            {
-             type *regtype = gdbarch_register_type (target_gdbarch (),
-                                                    to_print->u.reg.num);
+             type *regtype = gdbarch_register_type (arch, to_print->u.reg.num);
              value *val
                  = value_from_contents (regtype,
                                         record_full_get_loc (to_print));
              gdb_printf ("Register %s changed: ",
-                         gdbarch_register_name (target_gdbarch (),
-                                                to_print->u.reg.num));
+                         gdbarch_register_name (arch, to_print->u.reg.num));
              struct value_print_options opts;
              get_user_print_options (&opts);
              opts.raw = true;
@@ -2845,8 +2845,7 @@ maintenance_print_record_instruction (const char *args, int from_tty)
              gdb_byte *b = record_full_get_loc (to_print);
              gdb_printf ("%d bytes of memory at address %s changed from:",
                          to_print->u.mem.len,
-                         print_core_address (target_gdbarch (),
-                                             to_print->u.mem.addr));
+                         print_core_address (arch, to_print->u.mem.addr));
              for (int i = 0; i < to_print->u.mem.len; i++)
                gdb_printf (" %02x", b[i]);
              gdb_printf ("\n");
index 9387cfd44f1e78f0378404313ffd25e617b06a30..5f43895025646b2e02d9fb881c2a24abf1348809 100644 (file)
@@ -24,6 +24,7 @@
 #include "reggroups.h"
 #include "target.h"
 #include "gdbarch.h"
+#include "inferior.h"
 
 /* Dump registers from regcache, used for dumping raw registers and
    cooked registers.  */
@@ -234,7 +235,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump)
   if (target_has_registers ())
     gdbarch = get_current_regcache ()->arch ();
   else
-    gdbarch = target_gdbarch ();
+    gdbarch = current_inferior ()->arch ();
 
   switch (what_to_dump)
     {
@@ -260,8 +261,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump)
            /* For the benefit of "maint print registers" & co when
               debugging an executable, allow dumping a regcache even when
               there is no thread selected / no registers.  */
-           dump.reset (new register_dump_reg_buffer (target_gdbarch (),
-                                                     dump_pseudo));
+           dump.reset (new register_dump_reg_buffer (gdbarch, dump_pseudo));
          }
       }
       break;
index e49375d524add35ec8f58cd8618071f5b41d39f5..518f7c9c5cde2a816718f4c0147e5cd2c3a8e508 100644 (file)
@@ -1053,7 +1053,7 @@ gdbsim_xfer_memory (struct target_ops *target,
                "memaddr %s, len %s\n",
                host_address_to_string (readbuf),
                host_address_to_string (writebuf),
-               paddress (target_gdbarch (), memaddr),
+               paddress (current_inferior ()->arch (), memaddr),
                pulongest (len));
 
   if (writebuf)
index ff3f55d591fde86a7a1ac8fe74002575f5cf55f6..ffe42e4253d0a74e259d0e72fe7a7d88ffb00c97 100644 (file)
@@ -369,9 +369,9 @@ struct packet_reg
   long regnum; /* GDB's internal register number.  */
   LONGEST pnum; /* Remote protocol register number.  */
   int in_g_packet; /* Always part of G packet.  */
-  /* long size in bytes;  == register_size (target_gdbarch (), regnum);
+  /* long size in bytes;  == register_size (arch, regnum);
      at present.  */
-  /* char *name; == gdbarch_register_name (target_gdbarch (), regnum);
+  /* char *name; == gdbarch_register_name (arch, regnum);
      at present.  */
 };
 
@@ -1584,7 +1584,8 @@ remote_target::remote_get_noisy_reply ()
 
          try
            {
-             gdbarch_relocate_instruction (target_gdbarch (), &to, from);
+             gdbarch_relocate_instruction (current_inferior ()->arch (),
+                                           &to, from);
              relocated = 1;
            }
          catch (const gdb_exception &ex)
@@ -1657,7 +1658,7 @@ remote_target::get_remote_state ()
      function which calls getpkt also needs to be mindful of changes
      to rs->buf, but this call limits the number of places which run
      into trouble.  */
-  m_remote_state.get_remote_arch_state (target_gdbarch ());
+  m_remote_state.get_remote_arch_state (current_inferior ()->arch ());
 
   return &m_remote_state;
 }
@@ -1823,7 +1824,8 @@ long
 remote_target::get_remote_packet_size ()
 {
   struct remote_state *rs = get_remote_state ();
-  remote_arch_state *rsa = rs->get_remote_arch_state (target_gdbarch ());
+  remote_arch_state *rsa
+    = rs->get_remote_arch_state (current_inferior ()->arch ());
 
   if (rs->explicit_packet_size)
     return rs->explicit_packet_size;
@@ -1975,7 +1977,8 @@ long
 remote_target::get_memory_packet_size (struct memory_packet_config *config)
 {
   struct remote_state *rs = get_remote_state ();
-  remote_arch_state *rsa = rs->get_remote_arch_state (target_gdbarch ());
+  remote_arch_state *rsa
+    = rs->get_remote_arch_state (current_inferior ()->arch ());
 
   long what_they_get;
   if (config->fixed_p)
@@ -2665,7 +2668,7 @@ remote_target::remote_add_inferior (bool fake_pid_p, int pid, int attached,
   if (attached == -1)
     attached = remote_query_attached (pid);
 
-  if (gdbarch_has_global_solist (target_gdbarch ()))
+  if (gdbarch_has_global_solist (current_inferior ()->arch ()))
     {
       /* If the target shares code across all inferiors, then every
         attach adds a new inferior.  */
@@ -5012,7 +5015,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
 
   /* On OSs where the list of libraries is global to all
      processes, we fetch them early.  */
-  if (gdbarch_has_global_solist (target_gdbarch ()))
+  if (gdbarch_has_global_solist (current_inferior ()->arch ()))
     solib_add (NULL, from_tty, auto_solib_add);
 
   if (target_is_non_stop_p ())
@@ -5138,7 +5141,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
         supported for non-stop; it could be, but it is tricky if
         there are no stopped threads when we connect.  */
       if (remote_read_description_p (this)
-         && gdbarch_target_desc (target_gdbarch ()) == NULL)
+         && gdbarch_target_desc (current_inferior ()->arch ()) == NULL)
        {
          target_clear_description ();
          target_find_description ();
@@ -5343,13 +5346,14 @@ remote_target::remote_check_symbols ()
                   &reply[8]);
       else
        {
-         int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
+         int addr_size = gdbarch_addr_bit (current_inferior ()->arch ()) / 8;
          CORE_ADDR sym_addr = sym.value_address ();
 
          /* If this is a function address, return the start of code
             instead of any data function descriptor.  */
          sym_addr = gdbarch_convert_from_func_ptr_addr
-           (target_gdbarch (), sym_addr, current_inferior ()->top_target ());
+           (current_inferior ()->arch (), sym_addr,
+            current_inferior ()->top_target ());
 
          xsnprintf (msg.data (), get_remote_packet_size (), "qSymbol:%s:%s",
                     phex_nz (sym_addr, addr_size), &reply[8]);
@@ -6143,7 +6147,7 @@ remote_target::remote_detach_1 (inferior *inf, int from_tty)
 
   target_announce_detach (from_tty);
 
-  if (!gdbarch_has_global_breakpoints (target_gdbarch ()))
+  if (!gdbarch_has_global_breakpoints (current_inferior ()->arch ()))
     {
       /* If we're in breakpoints-always-inserted mode, or the inferior
         is running, we have to remove breakpoints before detaching.
@@ -6504,7 +6508,7 @@ remote_target::append_resumption (char *p, char *endp,
 
       if (tp->control.may_range_step)
        {
-         int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
+         int addr_size = gdbarch_addr_bit (current_inferior ()->arch ()) / 8;
 
          p += xsnprintf (p, endp - p, ";r%s,%s",
                          phex_nz (tp->control.step_range_start,
@@ -9024,7 +9028,7 @@ remote_address_masked (CORE_ADDR addr)
 
   /* If "remoteaddresssize" was not set, default to target address size.  */
   if (!address_size)
-    address_size = gdbarch_addr_bit (target_gdbarch ());
+    address_size = gdbarch_addr_bit (current_inferior ()->arch ());
 
   if (address_size > 0
       && address_size < (sizeof (ULONGEST) * 8))
@@ -9537,7 +9541,7 @@ static const int remote_flash_timeout = 1000;
 void
 remote_target::flash_erase (ULONGEST address, LONGEST length)
 {
-  int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
+  int addr_size = gdbarch_addr_bit (current_inferior ()->arch ()) / 8;
   enum packet_result ret;
   scoped_restore restore_timeout
     = make_scoped_restore (&remote_timeout, remote_flash_timeout);
@@ -10709,7 +10713,7 @@ remote_target::insert_breakpoint (struct gdbarch *gdbarch,
 
       /* Make sure the remote is pointing at the right process, if
         necessary.  */
-      if (!gdbarch_has_global_breakpoints (target_gdbarch ()))
+      if (!gdbarch_has_global_breakpoints (current_inferior ()->arch ()))
        set_general_process ();
 
       rs = get_remote_state ();
@@ -10767,7 +10771,7 @@ remote_target::remove_breakpoint (struct gdbarch *gdbarch,
 
       /* Make sure the remote is pointing at the right process, if
         necessary.  */
-      if (!gdbarch_has_global_breakpoints (target_gdbarch ()))
+      if (!gdbarch_has_global_breakpoints (current_inferior ()->arch ()))
        set_general_process ();
 
       *(p++) = 'z';
@@ -10821,7 +10825,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len,
 
   /* Make sure the remote is pointing at the right process, if
      necessary.  */
-  if (!gdbarch_has_global_breakpoints (target_gdbarch ()))
+  if (!gdbarch_has_global_breakpoints (current_inferior ()->arch ()))
     set_general_process ();
 
   xsnprintf (rs->buf.data (), endbuf - rs->buf.data (), "Z%x,", packet);
@@ -10871,7 +10875,7 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len,
 
   /* Make sure the remote is pointing at the right process, if
      necessary.  */
-  if (!gdbarch_has_global_breakpoints (target_gdbarch ()))
+  if (!gdbarch_has_global_breakpoints (current_inferior ()->arch ()))
     set_general_process ();
 
   xsnprintf (rs->buf.data (), endbuf - rs->buf.data (), "z%x,", packet);
@@ -11021,7 +11025,7 @@ remote_target::insert_hw_breakpoint (struct gdbarch *gdbarch,
 
   /* Make sure the remote is pointing at the right process, if
      necessary.  */
-  if (!gdbarch_has_global_breakpoints (target_gdbarch ()))
+  if (!gdbarch_has_global_breakpoints (current_inferior ()->arch ()))
     set_general_process ();
 
   rs = get_remote_state ();
@@ -11078,7 +11082,7 @@ remote_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
 
   /* Make sure the remote is pointing at the right process, if
      necessary.  */
-  if (!gdbarch_has_global_breakpoints (target_gdbarch ()))
+  if (!gdbarch_has_global_breakpoints (current_inferior ()->arch ()))
     set_general_process ();
 
   *(p++) = 'z';
@@ -11202,12 +11206,12 @@ compare_sections_command (const char *args, int from_tty)
 
       if (res == -1)
        error (_("target memory fault, section %s, range %s -- %s"), sectname,
-              paddress (target_gdbarch (), lma),
-              paddress (target_gdbarch (), lma + size));
+              paddress (current_inferior ()->arch (), lma),
+              paddress (current_inferior ()->arch (), lma + size));
 
       gdb_printf ("Section %s, range %s -- %s: ", sectname,
-                 paddress (target_gdbarch (), lma),
-                 paddress (target_gdbarch (), lma + size));
+                 paddress (current_inferior ()->arch (), lma),
+                 paddress (current_inferior ()->arch (), lma + size));
       if (res)
        gdb_printf ("matched.\n");
       else
@@ -11365,7 +11369,8 @@ remote_target::xfer_partial (enum target_object object,
   int i;
   char *p2;
   char query_type;
-  int unit_size = gdbarch_addressable_memory_unit_size (target_gdbarch ());
+  int unit_size
+    = gdbarch_addressable_memory_unit_size (current_inferior ()->arch ());
 
   set_remote_traceframe ();
   set_general_thread (inferior_ptid);
@@ -11561,7 +11566,7 @@ remote_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
                              const gdb_byte *pattern, ULONGEST pattern_len,
                              CORE_ADDR *found_addrp)
 {
-  int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
+  int addr_size = gdbarch_addr_bit (current_inferior ()->arch ()) / 8;
   struct remote_state *rs = get_remote_state ();
   int max_size = get_memory_write_packet_size ();
 
@@ -12151,7 +12156,7 @@ register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
 static bool
 remote_read_description_p (struct target_ops *target)
 {
-  struct remote_g_packet_data *data = get_g_packet_data (target_gdbarch ());
+  remote_g_packet_data *data = get_g_packet_data (current_inferior ()->arch ());
 
   return !data->guesses.empty ();
 }
@@ -12159,7 +12164,7 @@ remote_read_description_p (struct target_ops *target)
 const struct target_desc *
 remote_target::read_description ()
 {
-  struct remote_g_packet_data *data = get_g_packet_data (target_gdbarch ());
+  remote_g_packet_data *data = get_g_packet_data (current_inferior ()->arch ());
 
   /* Do not try this during initial connection, when we do not know
      whether there is a running but stopped thread.  */
@@ -13637,7 +13642,7 @@ remote_target::get_trace_status (struct trace_status *ts)
 
   /* FIXME we need to get register block size some other way.  */
   trace_regblock_size
-    = rs->get_remote_arch_state (target_gdbarch ())->sizeof_g_packet;
+    = rs->get_remote_arch_state (current_inferior ()->arch ())->sizeof_g_packet;
 
   putpkt ("qTStatus");
 
@@ -15142,7 +15147,7 @@ static void
 create_fetch_memtags_request (gdb::char_vector &packet, CORE_ADDR address,
                              size_t len, int type)
 {
-  int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
+  int addr_size = gdbarch_addr_bit (current_inferior ()->arch ()) / 8;
 
   std::string request = string_printf ("qMemTags:%s,%s:%s",
                                       phex_nz (address, addr_size),
@@ -15176,7 +15181,7 @@ create_store_memtags_request (gdb::char_vector &packet, CORE_ADDR address,
                              size_t len, int type,
                              const gdb::byte_vector &tags)
 {
-  int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
+  int addr_size = gdbarch_addr_bit (current_inferior ()->arch ()) / 8;
 
   /* Put together the main packet, address and length.  */
   std::string request = string_printf ("QMemTags:%s,%s:%s:",
index d01d1fdf0cd0b39d06755dd70d370030790d6da2..2f40fbddaa1e03266144c8a9cc5febd4154fe6f1 100644 (file)
@@ -35,6 +35,7 @@
 #include "dwarf2/frame.h"
 #include "reggroups.h"
 #include "gdbarch.h"
+#include "inferior.h"
 
 #include "elf/rl78.h"
 #include "elf-bfd.h"
@@ -897,7 +898,7 @@ check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size,
   if (value.kind == pvk_register
       && value.k == 0
       && pv_is_register (addr, RL78_SP_REGNUM)
-      && size == register_size (target_gdbarch (), value.reg))
+      && size == register_size (current_inferior ()->arch (), value.reg))
     result->reg_offset[value.reg] = addr.k;
 }
 
@@ -922,7 +923,8 @@ rl78_analyze_prologue (CORE_ADDR start_pc,
       result->reg_offset[rn] = 1;
     }
 
-  pv_area stack (RL78_SP_REGNUM, gdbarch_addr_bit (target_gdbarch ()));
+  pv_area stack (RL78_SP_REGNUM,
+                gdbarch_addr_bit (current_inferior ()->arch ()));
 
   /* The call instruction has saved the return address on the stack.  */
   reg[RL78_SP_REGNUM] = pv_add_constant (reg[RL78_SP_REGNUM], -4);
index e28a0e71f810c27ec1eb12b0934698dc3ebf3c97..b7a34e0bf5fd5d783af34ec9de9a7157c2ae98bd 100644 (file)
@@ -77,7 +77,7 @@
 #ifndef ARCH3264
 # define ARCH64() 0
 #else
-# define ARCH64() (register_size (target_gdbarch (), 0) == 8)
+# define ARCH64() (register_size (current_inferior ()->arch (), 0) == 8)
 #endif
 
 class rs6000_nat_target final : public inf_ptrace_target
@@ -1040,7 +1040,8 @@ rs6000_nat_target::xfer_shared_libraries
     return TARGET_XFER_E_IO;
 
   gdb::byte_vector ldi_buf = rs6000_ptrace_ldinfo (inferior_ptid);
-  result = rs6000_aix_ld_info_to_xml (target_gdbarch (), ldi_buf.data (),
+  result = rs6000_aix_ld_info_to_xml (current_inferior ()->arch (),
+                                     ldi_buf.data (),
                                      readbuf, offset, len, 1);
 
   if (result == 0)
index 4b3348d8ca6c9bf69256ddd1643eb89f888c7c00..d2f6008026f07f0a5449d92dd11e20c3135c62f1 100644 (file)
@@ -30,6 +30,7 @@
 #include "value.h"
 #include "gdbarch.h"
 #include "rust-exp.h"
+#include "inferior.h"
 
 using namespace expr;
 
@@ -2309,8 +2310,8 @@ static void
 rust_lex_tests (void)
 {
   /* Set up dummy "parser", so that rust_type works.  */
-  struct parser_state ps (language_def (language_rust), target_gdbarch (),
-                         nullptr, 0, 0, nullptr, 0, nullptr);
+  parser_state ps (language_def (language_rust), current_inferior ()->arch (),
+                  nullptr, 0, 0, nullptr, 0, nullptr);
   rust_parser parser (&ps);
 
   rust_lex_test_one (&parser, "", 0);
index 7bd469d51851356e942551e9c441f74fa9065468..87f1afd7a66a72a0394efa8cae817dd1a807cc88 100644 (file)
@@ -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)
     {
index 8f54e9f63224e4d0ba477c814a10301adc1ec8ad..0aa3edea8aa0f73001b17014d1a446567c8a699b 100644 (file)
@@ -966,7 +966,7 @@ s390_linux_nat_target::auxv_parse (const gdb_byte **readptr,
                                   CORE_ADDR *valp)
 {
   int sizeof_auxv_field = s390_target_wordsize ();
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   const gdb_byte *ptr = *readptr;
 
   if (endptr == ptr)
index c152b44dea63bff1f3f191007a9b6f508f36cb08..537acdb57548341955eea5e618140d2c784e54e8 100644 (file)
@@ -847,7 +847,7 @@ 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, target_gdbarch ());
+                               ptid, current_inferior ()->arch ());
 
   target_fetch_registers (regcache, -1);
   fill_gregset (regcache, (gdb_gregset_t *) gregset, -1);
@@ -864,7 +864,7 @@ ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid,
   ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (current_inferior ()->process_target (),
-                               ptid, target_gdbarch ());
+                               ptid, current_inferior ()->arch ());
 
   supply_gregset (regcache, (const gdb_gregset_t *) gregset);
   target_store_registers (regcache, -1);
@@ -917,7 +917,7 @@ ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
   ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (current_inferior ()->process_target (),
-                               ptid, target_gdbarch ());
+                               ptid, current_inferior ()->arch ());
 
   target_fetch_registers (regcache, -1);
   fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1);
@@ -934,7 +934,7 @@ ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
   ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
   struct regcache *regcache
     = get_thread_arch_regcache (current_inferior ()->process_target (),
-                               ptid, target_gdbarch ());
+                               ptid, current_inferior ()->arch ());
 
   supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset);
   target_store_registers (regcache, -1);
@@ -1079,7 +1079,8 @@ info_cb (const td_thrhandle_t *th, void *s)
          gdb_printf ("   startfunc=%s",
                      msym.minsym
                      ? msym.minsym->print_name ()
-                     : paddress (target_gdbarch (), ti.ti_startfunc));
+                     : paddress (current_inferior ()->arch (),
+                                 ti.ti_startfunc));
        }
 
       /* If thread is asleep, print function that went to sleep.  */
@@ -1091,7 +1092,7 @@ info_cb (const td_thrhandle_t *th, void *s)
          gdb_printf ("   sleepfunc=%s",
                      msym.minsym
                      ? msym.minsym->print_name ()
-                     : paddress (target_gdbarch (), ti.ti_pc));
+                     : paddress (current_inferior ()->arch (), ti.ti_pc));
        }
 
       gdb_printf ("\n");
index 1dacc7ba6a50d96454a4c79b1d1af38f2f3a4102..98c81bb3bdaabe0aabd7d4297caf61ab4c6aa258 100644 (file)
@@ -105,8 +105,9 @@ static void
 darwin_load_image_infos (struct darwin_info *info)
 {
   gdb_byte buf[24];
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
   int len;
 
   /* If the structure address is not known, don't continue.  */
@@ -216,7 +217,8 @@ open_symbol_file_object (int from_tty)
 static struct so_list *
 darwin_current_sos (void)
 {
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
   enum bfd_endian byte_order = type_byte_order (ptr_type);
   int ptr_len = ptr_type->length ();
   unsigned int image_info_size;
@@ -299,7 +301,7 @@ darwin_current_sos (void)
 static CORE_ADDR
 darwin_validate_exec_header (CORE_ADDR load_addr)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   struct mach_o_header_external hdr;
   unsigned long hdr_val;
 
@@ -329,7 +331,8 @@ darwin_validate_exec_header (CORE_ADDR load_addr)
 static CORE_ADDR
 darwin_read_exec_load_addr_from_dyld (struct darwin_info *info)
 {
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
   int ptr_len = ptr_type->length ();
   unsigned int image_info_size = ptr_len * 3;
   int i;
@@ -359,7 +362,7 @@ darwin_read_exec_load_addr_from_dyld (struct darwin_info *info)
 static CORE_ADDR
 darwin_read_exec_load_addr_at_init (struct darwin_info *info)
 {
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int addr_size = gdbarch_addr_bit (gdbarch) / 8;
   ULONGEST load_ptr_addr;
@@ -432,8 +435,9 @@ darwin_get_dyld_bfd ()
   if (dyld_bfd != NULL)
     {
       gdb_bfd_ref_ptr sub
-       (gdb_bfd_mach_o_fat_extract (dyld_bfd.get (), bfd_object,
-                                    gdbarch_bfd_arch_info (target_gdbarch ())));
+       (gdb_bfd_mach_o_fat_extract
+          (dyld_bfd.get (), bfd_object,
+           gdbarch_bfd_arch_info (current_inferior ()->arch ())));
       dyld_bfd = sub;
     }
   return dyld_bfd;
@@ -475,7 +479,8 @@ darwin_solib_read_all_image_info_addr (struct darwin_info *info)
 {
   gdb_byte buf[8];
   LONGEST len;
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
 
   /* Sanity check.  */
   if (ptr_type->length () > sizeof (buf))
@@ -592,7 +597,7 @@ darwin_solib_create_inferior_hook (int from_tty)
   /* Add the breakpoint which is hit by dyld when the list of solib is
      modified.  */
   if (notifier != 0)
-    create_solib_event_breakpoint (target_gdbarch (), notifier);
+    create_solib_event_breakpoint (current_inferior ()->arch (), notifier);
 }
 
 static void
@@ -652,8 +657,9 @@ darwin_bfd_open (const char *pathname)
   gdb_bfd_ref_ptr abfd (solib_bfd_fopen (found_pathname.get (), found_file));
 
   gdb_bfd_ref_ptr res
-    (gdb_bfd_mach_o_fat_extract (abfd.get (), bfd_object,
-                                gdbarch_bfd_arch_info (target_gdbarch ())));
+    (gdb_bfd_mach_o_fat_extract
+       (abfd.get (), bfd_object,
+       gdbarch_bfd_arch_info (current_inferior ()->arch ())));
   if (res == NULL)
     error (_("`%s': not a shared-library: %s"),
           bfd_get_filename (abfd.get ()), bfd_errmsg (bfd_get_error ()));
index e0aa7f13c032259ea53575e48129adb88a3b057f..c29b2b81b1137fef821149b0fd09012edce4b2a9 100644 (file)
@@ -197,14 +197,16 @@ dsbt_print_loadmap (struct int_elf32_dsbt_loadmap *map)
 
       for (i = 0; i < map->nsegs; i++)
        gdb_printf ("%s:%s -> %s:%s\n",
-                   print_core_address (target_gdbarch (),
+                   print_core_address (current_inferior ()->arch (),
                                        map->segs[i].p_vaddr),
-                   print_core_address (target_gdbarch (),
-                                       map->segs[i].p_vaddr
-                                       + map->segs[i].p_memsz),
-                   print_core_address (target_gdbarch (), map->segs[i].addr),
-                   print_core_address (target_gdbarch (), map->segs[i].addr
-                                       + map->segs[i].p_memsz));
+                   print_core_address (current_inferior ()->arch (),
+                                       (map->segs[i].p_vaddr
+                                        + map->segs[i].p_memsz)),
+                   print_core_address (current_inferior ()->arch (),
+                                       map->segs[i].addr),
+                   print_core_address (current_inferior ()->arch (),
+                                       (map->segs[i].addr
+                                        + map->segs[i].p_memsz)));
     }
 }
 
@@ -213,7 +215,7 @@ dsbt_print_loadmap (struct int_elf32_dsbt_loadmap *map)
 static struct int_elf32_dsbt_loadmap *
 decode_loadmap (const gdb_byte *buf)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   const struct ext_elf32_dsbt_loadmap *ext_ldmbuf;
   struct int_elf32_dsbt_loadmap *int_ldmbuf;
 
@@ -313,7 +315,7 @@ dsbt_get_initial_loadmaps (void)
 static struct int_elf32_dsbt_loadmap *
 fetch_loadmap (CORE_ADDR ldmaddr)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   struct ext_elf32_dsbt_loadmap ext_ldmbuf_partial;
   struct ext_elf32_dsbt_loadmap *ext_ldmbuf;
   struct int_elf32_dsbt_loadmap *int_ldmbuf;
@@ -436,7 +438,7 @@ displacement_from_map (struct int_elf32_dsbt_loadmap *map,
 static CORE_ADDR
 lm_base (void)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   struct bound_minimal_symbol got_sym;
   CORE_ADDR addr;
   gdb_byte buf[TIC6X_PTR_SIZE];
@@ -518,7 +520,7 @@ lm_base (void)
 static struct so_list *
 dsbt_current_sos (void)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   CORE_ADDR lm_addr;
   struct so_list *sos_head = NULL;
   struct so_list **sos_next_ptr = &sos_head;
@@ -771,7 +773,7 @@ enable_break (void)
                        hex_string_custom (addr, 8));
 
          /* Now (finally!) create the solib breakpoint.  */
-         create_solib_event_breakpoint (target_gdbarch (), addr);
+         create_solib_event_breakpoint (current_inferior ()->arch (), addr);
 
          ret = 1;
        }
index 152168c6edc7ee58b2b95d8a421a28a447d3cb35..d4e84a1b528d0f3d5999a3b722440dcf781b8740 100644 (file)
@@ -26,6 +26,7 @@
 #include "symtab.h"
 #include "elf/frv.h"
 #include "gdb_bfd.h"
+#include "inferior.h"
 
 /* FR-V pointers are four bytes wide.  */
 enum { FRV_PTR_SIZE = 4 };
@@ -89,7 +90,7 @@ struct int_elf32_fdpic_loadmap {
 static struct int_elf32_fdpic_loadmap *
 fetch_loadmap (CORE_ADDR ldmaddr)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   struct ext_elf32_fdpic_loadmap ext_ldmbuf_partial;
   struct ext_elf32_fdpic_loadmap *ext_ldmbuf;
   struct int_elf32_fdpic_loadmap *int_ldmbuf;
@@ -262,7 +263,7 @@ static CORE_ADDR main_lm_addr = 0;
 static CORE_ADDR
 lm_base (void)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   struct bound_minimal_symbol got_sym;
   CORE_ADDR addr;
   gdb_byte buf[FRV_PTR_SIZE];
@@ -308,7 +309,7 @@ lm_base (void)
 static struct so_list *
 frv_current_sos (void)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   CORE_ADDR lm_addr, mgot;
   struct so_list *sos_head = NULL;
   struct so_list **sos_next_ptr = &sos_head;
@@ -495,7 +496,7 @@ static int enable_break2_done = 0;
 static int
 enable_break2 (void)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   asection *interp_sect;
 
   if (enable_break2_done)
@@ -548,7 +549,7 @@ enable_break2 (void)
          return 0;
        }
 
-      status = frv_fdpic_loadmap_addresses (target_gdbarch (),
+      status = frv_fdpic_loadmap_addresses (current_inferior ()->arch (),
                                            &interp_loadmap_addr, 0);
       if (status < 0)
        {
@@ -665,7 +666,7 @@ enable_break2 (void)
       remove_solib_event_breakpoints ();
 
       /* Now (finally!) create the solib breakpoint.  */
-      create_solib_event_breakpoint (target_gdbarch (), addr);
+      create_solib_event_breakpoint (current_inferior ()->arch (), addr);
 
       enable_break2_done = 1;
 
@@ -709,7 +710,7 @@ enable_break (void)
       return 0;
     }
 
-  create_solib_event_breakpoint (target_gdbarch (), entry_point);
+  create_solib_event_breakpoint (current_inferior ()->arch (), entry_point);
 
   solib_debug_printf ("solib event breakpoint placed at entry point: %s",
                      hex_string_custom (entry_point, 8));
@@ -724,7 +725,7 @@ frv_relocate_main_executable (void)
   struct int_elf32_fdpic_loadmap *ldm;
   int changed;
 
-  status = frv_fdpic_loadmap_addresses (target_gdbarch (),
+  status = frv_fdpic_loadmap_addresses (current_inferior ()->arch (),
                                        &interp_addr, &exec_addr);
 
   if (status < 0 || (exec_addr == 0 && interp_addr == 0))
@@ -943,7 +944,7 @@ find_canonical_descriptor_in_load_object
   (CORE_ADDR entry_point, CORE_ADDR got_value, const char *name, bfd *abfd,
    lm_info_frv *lm)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   arelent *rel;
   unsigned int i;
   CORE_ADDR addr = 0;
index 521e08c3c938c63fee6c51a552dbc96f999e57e6..7bc6ca45c373e36c938f0304c2c579fd9d62b73a 100644 (file)
@@ -197,10 +197,11 @@ lm_info_read (CORE_ADDR lm_addr)
 
   if (target_read_memory (lm_addr, lm.data (), lmo->link_map_size) != 0)
     warning (_("Error reading shared library list entry at %s"),
-            paddress (target_gdbarch (), lm_addr));
+            paddress (current_inferior ()->arch (), lm_addr));
   else
     {
-      struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+      type *ptr_type
+       = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
 
       lm_info.reset (new lm_info_svr4);
       lm_info->lm_addr = lm_addr;
@@ -304,7 +305,7 @@ lm_addr_check (const struct so_list *so, bfd *abfd)
              if (info_verbose)
                gdb_printf (_("Using PIC (Position Independent Code) "
                              "prelink displacement %s for \"%s\".\n"),
-                           paddress (target_gdbarch (), l_addr),
+                           paddress (current_inferior ()->arch (), l_addr),
                            so->so_name);
            }
          else
@@ -455,7 +456,7 @@ static int match_main (const char *);
 static gdb::optional<gdb::byte_vector>
 read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   CORE_ADDR at_phdr, at_phent, at_phnum, pt_phdr = 0;
   int arch_size, sect_size;
   CORE_ADDR sect_addr;
@@ -623,7 +624,7 @@ static int
 scan_dyntag_auxv (const int desired_dyntag, CORE_ADDR *ptr,
                  CORE_ADDR *ptr_addr)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
   int arch_size, step;
   long current_dyntag;
   CORE_ADDR dyn_ptr;
@@ -706,7 +707,8 @@ elf_locate_base (void)
                               &dyn_ptr, NULL)
       || scan_dyntag_auxv (DT_MIPS_RLD_MAP, &dyn_ptr, NULL))
     {
-      struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+      type *ptr_type
+       = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
       gdb_byte *pbuf;
       int pbuf_size = ptr_type->length ();
 
@@ -726,7 +728,8 @@ elf_locate_base (void)
                               &dyn_ptr, &dyn_ptr_addr)
       || scan_dyntag_auxv (DT_MIPS_RLD_MAP_REL, &dyn_ptr, &dyn_ptr_addr))
     {
-      struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+      type *ptr_type
+       = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
       gdb_byte *pbuf;
       int pbuf_size = ptr_type->length ();
 
@@ -767,7 +770,8 @@ static CORE_ADDR
 solib_svr4_r_map (CORE_ADDR debug_base)
 {
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
   CORE_ADDR addr = 0;
 
   try
@@ -789,7 +793,8 @@ static CORE_ADDR
 solib_svr4_r_brk (struct svr4_info *info)
 {
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
 
   return read_memory_typed_address (info->debug_base + lmo->r_brk_offset,
                                    ptr_type);
@@ -802,7 +807,8 @@ static CORE_ADDR
 solib_svr4_r_ldsomap (struct svr4_info *info)
 {
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
   enum bfd_endian byte_order = type_byte_order (ptr_type);
   ULONGEST version = 0;
 
@@ -832,7 +838,8 @@ static CORE_ADDR
 solib_svr4_r_next (CORE_ADDR debug_base)
 {
   link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
-  type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
   bfd_endian byte_order = type_byte_order (ptr_type);
   ULONGEST version = 0;
 
@@ -892,7 +899,8 @@ open_symbol_file_object (int from_tty)
 {
   CORE_ADDR lm, l_name;
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
-  struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+  type *ptr_type
+    = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
   int l_name_size = ptr_type->length ();
   gdb::byte_vector l_name_buf (l_name_size);
   struct svr4_info *info = get_svr4_info (current_program_space);
@@ -1287,8 +1295,8 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
       if (li->l_prev != prev_lm)
        {
          warning (_("Corrupted shared library list: %s != %s"),
-                  paddress (target_gdbarch (), prev_lm),
-                  paddress (target_gdbarch (), li->l_prev));
+                  paddress (current_inferior ()->arch (), prev_lm),
+                  paddress (current_inferior ()->arch (), li->l_prev));
          return 0;
        }
 
@@ -1516,7 +1524,7 @@ svr4_current_sos (void)
   /* Filter out the vDSO module, if present.  Its symbol file would
      not be found on disk.  The vDSO/vsyscall's OBJFILE is instead
      managed by symfile-mem.c:add_vsyscall_page.  */
-  if (gdbarch_vsyscall_range (target_gdbarch (), &vsyscall_range)
+  if (gdbarch_vsyscall_range (current_inferior ()->arch (), &vsyscall_range)
       && vsyscall_range.length != 0)
     {
       struct so_list **sop;
@@ -1663,10 +1671,10 @@ exec_entry_point (struct bfd *abfd, struct target_ops *targ)
      gdbarch_convert_from_func_ptr_addr().  The method
      gdbarch_convert_from_func_ptr_addr() is the merely the identify
      function for targets which don't use function descriptors.  */
-  addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
+  addr = gdbarch_convert_from_func_ptr_addr (current_inferior ()->arch (),
                                             bfd_get_start_address (abfd),
                                             targ);
-  return gdbarch_addr_bits_remove (target_gdbarch (), addr);
+  return gdbarch_addr_bits_remove (current_inferior ()->arch (), addr);
 }
 
 /* A probe and its associated action.  */
@@ -2358,9 +2366,10 @@ enable_break (struct svr4_info *info, int from_tty)
       struct obj_section *os;
 
       sym_addr = gdbarch_addr_bits_remove
-       (target_gdbarch (),
+       (current_inferior ()->arch (),
         gdbarch_convert_from_func_ptr_addr
-          (target_gdbarch (), sym_addr, current_inferior ()->top_target ()));
+          (current_inferior ()->arch (), sym_addr,
+           current_inferior ()->top_target ()));
 
       /* On at least some versions of Solaris there's a dynamic relocation
         on _r_debug.r_brk and SYM_ADDR may not be relocated yet, e.g., if
@@ -2409,7 +2418,8 @@ enable_break (struct svr4_info *info, int from_tty)
                = info->interp_plt_sect_low + bfd_section_size (interp_sect);
            }
 
-         svr4_create_solib_event_breakpoints (info, target_gdbarch (), sym_addr);
+         svr4_create_solib_event_breakpoints
+           (info, current_inferior ()->arch (), sym_addr);
          return 1;
        }
     }
@@ -2471,7 +2481,7 @@ enable_break (struct svr4_info *info, int from_tty)
       if (!load_addr_found)
        if (target_auxv_search (AT_BASE, &load_addr) > 0)
          {
-           int addr_bit = gdbarch_addr_bit (target_gdbarch ());
+           int addr_bit = gdbarch_addr_bit (current_inferior ()->arch ());
 
            /* Ensure LOAD_ADDR has proper sign in its possible upper bits so
               that `+ load_addr' will overflow CORE_ADDR width not creating
@@ -2508,7 +2518,8 @@ enable_break (struct svr4_info *info, int from_tty)
        {
          struct regcache *regcache
            = get_thread_arch_regcache (current_inferior ()->process_target (),
-                                       inferior_ptid, target_gdbarch ());
+                                       inferior_ptid,
+                                       current_inferior ()->arch ());
 
          load_addr = (regcache_read_pc (regcache)
                       - exec_entry_point (tmp_bfd.get (),
@@ -2562,13 +2573,14 @@ enable_break (struct svr4_info *info, int from_tty)
        /* Convert 'sym_addr' from a function pointer to an address.
           Because we pass tmp_bfd_target instead of the current
           target, this will always produce an unrelocated value.  */
-       sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
-                                                      sym_addr,
-                                                      tmp_bfd_target.get ());
+       sym_addr = gdbarch_convert_from_func_ptr_addr
+                    (current_inferior ()->arch (), sym_addr,
+                     tmp_bfd_target.get ());
 
       if (sym_addr != 0)
        {
-         svr4_create_solib_event_breakpoints (info, target_gdbarch (),
+         svr4_create_solib_event_breakpoints (info,
+                                              current_inferior ()->arch (),
                                               load_addr + sym_addr);
          return 1;
        }
@@ -2593,8 +2605,10 @@ enable_break (struct svr4_info *info, int from_tty)
        {
          sym_addr = msymbol.value_address ();
          sym_addr = gdbarch_convert_from_func_ptr_addr
-           (target_gdbarch (), sym_addr, current_inferior ()->top_target ());
-         svr4_create_solib_event_breakpoints (info, target_gdbarch (),
+           (current_inferior ()->arch (), sym_addr,
+            current_inferior ()->top_target ());
+         svr4_create_solib_event_breakpoints (info,
+                                              current_inferior ()->arch (),
                                               sym_addr);
          return 1;
        }
@@ -2610,10 +2624,10 @@ enable_break (struct svr4_info *info, int from_tty)
            {
              sym_addr = msymbol.value_address ();
              sym_addr = gdbarch_convert_from_func_ptr_addr
-               (target_gdbarch (), sym_addr,
+               (current_inferior ()->arch (), sym_addr,
                 current_inferior ()->top_target ());
-             svr4_create_solib_event_breakpoints (info, target_gdbarch (),
-                                                  sym_addr);
+             svr4_create_solib_event_breakpoints
+               (info, current_inferior ()->arch (), sym_addr);
              return 1;
            }
        }
@@ -2742,7 +2756,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
        = read_program_headers_from_bfd (current_program_space->exec_bfd ());
       if (phdrs_target && phdrs_binary)
        {
-         enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+         bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
 
          /* We are dealing with three different addresses.  EXEC_BFD
             represents current address in on-disk file.  target memory content
@@ -3050,7 +3064,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
 
       gdb_printf (_("Using PIE (Position Independent Executable) "
                    "displacement %s for \"%s\".\n"),
-                 paddress (target_gdbarch (), exec_displacement),
+                 paddress (current_inferior ()->arch (), exec_displacement),
                  bfd_get_filename (current_program_space->exec_bfd ()));
     }
 
@@ -3192,12 +3206,12 @@ svr4_clear_solib (void)
 static CORE_ADDR
 svr4_truncate_ptr (CORE_ADDR addr)
 {
-  if (gdbarch_ptr_bit (target_gdbarch ()) == sizeof (CORE_ADDR) * 8)
+  if (gdbarch_ptr_bit (current_inferior ()->arch ()) == sizeof (CORE_ADDR) * 8)
     /* We don't need to truncate anything, and the bit twiddling below
        will fail due to overflow problems.  */
     return addr;
   else
-    return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (target_gdbarch ())) - 1);
+    return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (current_inferior ()->arch ())) - 1);
 }
 
 
@@ -3256,7 +3270,7 @@ set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
 static struct link_map_offsets *
 svr4_fetch_link_map_offsets (void)
 {
-  struct solib_svr4_ops *ops = get_ops (target_gdbarch ());
+  struct solib_svr4_ops *ops = get_ops (current_inferior ()->arch ());
 
   gdb_assert (ops->fetch_link_map_offsets);
   return ops->fetch_link_map_offsets ();
@@ -3267,7 +3281,7 @@ svr4_fetch_link_map_offsets (void)
 static int
 svr4_have_link_map_offsets (void)
 {
-  struct solib_svr4_ops *ops = get_ops (target_gdbarch ());
+  struct solib_svr4_ops *ops = get_ops (current_inferior ()->arch ());
 
   return (ops->fetch_link_map_offsets != NULL);
 }
index 5280e5ffefd7ec8c0b3e5099038473f8fa43c647..a2a8a031f343b98b24a0fa4c95c526dbd1e96124 100644 (file)
@@ -111,7 +111,7 @@ show_solib_search_path (struct ui_file *file, int from_tty,
 static gdb::unique_xmalloc_ptr<char>
 solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
 {
-  const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
   int found_file = -1;
   gdb::unique_xmalloc_ptr<char> temp_pathname;
   const char *fskind = effective_target_file_system_kind ();
@@ -384,7 +384,7 @@ gdb::unique_xmalloc_ptr<char>
 solib_find (const char *in_pathname, int *fd)
 {
   const char *solib_symbols_extension
-    = gdbarch_solib_symbols_extension (target_gdbarch ());
+    = gdbarch_solib_symbols_extension (current_inferior ()->arch ());
 
   /* If solib_symbols_extension is set, replace the file's
      extension.  */
@@ -464,7 +464,7 @@ solib_bfd_open (const char *pathname)
           bfd_get_filename (abfd.get ()), bfd_errmsg (bfd_get_error ()));
 
   /* Check bfd arch.  */
-  b = gdbarch_bfd_arch_info (target_gdbarch ());
+  b = gdbarch_bfd_arch_info (current_inferior ()->arch ());
   if (!b->compatible (b, bfd_get_arch_info (abfd.get ())))
     error (_("`%s': Shared library architecture %s is not compatible "
             "with target architecture %s."), bfd_get_filename (abfd.get ()),
@@ -539,7 +539,7 @@ get_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, const char *soname)
 static int
 solib_map_sections (struct so_list *so)
 {
-  const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
   gdb::unique_xmalloc_ptr<char> filename (tilde_expand (so->so_name));
   gdb_bfd_ref_ptr abfd (ops->bfd_open (filename.get ()));
@@ -633,7 +633,7 @@ solib_map_sections (struct so_list *so)
 static void
 clear_so (struct so_list *so)
 {
-  const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
   delete so->sections;
   so->sections = NULL;
@@ -670,7 +670,7 @@ clear_so (struct so_list *so)
 void
 free_so (struct so_list *so)
 {
-  const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
   clear_so (so);
   ops->free_so (so);
@@ -774,7 +774,7 @@ notify_solib_unloaded (program_space *pspace, so_list *so)
 void
 update_solib_list (int from_tty)
 {
-  const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
   struct so_list *inferior = ops->current_sos();
   struct so_list *gdb, **gdb_link;
 
@@ -1077,7 +1077,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
   bool so_missing_debug_info = false;
   int addr_width;
   int nr_libs;
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
   struct ui_out *uiout = current_uiout;
 
   if (pattern)
@@ -1213,7 +1213,7 @@ solib_name_from_address (struct program_space *pspace, CORE_ADDR address)
 bool
 solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
 {
-  const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
   if (ops->keep_data_in_core)
     return ops->keep_data_in_core (vaddr, size) != 0;
@@ -1226,7 +1226,7 @@ solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
 void
 clear_solib (void)
 {
-  const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
   disable_breakpoints_in_shlibs ();
 
@@ -1251,7 +1251,7 @@ clear_solib (void)
 void
 solib_create_inferior_hook (int from_tty)
 {
-  const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
   ops->solib_create_inferior_hook (from_tty);
 }
@@ -1261,7 +1261,7 @@ solib_create_inferior_hook (int from_tty)
 bool
 in_solib_dynsym_resolve_code (CORE_ADDR pc)
 {
-  const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
   return ops->in_dynsym_resolve_code (pc) != 0;
 }
@@ -1297,7 +1297,7 @@ no_shared_libraries (const char *ignored, int from_tty)
 void
 update_solib_breakpoints (void)
 {
-  const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
   if (ops->update_breakpoints != NULL)
     ops->update_breakpoints ();
@@ -1308,7 +1308,7 @@ update_solib_breakpoints (void)
 void
 handle_solib_event (void)
 {
-  const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
   if (ops->handle_event != NULL)
     ops->handle_event ();
@@ -1392,11 +1392,9 @@ static void
 reload_shared_libraries (const char *ignored, int from_tty,
                         struct cmd_list_element *e)
 {
-  const struct target_so_ops *ops;
-
   reload_shared_libraries_1 (from_tty);
 
-  ops = gdbarch_so_ops (target_gdbarch ());
+  const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
   /* Creating inferior hooks here has two purposes.  First, if we reload 
      shared libraries then the address of solib breakpoint we've computed
@@ -1506,7 +1504,7 @@ gdb_bfd_lookup_symbol_from_symtab
 
          if (match_sym (sym))
            {
-             struct gdbarch *gdbarch = target_gdbarch ();
+             gdbarch *gdbarch = current_inferior ()->arch ();
              symaddr = sym->value;
 
              /* Some ELF targets fiddle with addresses of symbols they
@@ -1622,7 +1620,8 @@ gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr,
            gdb_byte ptr_buf[8];
            CORE_ADDR ptr_addr_1;
 
-           ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+           ptr_type
+             = builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
            ptr_addr_1 = dyn_addr + (buf - bufstart) + arch_size / 8;
            if (target_read_memory (ptr_addr_1, ptr_buf, arch_size / 8) == 0)
              dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
index 19534fc7379d44726a23bd8fee90d26bea304db0..5cf384f9eac231ccc69401edb7e4dce8c4815ae3 100644 (file)
@@ -345,7 +345,7 @@ adi_read_versions (CORE_ADDR vaddr, size_t size, gdb_byte *tags)
     {
       adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
       error(_("Address at %s is not in ADI maps"),
-           paddress (target_gdbarch (), vaddr * ast.blksize));
+           paddress (current_inferior ()->arch (), vaddr * ast.blksize));
     }
 
   fileio_error target_errno;
@@ -366,7 +366,7 @@ adi_write_versions (CORE_ADDR vaddr, size_t size, unsigned char *tags)
     {
       adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
       error(_("Address at %s is not in ADI maps"),
-           paddress (target_gdbarch (), vaddr * ast.blksize));
+           paddress (current_inferior ()->arch (), vaddr * ast.blksize));
     }
 
   fileio_error target_errno;
@@ -388,7 +388,8 @@ adi_print_versions (CORE_ADDR vaddr, size_t cnt, gdb_byte *tags)
     {
       QUIT;
       gdb_printf ("%s:\t",
-                 paddress (target_gdbarch (), vaddr * adi_stat.blksize));
+                 paddress (current_inferior ()->arch (),
+                           vaddr * adi_stat.blksize));
       for (int i = maxelts; i > 0 && cnt > 0; i--, cnt--)
        {
          if (tags[v_idx] == 0xff)    /* no version tag */
@@ -416,7 +417,8 @@ do_examine (CORE_ADDR start, int bcnt)
   if (read_cnt == -1)
     error (_("No ADI information"));
   else if (read_cnt < cnt)
-    error(_("No ADI information at %s"), paddress (target_gdbarch (), vaddr));
+    error(_("No ADI information at %s"),
+         paddress (current_inferior ()->arch (), vaddr));
 
   adi_print_versions (vstart, cnt, buf.data ());
 }
@@ -434,8 +436,8 @@ do_assign (CORE_ADDR start, size_t bcnt, int version)
   if (set_cnt == -1)
     error (_("No ADI information"));
   else if (set_cnt < cnt)
-    error(_("No ADI information at %s"), paddress (target_gdbarch (), vaddr));
-
+    error(_("No ADI information at %s"),
+         paddress (current_inferior ()->arch (), vaddr));
 }
 
 /* ADI examine version tag command.
index 956f10e387e6f924940fbcdcb5a652b37a38ccc1..8ec61199d14e8c4e0ff3d33edb117a89393845d4 100644 (file)
@@ -184,7 +184,7 @@ add_vsyscall_page (inferior *inf)
        }
 
       std::string name = string_printf ("system-supplied DSO at %s",
-                                       paddress (target_gdbarch (),
+                                       paddress (current_inferior ()->arch (),
                                                  vsyscall_range.start));
       try
        {
index dc2f6258ce28e37e0516fe42efc6d58b662097d2..5eb1638b781c3e84316b175ab16d66c0236c3826 100644 (file)
@@ -1959,7 +1959,8 @@ load_progress (ULONGEST bytes, void *untyped_arg)
       current_uiout->message ("Loading section %s, size %s lma %s\n",
                              args->section_name,
                              hex_string (args->section_size),
-                             paddress (target_gdbarch (), args->lma));
+                             paddress (current_inferior ()->arch (),
+                                       args->lma));
       return;
     }
 
@@ -1976,10 +1977,10 @@ load_progress (ULONGEST bytes, void *untyped_arg)
 
       if (target_read_memory (args->lma, check.data (), bytes) != 0)
        error (_("Download verify read failed at %s"),
-              paddress (target_gdbarch (), args->lma));
+              paddress (current_inferior ()->arch (), args->lma));
       if (memcmp (args->buffer, check.data (), bytes) != 0)
        error (_("Download verify compare failed at %s"),
-              paddress (target_gdbarch (), args->lma));
+              paddress (current_inferior ()->arch (), args->lma));
     }
   totals->data_count += bytes;
   args->lma += bytes;
@@ -2091,9 +2092,9 @@ generic_load (const char *args, int from_tty)
   steady_clock::time_point end_time = steady_clock::now ();
 
   CORE_ADDR entry = bfd_get_start_address (loadfile_bfd.get ());
-  entry = gdbarch_addr_bits_remove (target_gdbarch (), entry);
+  entry = gdbarch_addr_bits_remove (current_inferior ()->arch (), entry);
   uiout->text ("Start address ");
-  uiout->field_core_addr ("address", target_gdbarch (), entry);
+  uiout->field_core_addr ("address", current_inferior ()->arch (), entry);
   uiout->text (", load size ");
   uiout->field_unsigned ("load-size", total_progress.data_count);
   uiout->text ("\n");
index e9bc7b2c933916849e2a065eb7d9e63c7c9d97c6..46547f8b0ae4ff4ddd6db6575daa62e3dbca6948 100644 (file)
@@ -2460,7 +2460,7 @@ language_defn::lookup_symbol_nonlocal (const char *name,
       struct gdbarch *gdbarch;
 
       if (block == NULL)
-       gdbarch = target_gdbarch ();
+       gdbarch = current_inferior ()->arch ();
       else
        gdbarch = block->gdbarch ();
       result.symbol = language_lookup_primitive_type_as_symbol (this,
@@ -2582,7 +2582,7 @@ lookup_global_or_static_symbol (const char *name,
   /* Do a global search (of global blocks, heh).  */
   if (result.symbol == NULL)
     gdbarch_iterate_over_objfiles_in_search_order
-      (objfile != NULL ? objfile->arch () : target_gdbarch (),
+      (objfile != NULL ? objfile->arch () : current_inferior ()->arch (),
        [&result, block_index, name, domain] (struct objfile *objfile_iter)
         {
           result = lookup_symbol_in_objfile (objfile_iter, block_index,
@@ -6296,7 +6296,7 @@ find_main_name (void)
   /* Try to find language for main in psymtabs.  */
   bool symbol_found_p = false;
   gdbarch_iterate_over_objfiles_in_search_order
-    (target_gdbarch (),
+    (current_inferior ()->arch (),
      [&symbol_found_p, pspace] (objfile *obj)
        {
         language lang
index 9f6e8d2f1ac6933c0065dc74a553aee0bc01c3b3..d88254498ff5bd6f874bd54c66b105b8d9c6d64a 100644 (file)
@@ -475,7 +475,7 @@ target_find_description (void)
   /* The current architecture should not have any target description
      specified.  It should have been cleared, e.g. when we
      disconnected from the previous target.  */
-  gdb_assert (gdbarch_target_desc (target_gdbarch ()) == NULL);
+  gdb_assert (gdbarch_target_desc (current_inferior ()->arch ()) == NULL);
 
   /* First try to fetch an XML description from the user-specified
      file.  */
@@ -510,7 +510,7 @@ target_find_description (void)
        {
          struct tdesc_arch_data *data;
 
-         data = get_arch_data (target_gdbarch ());
+         data = get_arch_data (current_inferior ()->arch ());
          if (tdesc_has_registers (tdesc_info->tdesc)
              && data->arch_regs.empty ())
            warning (_("Target-supplied registers are not supported "
index 8cb4fa1736d70e370eb733b78c202df7b34b84ff..6853c14323180948c0f29c6e6b79974e76f47a24 100644 (file)
@@ -1281,7 +1281,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
 {
   volatile CORE_ADDR addr = 0;
   struct target_ops *target = current_inferior ()->top_target ();
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
 
   /* If OBJFILE is a separate debug object file, look for the
      original object file.  */
@@ -1631,7 +1631,8 @@ memory_xfer_partial (struct target_ops *ops, enum target_object object,
   if (len == 0)
     return TARGET_XFER_EOF;
 
-  memaddr = gdbarch_remove_non_address_bits (target_gdbarch (), memaddr);
+  memaddr = gdbarch_remove_non_address_bits (current_inferior ()->arch (),
+                                            memaddr);
 
   /* Fill in READBUF with breakpoint shadows, or WRITEBUF with
      breakpoint insns, thus hiding out from higher layers whether
@@ -1803,8 +1804,9 @@ target_read_uint32 (CORE_ADDR memaddr, uint32_t *result)
   r = target_read_memory (memaddr, buf, sizeof buf);
   if (r != 0)
     return r;
-  *result = extract_unsigned_integer (buf, sizeof buf,
-                                     gdbarch_byte_order (target_gdbarch ()));
+  *result = extract_unsigned_integer
+             (buf, sizeof buf,
+              gdbarch_byte_order (current_inferior ()->arch ()));
   return 0;
 }
 
@@ -1981,7 +1983,8 @@ target_read (struct target_ops *ops,
       || object == TARGET_OBJECT_STACK_MEMORY
       || object == TARGET_OBJECT_CODE_MEMORY
       || object == TARGET_OBJECT_RAW_MEMORY)
-    unit_size = gdbarch_addressable_memory_unit_size (target_gdbarch ());
+    unit_size = gdbarch_addressable_memory_unit_size
+                 (current_inferior ()->arch ());
 
   while (xfered_total < len)
     {
@@ -2140,7 +2143,8 @@ read_memory_robust (struct target_ops *ops,
                    const ULONGEST offset, const LONGEST len)
 {
   std::vector<memory_read_result> result;
-  int unit_size = gdbarch_addressable_memory_unit_size (target_gdbarch ());
+  int unit_size
+    = gdbarch_addressable_memory_unit_size (current_inferior ()->arch ());
 
   LONGEST xfered_total = 0;
   while (xfered_total < len)
@@ -2215,7 +2219,8 @@ target_write_with_progress (struct target_ops *ops,
       || object == TARGET_OBJECT_STACK_MEMORY
       || object == TARGET_OBJECT_CODE_MEMORY
       || object == TARGET_OBJECT_RAW_MEMORY)
-    unit_size = gdbarch_addressable_memory_unit_size (target_gdbarch ());
+    unit_size = gdbarch_addressable_memory_unit_size
+                 (current_inferior ()->arch ());
 
   /* Give the progress callback a chance to set up.  */
   if (progress)
@@ -2468,7 +2473,7 @@ target_pre_inferior (int from_tty)
   /* In some OSs, the shared library list is the same/global/shared
      across inferiors.  If code is shared between processes, so are
      memory regions and features.  */
-  if (!gdbarch_has_global_solist (target_gdbarch ()))
+  if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
     {
       no_shared_libraries (NULL, from_tty);
 
@@ -2539,10 +2544,9 @@ target_detach (inferior *inf, int from_tty)
   ptid_t save_pid_ptid = ptid_t (inf->pid);
 
   /* As long as some to_detach implementations rely on the current_inferior
-     (either directly, or indirectly, like through target_gdbarch or by
-     reading memory), INF needs to be the current inferior.  When that
-     requirement will become no longer true, then we can remove this
-     assertion.  */
+     (either directly, or indirectly, like through reading memory), INF needs
+     to be the current inferior.  When that requirement will become no longer
+     true, then we can remove this assertion.  */
   gdb_assert (inf == current_inferior ());
 
   prepare_for_detach ();
@@ -3582,7 +3586,8 @@ static int
 default_region_ok_for_hw_watchpoint (struct target_ops *self,
                                     CORE_ADDR addr, int len)
 {
-  return (len <= gdbarch_ptr_bit (target_gdbarch ()) / TARGET_CHAR_BIT);
+  gdbarch *arch = current_inferior ()->arch ();
+  return (len <= gdbarch_ptr_bit (arch) / TARGET_CHAR_BIT);
 }
 
 static int
@@ -4284,7 +4289,7 @@ flash_erase_command (const char *cmd, int from_tty)
 {
   /* Used to communicate termination of flash operations to the target.  */
   bool found_flash_region = false;
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
 
   std::vector<mem_region> mem_regions = target_memory_map ();
 
index 936ae79219c0868835a1556d49070e58d41097ec..446c0a9fdbfa26914f738b724e9ce0f698470298 100644 (file)
@@ -934,7 +934,7 @@ struct target_ops
        the target is currently stopped at.  The architecture information is
        used to perform decr_pc_after_break adjustment, and also to determine
        the frame architecture of the innermost frame.  ptrace operations need to
-       operate according to target_gdbarch ().  */
+       operate according to the current inferior's gdbarch.  */
     virtual struct gdbarch *thread_architecture (ptid_t)
       TARGET_DEFAULT_RETURN (NULL);
 
index 478f2f0a13a40ba666adb93e121c6276720a1b50..b698b4004cc2a6acf52ca1433d8a387e5778d552 100644 (file)
@@ -659,7 +659,7 @@ tfile_get_traceframe_address (off_t tframe_offset)
   tfile_read ((gdb_byte *) &tpnum, 2);
   tpnum = (short) extract_signed_integer ((gdb_byte *) &tpnum, 2,
                                          gdbarch_byte_order
-                                             (target_gdbarch ()));
+                                           (current_inferior ()->arch ()));
 
   tp = get_tracepoint_by_number_on_target (tpnum);
   /* FIXME this is a poor heuristic if multiple locations.  */
@@ -703,14 +703,15 @@ tfile_target::trace_find (enum trace_find_type type, int num,
       tfile_read ((gdb_byte *) &tpnum, 2);
       tpnum = (short) extract_signed_integer ((gdb_byte *) &tpnum, 2,
                                              gdbarch_byte_order
-                                                 (target_gdbarch ()));
+                                               (current_inferior ()->arch ()));
       offset += 2;
       if (tpnum == 0)
        break;
       tfile_read ((gdb_byte *) &data_size, 4);
       data_size = (unsigned int) extract_unsigned_integer
-                                    ((gdb_byte *) &data_size, 4,
-                                     gdbarch_byte_order (target_gdbarch ()));
+                                  ((gdb_byte *) &data_size, 4,
+                                   gdbarch_byte_order
+                                     (current_inferior ()->arch ()));
       offset += 4;
 
       if (type == tfind_number)
@@ -811,7 +812,7 @@ traceframe_walk_blocks (gdb::function_view<bool (char)> callback, int pos)
          mlen = (unsigned short)
                extract_unsigned_integer ((gdb_byte *) &mlen, 2,
                                          gdbarch_byte_order
-                                             (target_gdbarch ()));
+                                           (current_inferior ()->arch ()));
          lseek (trace_fd, mlen, SEEK_CUR);
          pos += (8 + 2 + mlen);
          break;
@@ -947,7 +948,8 @@ tfile_target::xfer_partial (enum target_object object,
        {
          ULONGEST maddr, amt;
          unsigned short mlen;
-         enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+         bfd_endian byte_order
+           = gdbarch_byte_order (current_inferior ()->arch ());
 
          tfile_read ((gdb_byte *) &maddr, 8);
          maddr = extract_unsigned_integer ((gdb_byte *) &maddr, 8,
@@ -1027,13 +1029,13 @@ tfile_target::get_trace_state_variable_value (int tsvnum, LONGEST *val)
       tfile_read ((gdb_byte *) &vnum, 4);
       vnum = (int) extract_signed_integer ((gdb_byte *) &vnum, 4,
                                           gdbarch_byte_order
-                                          (target_gdbarch ()));
+                                            (current_inferior ()->arch ()));
       if (tsvnum == vnum)
        {
          tfile_read ((gdb_byte *) val, 8);
          *val = extract_signed_integer ((gdb_byte *) val, 8,
                                         gdbarch_byte_order
-                                        (target_gdbarch ()));
+                                          (current_inferior ()->arch ()));
          found = true;
        }
       pos += (4 + 8);
@@ -1058,12 +1060,13 @@ build_traceframe_info (char blocktype, struct traceframe_info *info)
        tfile_read ((gdb_byte *) &maddr, 8);
        maddr = extract_unsigned_integer ((gdb_byte *) &maddr, 8,
                                          gdbarch_byte_order
-                                         (target_gdbarch ()));
+                                           (current_inferior ()->arch ()));
        tfile_read ((gdb_byte *) &mlen, 2);
        mlen = (unsigned short)
                extract_unsigned_integer ((gdb_byte *) &mlen,
-                                         2, gdbarch_byte_order
-                                         (target_gdbarch ()));
+                                         2,
+                                         gdbarch_byte_order
+                                           (current_inferior ()->arch ()));
 
        info->memory.emplace_back (maddr, mlen);
        break;
index 5a2641919f745dd7f8afaa19a4e7d5cce70af3fd..12ea7fae601c74b1a716eea084d9c509cb4f4847 100644 (file)
@@ -25,6 +25,7 @@
 #include "gdbsupport/byte-vector.h"
 #include "gdbarch.h"
 #include "gdbsupport/buildargv.h"
+#include "inferior.h"
 
 /* Helper macros.  */
 
@@ -71,7 +72,7 @@ trace_save (const char *filename, struct trace_file_writer *writer,
   ULONGEST offset = 0;
 #define MAX_TRACE_UPLOAD 2000
   gdb::byte_vector buf (std::max (MAX_TRACE_UPLOAD, trace_regblock_size));
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
 
   /* If the target is to save the data to a file on its own, then just
      send the command and be done with it.  */
index 626fd871cf49bc146aeb61c59ab05a5b64375664..2c5486885700b032a24316d1102251c0d171046b 100644 (file)
@@ -1097,10 +1097,10 @@ collection_list::collection_list ()
   : m_strace_data (false)
 {
   int max_remote_regno = 0;
-  for (int i = 0; i < gdbarch_num_regs (target_gdbarch ()); i++)
+  for (int i = 0; i < gdbarch_num_regs (current_inferior ()->arch ()); i++)
     {
       int remote_regno = (gdbarch_remote_register_number
-                         (target_gdbarch (), i));
+                         (current_inferior ()->arch (), i));
 
       if (remote_regno >= 0 && remote_regno > max_remote_regno)
        max_remote_regno = remote_regno;
@@ -1173,7 +1173,7 @@ collection_list::stringify ()
        {
          gdb_printf ("(%d, %s, %ld)\n", 
                      m_memranges[i].type,
-                     paddress (target_gdbarch (),
+                     paddress (current_inferior ()->arch (),
                                m_memranges[i].start),
                      (long) (m_memranges[i].end
                              - m_memranges[i].start));
@@ -1281,14 +1281,15 @@ encode_actions_1 (struct command_line *action,
            {                   /* Repeat over a comma-separated list.  */
              QUIT;             /* Allow user to bail out with ^C.  */
              action_exp = skip_spaces (action_exp);
+             gdbarch *arch = current_inferior ()->arch ();
 
              if (0 == strncasecmp ("$reg", action_exp, 4))
                {
-                 for (i = 0; i < gdbarch_num_regs (target_gdbarch ());
+                 for (i = 0; i < gdbarch_num_regs (arch);
                       i++)
                    {
                      int remote_regno = (gdbarch_remote_register_number
-                                         (target_gdbarch (), i));
+                                         (arch, i));
 
                      /* Ignore arch regnos without a corresponding
                         remote regno.  This can happen for regnos not
@@ -1300,7 +1301,7 @@ encode_actions_1 (struct command_line *action,
                }
              else if (0 == strncasecmp ("$arg", action_exp, 4))
                {
-                 collect->add_local_symbols (target_gdbarch (),
+                 collect->add_local_symbols (arch,
                                              tloc->address,
                                              frame_reg,
                                              frame_offset,
@@ -1310,7 +1311,7 @@ encode_actions_1 (struct command_line *action,
                }
              else if (0 == strncasecmp ("$loc", action_exp, 4))
                {
-                 collect->add_local_symbols (target_gdbarch (),
+                 collect->add_local_symbols (arch,
                                              tloc->address,
                                              frame_reg,
                                              frame_offset,
@@ -1322,8 +1323,7 @@ encode_actions_1 (struct command_line *action,
                {
                  agent_expr_up aexpr
                    = gen_trace_for_return_address (tloc->address,
-                                                   target_gdbarch (),
-                                                   trace_string);
+                                                   arch, trace_string);
 
                  finalize_tracepoint_aexpr (aexpr.get ());
 
@@ -1356,15 +1356,14 @@ encode_actions_1 (struct command_line *action,
                             (exp->op.get ()));
                        const char *name = regop->get_name ();
 
-                       i = user_reg_map_name_to_regnum (target_gdbarch (),
+                       i = user_reg_map_name_to_regnum (arch,
                                                         name, strlen (name));
                        if (i == -1)
                          internal_error (_("Register $%s not available"),
                                          name);
                        if (info_verbose)
                          gdb_printf ("OP_REGISTER: ");
-                       collect->add_local_register (target_gdbarch (),
-                                                    i, tloc->address);
+                       collect->add_local_register (arch, i, tloc->address);
                        break;
                      }
 
@@ -1379,7 +1378,7 @@ encode_actions_1 (struct command_line *action,
                        struct type *type = memop->get_type ();
                        /* Initialize the TYPE_LENGTH if it is a typedef.  */
                        check_typedef (type);
-                       collect->add_memrange (target_gdbarch (),
+                       collect->add_memrange (arch,
                                               memrange_absolute, addr,
                                               type->length (),
                                               tloc->address);
@@ -1397,7 +1396,7 @@ encode_actions_1 (struct command_line *action,
                        const char *name = sym->natural_name ();
 
                        collect->collect_symbol (sym,
-                                                target_gdbarch (),
+                                                arch,
                                                 frame_reg,
                                                 frame_offset,
                                                 tloc->address,
@@ -3553,7 +3552,7 @@ parse_static_tracepoint_marker_definition (const char *line, const char **pp,
   p = unpack_varlen_hex (p, &addr);
   p++;  /* skip a colon */
 
-  marker->gdbarch = target_gdbarch ();
+  marker->gdbarch = current_inferior ()->arch ();
   marker->address = (CORE_ADDR) addr;
 
   endp = strchr (p, ':');
@@ -3706,7 +3705,7 @@ info_static_tracepoint_markers_command (const char *arg, int from_tty)
   uiout->table_header (40, ui_left, "marker-id", "ID");
 
   uiout->table_header (3, ui_left, "enabled", "Enb");
-  if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
+  if (gdbarch_addr_bit (current_inferior ()->arch ()) <= 32)
     uiout->table_header (10, ui_left, "addr", "Address");
   else
     uiout->table_header (18, ui_left, "addr", "Address");
index 190887471c35fd4e8834081cf244b99a3011ace3..17b7c53d0522210891ea28ec053ad83d70fd7736 100644 (file)
@@ -2515,7 +2515,7 @@ value::from_xmethod (xmethod_worker_up &&worker)
 {
   struct value *v;
 
-  v = value::allocate (builtin_type (target_gdbarch ())->xmethod);
+  v = value::allocate (builtin_type (current_inferior ()->arch ())->xmethod);
   v->m_lval = lval_xcallable;
   v->m_location.xm_worker = worker.release ();
   v->m_modifiable = false;
index 7a139c8d36f7cf0667c8d9ace59e90db708c9dee..b446afd72d8a0e532ce42d38a85e4e5cbf1ad5bb 100644 (file)
@@ -2920,7 +2920,7 @@ windows_xfer_shared_libraries (struct target_ops *ops,
     windows_xfer_shared_library (so.name.c_str (),
                                 (CORE_ADDR) (uintptr_t) so.load_addr,
                                 &so.text_offset,
-                                target_gdbarch (), &obstack);
+                                current_inferior ()->arch (), &obstack);
   obstack_grow_str0 (&obstack, "</library-list>\n");
 
   buf = (const char *) obstack_finish (&obstack);
index 0414aea6f1aa4cb33ca260ce106c6240471ad3ab..29aec5aa6d1b7e4a2f12dbdf7e2097aeaf072609 100644 (file)
@@ -451,8 +451,8 @@ display_one_tib (ptid_t ptid)
   gdb_byte *index;
   CORE_ADDR thread_local_base;
   ULONGEST i, val, max, max_name, size, tib_size;
-  ULONGEST sizeof_ptr = gdbarch_ptr_bit (target_gdbarch ());
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+  ULONGEST sizeof_ptr = gdbarch_ptr_bit (current_inferior ()->arch ());
+  bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
 
   if (sizeof_ptr == 64)
     {
@@ -490,13 +490,13 @@ display_one_tib (ptid_t ptid)
       gdb_printf (_("Unable to read thread information "
                    "block for %s at address %s\n"),
                  target_pid_to_str (ptid).c_str (), 
-                 paddress (target_gdbarch (), thread_local_base));
+                 paddress (current_inferior ()->arch (), thread_local_base));
       return -1;
     }
 
   gdb_printf (_("Thread Information Block %s at %s\n"),
              target_pid_to_str (ptid).c_str (),
-             paddress (target_gdbarch (), thread_local_base));
+             paddress (current_inferior ()->arch (), thread_local_base));
 
   index = (gdb_byte *) tib;
 
@@ -872,7 +872,7 @@ windows_solib_create_inferior_hook (int from_tty)
 
   /* Find base address of main executable in
      TIB->process_environment_block->image_base_address.  */
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int ptr_bytes;
   int peb_offset;  /* Offset of process_environment_block in TIB.  */
index d9ba20798360dae328424d4d108e05e1165a88a1..ae328550b063bb2b9546075959ae24c0d97445da 100644 (file)
@@ -778,7 +778,7 @@ z80_software_single_step (struct regcache *regcache)
   int size;
   const struct z80_insn_info *info;
   std::vector<CORE_ADDR> ret (1);
-  struct gdbarch *gdbarch = target_gdbarch ();
+  gdbarch *gdbarch = current_inferior ()->arch ();
 
   regcache->cooked_read (Z80_PC_REGNUM, &addr);
   read_memory (addr, buf, sizeof(buf));