]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
convert current_target to be a pointer
authorPaul Koning <paul_koning@dell.com>
Mon, 19 Oct 2015 19:16:46 +0000 (15:16 -0400)
committerPaul Koning <paul_koning@dell.com>
Mon, 19 Oct 2015 19:16:46 +0000 (15:16 -0400)
This converts current_target to be a pointer rather than a struct.
This is more efficient when we move to multi-target, because then we
can switch targets by simply changing the pointer.

I made this patch by running this:

perl -pi -e 's/&current_target/current_target/g; s/current_target\./current_target->/g;' *.[chyl] */*.[chyl]

... and then fixing up the result minorly:

* Updating the definition and declaration of current_target
* Fixing a "sizeof"
* Initializing current_target

Built and regtested on x86-64 Fedora 20.

2014-07-29  Tom Tromey  <tromey@redhat.com>

* target.c (current_target): Now a pointer.
(update_current_target): Use size of target_ops, not
current_target.
(initialize_targets): Initialize current_target.
* target.h (current_target): Now a pointer.
* auxv.c: Update.
* avr-tdep.c: Update.
* breakpoint.c: Update.
* corefile.c: Update.
* elfread.c: Update.
* eval.c: Update.
* frame.c: Update.
* gnu-v3-abi.c: Update.
* ia64-hpux-tdep.c: Update.
* ia64-tdep.c: Update.
* ia64-vms-tdep.c: Update.
* infcall.c: Update.
* infcmd.c: Update.
* infrun.c: Update.
* linespec.c: Update.
* linux-nat.c: Update.
* linux-tdep.c: Update.
* linux-thread-db.c: Update.
* mi/mi-main.c: Update.
* minsyms.c: Update.
* parse.c: Update.
* ppc-linux-nat.c: Update.
* ppc-linux-tdep.c: Update.
* procfs.c: Update.
* remote-m32r-sdi.c: Update.
* remote.c: Update.
* s390-linux-nat.c: Update.
* s390-linux-tdep.c: Update.
* sol-thread.c: Update.
* solib-aix.c: Update.
* solib-darwin.c: Update.
* solib-dsbt.c: Update.
* solib-ia64-hpux.c: Update.
* solib-irix.c: Update.
* solib-osf.c: Update.
* solib-spu.c: Update.
* solib-svr4.c: Update.
* solib-target.c: Update.
* solib.c: Update.
* sparc-tdep.c: Update.
* spu-tdep.c: Update.
* symfile.c: Update.
* target-descriptions.c: Update.
* target-memory.c: Update.
* target.c: Update.
* target.h: Update.
* tracepoint.c: Update.
* valops.c: Update.
* valprint.c: Update.
* value.c: Update.
* windows-tdep.c: Update.

48 files changed:
gdb/auxv.c
gdb/avr-tdep.c
gdb/breakpoint.c
gdb/corefile.c
gdb/elfread.c
gdb/eval.c
gdb/frame.c
gdb/gnu-v3-abi.c
gdb/ia64-tdep.c
gdb/ia64-vms-tdep.c
gdb/infcall.c
gdb/infcmd.c
gdb/infrun.c
gdb/linespec.c
gdb/linux-nat.c
gdb/linux-tdep.c
gdb/linux-thread-db.c
gdb/mi/mi-main.c
gdb/minsyms.c
gdb/parse.c
gdb/ppc-linux-nat.c
gdb/ppc-linux-tdep.c
gdb/procfs.c
gdb/remote-m32r-sdi.c
gdb/remote.c
gdb/rs6000-tdep.c
gdb/s390-linux-nat.c
gdb/s390-linux-tdep.c
gdb/sol-thread.c
gdb/solib-aix.c
gdb/solib-darwin.c
gdb/solib-dsbt.c
gdb/solib-spu.c
gdb/solib-svr4.c
gdb/solib-target.c
gdb/solib.c
gdb/sparc-tdep.c
gdb/spu-tdep.c
gdb/symfile.c
gdb/target-descriptions.c
gdb/target-memory.c
gdb/target.c
gdb/target.h
gdb/tracepoint.c
gdb/valops.c
gdb/valprint.c
gdb/value.c
gdb/windows-tdep.c

index 1f22d8a0ee6408fb653f66beb324de53f83182aa..ba8bae98d713d6d22a5c5b3379c8edbccf0606c1 100644 (file)
@@ -291,7 +291,7 @@ target_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
   if (gdbarch_auxv_parse_p (gdbarch))
     return gdbarch_auxv_parse (gdbarch, readptr, endptr, typep, valp);
 
-  return current_target.to_auxv_parse (&current_target, readptr, endptr,
+  return current_target->to_auxv_parse (current_target, readptr, endptr,
                                       typep, valp);
 }
 
@@ -528,7 +528,7 @@ info_auxv_command (char *cmd, int from_tty)
     error (_("The program has no auxiliary information now."));
   else
     {
-      int ents = fprint_target_auxv (gdb_stdout, &current_target);
+      int ents = fprint_target_auxv (gdb_stdout, current_target);
 
       if (ents < 0)
        error (_("No auxiliary vector found, or failed reading it."));
index 1108eb4681ee5f9400c325f7fa1d77a01387ae52..4894c82483d67cbfe13ab86bfd62a9ed83113598 100644 (file)
@@ -1563,7 +1563,7 @@ avr_io_reg_read_command (char *args, int from_tty)
   int i, j, k, step;
 
   /* Find out how many io registers the target has.  */
-  bufsiz = target_read_alloc (&current_target, TARGET_OBJECT_AVR,
+  bufsiz = target_read_alloc (current_target, TARGET_OBJECT_AVR,
                              "avr.io_reg", &buf);
   bufstr = (const char *) buf;
 
@@ -1600,7 +1600,7 @@ avr_io_reg_read_command (char *args, int from_tty)
         j = nreg - i;           /* last block is less than 8 registers */
 
       snprintf (query, sizeof (query) - 1, "avr.io_reg:%x,%x", i, j);
-      bufsiz = target_read_alloc (&current_target, TARGET_OBJECT_AVR,
+      bufsiz = target_read_alloc (current_target, TARGET_OBJECT_AVR,
                                  query, &buf);
 
       p = (const char *) buf;
index 2c901ff5f2fe755026278927db564be939545011..ae7439326927e23161aaffd1e171ead3ab81e080 100644 (file)
@@ -3738,7 +3738,7 @@ create_exception_master_breakpoint (void)
 
       addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym);
       addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
-                                                &current_target);
+                                                current_target);
       b = create_internal_breakpoint (gdbarch, addr, bp_exception_master,
                                      &internal_breakpoint_ops);
       initialize_explicit_location (&explicit_loc);
@@ -4959,7 +4959,7 @@ watchpoints_triggered (struct target_waitstatus *ws)
       return 0;
     }
 
-  if (!target_stopped_data_address (&current_target, &addr))
+  if (!target_stopped_data_address (current_target, &addr))
     {
       /* We were stopped by a watchpoint, but we don't know where.
         Mark all watchpoints as unknown.  */
@@ -4999,7 +4999,7 @@ watchpoints_triggered (struct target_waitstatus *ws)
                  }
              }
            /* Exact match not required.  Within range is sufficient.  */
-           else if (target_watchpoint_addr_within_range (&current_target,
+           else if (target_watchpoint_addr_within_range (current_target,
                                                         addr, loc->address,
                                                         loc->length))
              {
index a860ce3c8e4b06422801f34553a3c0df5e619e31..729bad44f8d768039d3382138dceb5a5c46d304a 100644 (file)
@@ -245,7 +245,7 @@ read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
       enum target_xfer_status status;
       ULONGEST xfered_len;
 
-      status = target_xfer_partial (current_target.beneath,
+      status = target_xfer_partial (current_target->beneath,
                                    TARGET_OBJECT_MEMORY, NULL,
                                    myaddr + xfered, NULL,
                                    memaddr + xfered, len - xfered,
index 138d316b4fead489481014726dc7da7993ff5a5b..1ecdb26def5d1d758df822978ab631c66874744a 100644 (file)
@@ -820,7 +820,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
        continue;
       addr = extract_typed_address (buf, ptr_type);
       addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
-                                                &current_target);
+                                                current_target);
       addr = gdbarch_addr_bits_remove (gdbarch, addr);
 
       if (addr_p)
@@ -884,7 +884,7 @@ elf_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc)
   address_val = call_function_by_hand (function, 0, NULL);
   address = value_as_address (address_val);
   address = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
-                                               &current_target);
+                                               current_target);
   address = gdbarch_addr_bits_remove (gdbarch, address);
 
   if (name_at_pc)
@@ -993,7 +993,7 @@ elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b)
   resolved_address = value_as_address (value);
   resolved_pc = gdbarch_convert_from_func_ptr_addr (gdbarch,
                                                    resolved_address,
-                                                   &current_target);
+                                                   current_target);
   resolved_pc = gdbarch_addr_bits_remove (gdbarch, resolved_pc);
 
   gdb_assert (current_program_space == b->pspace || b->pspace == NULL);
index a668e76d53d2c2541730840c505ccdc18dde21ec..ea239b066802ebdac3ed6d9d2eaa9e19b16b1ef7 100644 (file)
@@ -1206,7 +1206,7 @@ evaluate_subexp_standard (struct type *expect_type,
            /* The address might point to a function descriptor;
               resolve it to the actual code address instead.  */
            addr = gdbarch_convert_from_func_ptr_addr (exp->gdbarch, addr,
-                                                      &current_target);
+                                                      current_target);
 
            /* Is it a high_level symbol?  */
            sym = find_pc_function (addr);
index 93bb7f65081b8f41c7ae130d74bb82d4346e8796..ea366f7e216d40902c203c2745e4230a0707aae9 100644 (file)
@@ -2092,7 +2092,7 @@ inside_main_func (struct frame_info *this_frame)
      returned.  */
   maddr = gdbarch_convert_from_func_ptr_addr (get_frame_arch (this_frame),
                                              BMSYMBOL_VALUE_ADDRESS (msymbol),
-                                             &current_target);
+                                             current_target);
   return maddr == get_frame_func (this_frame);
 }
 
index b962cd3f95d11bfae3d8407d34ac0d676de01bc4..b701d1626183fa5af7cccd362b088be491232a61 100644 (file)
@@ -1262,7 +1262,7 @@ gnuv3_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc)
      of the real function from the function descriptor before passing on
      the address to other layers of GDB.  */
   func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch, method_stop_pc,
-                                                  &current_target);
+                                                  current_target);
   if (func_addr != 0)
     method_stop_pc = func_addr;
 
index 46a114c4840c44cf9e9cfe8445a2417223d3d3cf..f80a087e7399bf934c2a3276a58cf81cd3a5286b 100644 (file)
@@ -2682,7 +2682,7 @@ getunwind_table (gdb_byte **buf_p)
      we should find a way to override the corefile layer's
      xfer_partial method.  */
 
-  x = target_read_alloc (&current_target, TARGET_OBJECT_UNWIND_TABLE,
+  x = target_read_alloc (current_target, TARGET_OBJECT_UNWIND_TABLE,
                         NULL, buf_p);
 
   return x;
index 25b0f13174e1e11e699936541dd5758a715d1439..db0e332525ed939abdc68b385c88ad1eeefbd177 100644 (file)
@@ -42,7 +42,7 @@ ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip,
   CORE_ADDR table_addr;
   unsigned int info_len;
 
-  res = target_read (&current_target, TARGET_OBJECT_OPENVMS_UIB,
+  res = target_read (current_target, TARGET_OBJECT_OPENVMS_UIB,
                      annex + 2, buf, 0, sizeof (buf));
 
   if (res != sizeof (buf))
index efb389feb57220033f8bd424d86cd938fed7777f..f88b10080ebde9b734415b19d377551090f31c14 100644 (file)
@@ -269,7 +269,7 @@ find_function_addr (struct value *function, struct type **retval_type)
       if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
          || TYPE_CODE (ftype) == TYPE_CODE_METHOD)
        funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
-                                                     &current_target);
+                                                     current_target);
     }
   if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
       || TYPE_CODE (ftype) == TYPE_CODE_METHOD)
@@ -305,7 +305,7 @@ find_function_addr (struct value *function, struct type **retval_type)
              funaddr = value_as_address (value_addr (function));
              nfunaddr = funaddr;
              funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
-                                                           &current_target);
+                                                           current_target);
              if (funaddr != nfunaddr)
                found_descriptor = 1;
            }
index 54aa1ef4cc49cfa01669972978bbc3ef33dca442..fe5bdfd9fc667abc15794023cb7bf7ce4d4503b9 100644 (file)
@@ -622,7 +622,7 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main)
 
   /* Pass zero for FROM_TTY, because at this point the "run" command
      has done its thing; now we are setting up the running program.  */
-  post_create_inferior (&current_target, 0);
+  post_create_inferior (current_target, 0);
 
   /* Start the target running.  Do not use -1 continuation as it would skip
      breakpoint right at the entry point.  */
@@ -775,7 +775,7 @@ continue_command (char *args, int from_tty)
   args = strip_bg_char (args, &async_exec);
   args_chain = make_cleanup (xfree, args);
 
-  prepare_execution_command (&current_target, async_exec);
+  prepare_execution_command (current_target, async_exec);
 
   if (args != NULL)
     {
@@ -988,7 +988,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
   count_string = strip_bg_char (count_string, &async_exec);
   args_chain = make_cleanup (xfree, count_string);
 
-  prepare_execution_command (&current_target, async_exec);
+  prepare_execution_command (current_target, async_exec);
 
   count = count_string ? parse_and_eval_long (count_string) : 1;
 
@@ -1180,7 +1180,7 @@ jump_command (char *arg, int from_tty)
   arg = strip_bg_char (arg, &async_exec);
   args_chain = make_cleanup (xfree, arg);
 
-  prepare_execution_command (&current_target, async_exec);
+  prepare_execution_command (current_target, async_exec);
 
   if (!arg)
     error_no_arg (_("starting address"));
@@ -1265,7 +1265,7 @@ signal_command (char *signum_exp, int from_tty)
   signum_exp = strip_bg_char (signum_exp, &async_exec);
   args_chain = make_cleanup (xfree, signum_exp);
 
-  prepare_execution_command (&current_target, async_exec);
+  prepare_execution_command (current_target, async_exec);
 
   if (!signum_exp)
     error_no_arg (_("signal number"));
@@ -1543,7 +1543,7 @@ until_command (char *arg, int from_tty)
   arg = strip_bg_char (arg, &async_exec);
   args_chain = make_cleanup (xfree, arg);
 
-  prepare_execution_command (&current_target, async_exec);
+  prepare_execution_command (current_target, async_exec);
 
   if (arg)
     until_break_command (arg, from_tty, 0);
@@ -1572,7 +1572,7 @@ advance_command (char *arg, int from_tty)
   arg = strip_bg_char (arg, &async_exec);
   args_chain = make_cleanup (xfree, arg);
 
-  prepare_execution_command (&current_target, async_exec);
+  prepare_execution_command (current_target, async_exec);
 
   until_break_command (arg, from_tty, 1);
 
@@ -1951,7 +1951,7 @@ finish_command (char *arg, int from_tty)
   arg = strip_bg_char (arg, &async_exec);
   args_chain = make_cleanup (xfree, arg);
 
-  prepare_execution_command (&current_target, async_exec);
+  prepare_execution_command (current_target, async_exec);
 
   if (arg)
     error (_("The \"finish\" command does not take any arguments."));
@@ -2635,7 +2635,7 @@ attach_command_post_wait (char *args, int from_tty, int async_exec)
   /* Take any necessary post-attaching actions for this platform.  */
   target_post_attach (ptid_get_pid (inferior_ptid));
 
-  post_create_inferior (&current_target, from_tty);
+  post_create_inferior (current_target, from_tty);
 
   if (async_exec)
     {
index cf9137031979b0339c5bc620a3a7f9a68207152e..f451be4ee6c5faccfc1534003eccd4abdbc4c819 100644 (file)
@@ -3194,7 +3194,7 @@ start_remote (int from_tty)
   /* Now that the inferior has stopped, do any bookkeeping like
      loading shared libraries.  We want to do this before normal_stop,
      so that the displayed frame is up to date.  */
-  post_create_inferior (&current_target, from_tty);
+  post_create_inferior (current_target, from_tty);
 
   normal_stop ();
 }
@@ -5462,7 +5462,7 @@ handle_signal_stop (struct execution_control_state *ecs)
 
          fprintf_unfiltered (gdb_stdlog, "infrun: stopped by watchpoint\n");
 
-          if (target_stopped_data_address (&current_target, &addr))
+          if (target_stopped_data_address (current_target, &addr))
             fprintf_unfiltered (gdb_stdlog,
                                 "infrun: stopped data address = %s\n",
                                 paddress (gdbarch, addr));
@@ -8563,7 +8563,7 @@ siginfo_value_read (struct value *v)
   validate_siginfo_access ();
 
   transferred =
-    target_read (&current_target, TARGET_OBJECT_SIGNAL_INFO,
+    target_read (current_target, TARGET_OBJECT_SIGNAL_INFO,
                 NULL,
                 value_contents_all_raw (v),
                 value_offset (v),
@@ -8583,7 +8583,7 @@ siginfo_value_write (struct value *v, struct value *fromval)
 
   validate_siginfo_access ();
 
-  transferred = target_write (&current_target,
+  transferred = target_write (current_target,
                              TARGET_OBJECT_SIGNAL_INFO,
                              NULL,
                              value_contents_all_raw (fromval),
@@ -8662,7 +8662,7 @@ save_infcall_suspend_state (void)
       siginfo_data = (gdb_byte *) xmalloc (len);
       back_to = make_cleanup (xfree, siginfo_data);
 
-      if (target_read (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
+      if (target_read (current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
                       siginfo_data, 0, len) == len)
        discard_cleanups (back_to);
       else
@@ -8712,7 +8712,7 @@ restore_infcall_suspend_state (struct infcall_suspend_state *inf_state)
       struct type *type = gdbarch_get_siginfo_type (gdbarch);
 
       /* Errors ignored.  */
-      target_write (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
+      target_write (current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
                    inf_state->siginfo_data, 0, TYPE_LENGTH (type));
     }
 
index b2233b92d8d263b941914be243be78ccbb43f10f..3724537f65e7adb5ab79e3c6e6786cf41e039539 100644 (file)
@@ -3556,7 +3556,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
 
   /* The minimal symbol might point to a function descriptor;
      resolve it to the actual code address instead.  */
-  pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, &current_target);
+  pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, current_target);
   if (pc != sal.pc)
     sal = find_pc_sect_line (pc, NULL, 0);
 
@@ -3573,7 +3573,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
             stay correct from the last find_pc_sect_line above.  */
          sal.pc = MSYMBOL_VALUE_ADDRESS (objfile, msymbol);
          sal.pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc,
-                                                      &current_target);
+                                                      current_target);
          if (gdbarch_skip_entrypoint_p (gdbarch))
            sal.pc = gdbarch_skip_entrypoint (gdbarch, sal.pc);
        }
@@ -3665,7 +3665,7 @@ add_minsym (struct minimal_symbol *minsym, void *d)
                               NULL, 0);
       sal.section = MSYMBOL_OBJ_SECTION (info->objfile, minsym);
       pc
-       = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, &current_target);
+       = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, current_target);
       if (pc != sal.pc)
        sal = find_pc_sect_line (pc, NULL, 0);
 
@@ -3689,7 +3689,7 @@ add_minsym (struct minimal_symbol *minsym, void *d)
            struct gdbarch *gdbarch = get_objfile_arch (info->objfile);
            CORE_ADDR addr = gdbarch_convert_from_func_ptr_addr
                               (gdbarch, BMSYMBOL_VALUE_ADDRESS (mo),
-                               &current_target);
+                               current_target);
 
            if (addr == BMSYMBOL_VALUE_ADDRESS (mo))
              return;
index eb9f5bb91f6d81123cbf24bb7d66c14cd88e9645..18fdea7d6644ab005862b0d0af023fa1d69d44e7 100644 (file)
@@ -2488,7 +2488,7 @@ check_stopped_by_watchpoint (struct lwp_info *lp)
 
       if (linux_ops->to_stopped_data_address != NULL)
        lp->stopped_data_address_p =
-         linux_ops->to_stopped_data_address (&current_target,
+         linux_ops->to_stopped_data_address (current_target,
                                              &lp->stopped_data_address);
       else
        lp->stopped_data_address_p = 0;
index 7c24eaab6e1252471c785a90384fdbc6a730dbe6..df674c90764562f28641feebd8454734521006aa 100644 (file)
@@ -370,8 +370,8 @@ linux_is_uclinux (void)
 {
   CORE_ADDR dummy;
 
-  return (target_auxv_search (&current_target, AT_NULL, &dummy) > 0
-         && target_auxv_search (&current_target, AT_PAGESZ, &dummy) == 0);
+  return (target_auxv_search (current_target, AT_NULL, &dummy) > 0
+         && target_auxv_search (current_target, AT_PAGESZ, &dummy) == 0);
 }
 
 static int
@@ -1386,7 +1386,7 @@ linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size)
   LONGEST i, j, size;
 
   /* Determine list of SPU ids.  */
-  size = target_read_alloc (&current_target, TARGET_OBJECT_SPU,
+  size = target_read_alloc (current_target, TARGET_OBJECT_SPU,
                            NULL, &spu_ids);
 
   /* Generate corefile notes for each SPU file.  */
@@ -1401,7 +1401,7 @@ linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size)
          LONGEST spu_len;
 
          xsnprintf (annex, sizeof annex, "%d/%s", fd, spu_files[j]);
-         spu_len = target_read_alloc (&current_target, TARGET_OBJECT_SPU,
+         spu_len = target_read_alloc (current_target, TARGET_OBJECT_SPU,
                                       annex, &spu_data);
          if (spu_len > 0)
            {
@@ -1637,7 +1637,7 @@ linux_get_siginfo_data (struct gdbarch *gdbarch, LONGEST *size)
   buf = (gdb_byte *) xmalloc (TYPE_LENGTH (siginfo_type));
   cleanups = make_cleanup (xfree, buf);
 
-  bytes_read = target_read (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
+  bytes_read = target_read (current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
                            buf, 0, TYPE_LENGTH (siginfo_type));
   if (bytes_read == TYPE_LENGTH (siginfo_type))
     {
@@ -1975,7 +1975,7 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
     return NULL;
 
   /* Auxillary vector.  */
-  auxv_len = target_read_alloc (&current_target, TARGET_OBJECT_AUXV,
+  auxv_len = target_read_alloc (current_target, TARGET_OBJECT_AUXV,
                                NULL, &auxv);
   if (auxv_len > 0)
     {
@@ -2273,7 +2273,7 @@ find_mapping_size (CORE_ADDR vaddr, unsigned long size,
 static int
 linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
 {
-  if (target_auxv_search (&current_target, AT_SYSINFO_EHDR, &range->start) <= 0)
+  if (target_auxv_search (current_target, AT_SYSINFO_EHDR, &range->start) <= 0)
     return 0;
 
   /* This is installed by linux_init_abi below, so should always be
@@ -2397,13 +2397,13 @@ linux_displaced_step_location (struct gdbarch *gdbarch)
      local-store address and is thus not usable as displaced stepping
      location.  The auxiliary vector gets us the PowerPC-side entry
      point address instead.  */
-  if (target_auxv_search (&current_target, AT_ENTRY, &addr) <= 0)
+  if (target_auxv_search (current_target, AT_ENTRY, &addr) <= 0)
     error (_("Cannot find AT_ENTRY auxiliary vector entry."));
 
   /* Make certain that the address points at real code, and not a
      function descriptor.  */
   addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
-                                            &current_target);
+                                            current_target);
 
   /* Inferior calls also use the entry point as a breakpoint location.
      We don't want displaced stepping to interfere with those
index 66e9595b67bb86b702341d5e60fb31215c10e671..b77418d37ea0a034b6f535ff3ed08caaf01abe2e 100644 (file)
@@ -480,7 +480,7 @@ enable_thread_event (td_event_e event, CORE_ADDR *bp)
            (bfd_get_sign_extend_vma (exec_bfd) > 0
             ? (CORE_ADDR) (intptr_t) notify.u.bptaddr
             : (CORE_ADDR) (uintptr_t) notify.u.bptaddr),
-           &current_target));
+           current_target));
   create_thread_event_breakpoint (target_gdbarch (), *bp);
 
   return TD_OK;
@@ -1074,7 +1074,7 @@ thread_db_load (void)
     return 0;
 
   /* Don't attempt to use thread_db for remote targets.  */
-  if (!(target_can_run (&current_target) || core_bfd))
+  if (!(target_can_run (current_target) || core_bfd))
     return 0;
 
   if (thread_db_load_search ())
@@ -1182,7 +1182,7 @@ static void
 check_pid_namespace_match (void)
 {
   /* Check is only relevant for local targets targets.  */
-  if (target_can_run (&current_target))
+  if (target_can_run (current_target))
     {
       /* If the child is in a different PID namespace, its idea of its
         PID will differ from our idea of its PID.  When we scan the
index 2b25a9c9ee68ba5c5569c18769ff312643185807..6ab5ff2d91e9bccd557d953cb7f899b1bc43d540 100644 (file)
@@ -267,7 +267,7 @@ proceed_thread_callback (struct thread_info *thread, void *arg)
 static void
 exec_continue (char **argv, int argc)
 {
-  prepare_execution_command (&current_target, mi_async_p ());
+  prepare_execution_command (current_target, mi_async_p ());
 
   if (non_stop)
     {
@@ -1498,8 +1498,8 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
   make_cleanup (xfree, mbuf);
 
   /* Dispatch memory reads to the topmost target, not the flattened
-     current_target.  */
-  nr_bytes = target_read (current_target.beneath,
+     current_target->  */
+  nr_bytes = target_read (current_target->beneath,
                          TARGET_OBJECT_MEMORY, NULL, mbuf,
                          addr, total_bytes);
   if (nr_bytes <= 0)
@@ -1631,7 +1631,7 @@ mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc)
   addr = parse_and_eval_address (argv[0]) + offset;
   length = atol (argv[1]);
 
-  result = read_memory_robust (current_target.beneath, addr, length);
+  result = read_memory_robust (current_target->beneath, addr, length);
 
   cleanups = make_cleanup (free_memory_read_result_vector, result);
 
index d7097a9394d86abdc7fa57ac9dad40d40d570985..fc8624cec1a502bb9111ae409228b386afa17c9d 100644 (file)
@@ -1417,7 +1417,7 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc)
            func = gdbarch_convert_from_func_ptr_addr
                    (get_objfile_arch (objfile),
                     MSYMBOL_VALUE_ADDRESS (objfile, msymbol),
-                    &current_target);
+                    current_target);
 
            /* Ignore data symbols that are not function descriptors.  */
            if (func != MSYMBOL_VALUE_ADDRESS (objfile, msymbol))
index a24c52a5fde17bd4f20892e3f0a3ed1a9815ce57..47d5c091f88f1eaeb42c1ebdf52fad09adb5f25e 100644 (file)
@@ -486,7 +486,7 @@ write_exp_msymbol (struct parser_state *ps,
 
   /* The minimal symbol might point to a function descriptor;
      resolve it to the actual code address instead.  */
-  pc = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, &current_target);
+  pc = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, current_target);
   if (pc != addr)
     {
       struct bound_minimal_symbol ifunc_msym = lookup_minimal_symbol_by_pc (pc);
index 55aec00863523055a3669cf1aae2842c3de8032f..c037162725ac3ccb20fa728bdc6164da830268be 100644 (file)
@@ -1304,7 +1304,7 @@ ppc_linux_get_hwcap (void)
 {
   CORE_ADDR field;
 
-  if (target_auxv_search (&current_target, AT_HWCAP, &field))
+  if (target_auxv_search (current_target, AT_HWCAP, &field))
     return (unsigned long) field;
 
   return 0;
index 460c503fae1bb50ff1ad00daf4952e3e0f6d5ef5..c84ce737c16b3f2b9855951cafee3c8ceb0da197 100644 (file)
@@ -1194,7 +1194,7 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
   /* Look up cached address of thread-local variable.  */
   if (!ptid_equal (spe_context_cache_ptid, inferior_ptid))
     {
-      struct target_ops *target = &current_target;
+      struct target_ops *target = current_target;
 
       TRY
        {
@@ -1358,7 +1358,7 @@ ppu2spu_sniffer (const struct frame_unwind *self,
        return 0;
 
       xsnprintf (annex, sizeof annex, "%d/regs", data.id);
-      if (target_read (&current_target, TARGET_OBJECT_SPU, annex,
+      if (target_read (current_target, TARGET_OBJECT_SPU, annex,
                       data.gprs, 0, sizeof data.gprs)
          == sizeof data.gprs)
        {
index 20afdeea3bcb10215195d132de740752821652ca..73e1c5b0a2941ab5a089722907d81eac78de28a8 100644 (file)
@@ -4622,7 +4622,7 @@ procfs_inferior_created (struct target_ops *ops, int from_tty)
      the inferior ourselves, there is nothing to do when the inferior
      was created by attaching to an already running process, or when
      debugging a core file.  */
-  if (current_inferior ()->attach_flag || !target_can_run (&current_target))
+  if (current_inferior ()->attach_flag || !target_can_run (current_target))
     return;
 
   proc_trace_syscalls_1 (find_procinfo_or_die (ptid_get_pid (inferior_ptid),
@@ -5460,7 +5460,7 @@ procfs_make_note_section (struct target_ops *self, bfd *obfd, int *note_size)
                             &thread_args);
   note_data = thread_args.note_data;
 
-  auxv_len = target_read_alloc (&current_target, TARGET_OBJECT_AUXV,
+  auxv_len = target_read_alloc (current_target, TARGET_OBJECT_AUXV,
                                NULL, &auxv);
   if (auxv_len > 0)
     {
index e67f9d43f721294bc5afd2dfb7b17f2422ced304..b39fbffb309585a553c59dcd48856cdc01072e2a 100644 (file)
@@ -1500,7 +1500,7 @@ m32r_stopped_by_watchpoint (struct target_ops *ops)
 {
   CORE_ADDR addr;
 
-  return m32r_stopped_data_address (&current_target, &addr);
+  return m32r_stopped_data_address (current_target, &addr);
 }
 
 /* Check to see if a thread is still alive.  */
index f40f79160fca6b0a03e3300481dcea10e0d9e584..2ec9c6e74b87366539b9a3f9b4deb0ab1acf606b 100644 (file)
@@ -4162,7 +4162,7 @@ remote_check_symbols (void)
             instead of any data function descriptor.  */
          sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
                                                         sym_addr,
-                                                        &current_target);
+                                                        current_target);
 
          xsnprintf (msg, get_remote_packet_size (), "qSymbol:%s:%s",
                     phex_nz (sym_addr, addr_size), &reply[8]);
@@ -10010,7 +10010,7 @@ static VEC(mem_region_s) *
 remote_memory_map (struct target_ops *ops)
 {
   VEC(mem_region_s) *result = NULL;
-  char *text = target_read_stralloc (&current_target,
+  char *text = target_read_stralloc (current_target,
                                     TARGET_OBJECT_MEMORY_MAP, NULL);
 
   if (text)
@@ -12180,7 +12180,7 @@ remote_traceframe_info (struct target_ops *self)
 {
   char *text;
 
-  text = target_read_stralloc (&current_target,
+  text = target_read_stralloc (current_target,
                               TARGET_OBJECT_TRACEFRAME_INFO, NULL);
   if (text != NULL)
     {
@@ -12451,7 +12451,7 @@ btrace_read_config (struct btrace_config *conf)
 {
   char *xml;
 
-  xml = target_read_stralloc (&current_target,
+  xml = target_read_stralloc (current_target,
                              TARGET_OBJECT_BTRACE_CONF, "");
   if (xml != NULL)
     {
@@ -12607,8 +12607,8 @@ remote_read_btrace (struct target_ops *self,
                      (unsigned int) type);
     }
 
-  xml = target_read_stralloc (&current_target,
-                             TARGET_OBJECT_BTRACE, annex);
+  xml = target_read_stralloc (current_target,
+                              TARGET_OBJECT_BTRACE, annex);
   if (xml == NULL)
     return BTRACE_ERR_UNKNOWN;
 
@@ -12671,7 +12671,7 @@ remote_pid_to_exec_file (struct target_ops *self, int pid)
       xsnprintf (annex, annex_size, "%x", pid);
     }
 
-  filename = target_read_stralloc (&current_target,
+  filename = target_read_stralloc (current_target,
                                   TARGET_OBJECT_EXEC_FILE, annex);
 
   return filename;
index baf6b67d0963c3ff2c77d711e4afc8f588eff155..bcabea5dfc1fc8f341b60651010c765c433249c7 100644 (file)
@@ -4542,7 +4542,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
       return -1;
 
     case 1014:         /* Data Cache Block set to Zero */
-      if (target_auxv_search (&current_target, AT_DCACHEBSIZE, &at_dcsz) <= 0
+      if (target_auxv_search (current_target, AT_DCACHEBSIZE, &at_dcsz) <= 0
          || at_dcsz == 0)
        at_dcsz = 128; /* Assume 128-byte cache line size (POWER8)  */
 
index 3bb99c8077b6a34b3056152dee20069de960d9e5..342bca0b5db777e16ad53894a35141f089dde632 100644 (file)
@@ -678,7 +678,7 @@ s390_read_description (struct target_ops *ops)
   {
     CORE_ADDR hwcap = 0;
 
-    target_auxv_search (&current_target, AT_HWCAP, &hwcap);
+    target_auxv_search (current_target, AT_HWCAP, &hwcap);
     have_regset_tdb = (hwcap & HWCAP_S390_TE)
       && check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset);
 
index fcf93d701bc9eeb5ffc5d2257e72fdb2b26a5576..0032c78e17e7f9bd8aa5e305040b5e67f065c07e 100644 (file)
@@ -1144,7 +1144,7 @@ s390_load (struct s390_prologue_data *data,
   if (pv_is_constant (addr))
     {
       struct target_section *secp;
-      secp = target_section_by_addr (&current_target, addr.k);
+      secp = target_section_by_addr (current_target, addr.k);
       if (secp != NULL
          && (bfd_get_section_flags (secp->the_bfd_section->owner,
                                     secp->the_bfd_section)
index 066295ce8c9dd437a28afc7541bf23de8ba0087c..45b41e762c9ab064cf8e4ee938b6a10863b0e8a5 100644 (file)
@@ -581,7 +581,7 @@ check_for_thread_db (void)
   ptid_t ptid;
 
   /* Don't attempt to use thread_db for remote targets.  */
-  if (!(target_can_run (&current_target) || core_bfd))
+  if (!(target_can_run (current_target) || core_bfd))
     return;
 
   /* Do nothing if we couldn't load libthread_db.so.1.  */
@@ -1203,7 +1203,7 @@ sol_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
     {
       /* The list of threads is probably not up to date.  Find any
          thread that is missing from the list, and try again.  */
-      sol_update_thread_list (&current_target);
+      sol_update_thread_list (current_target);
       thread_info = iterate_over_threads (thread_db_find_thread_from_tid,
                                           &thread);
     }
index 0310e66ff87271e1936bd69f61ba8105be68ba1a..98cfbac0e287a2cd3741b586b3132a1134d9f3b9 100644 (file)
@@ -303,7 +303,7 @@ solib_aix_get_library_list (struct inferior *inf, const char *warning_msg)
   if (data->library_list != NULL)
     return data->library_list;
 
-  library_document = target_read_stralloc (&current_target,
+  library_document = target_read_stralloc (current_target,
                                            TARGET_OBJECT_LIBRARIES_AIX,
                                            NULL);
   if (library_document == NULL && warning_msg != NULL)
index 876ca8cfce25d56547db3dcebfd6bd7c53679a86..6ead69498441bd59b837dfa8344bf5f92a1b7343 100644 (file)
@@ -482,7 +482,7 @@ darwin_solib_read_all_image_info_addr (struct darwin_info *info)
   LONGEST len;
   enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
 
-  len = target_read (&current_target, TARGET_OBJECT_DARWIN_DYLD_INFO, NULL,
+  len = target_read (current_target, TARGET_OBJECT_DARWIN_DYLD_INFO, NULL,
                      buf, 0, sizeof (buf));
   if (len != sizeof (buf))
     return;
index 3218bbec6358f2238f4d065fc8da694ae1dd1735..7d33d109683d5e2755cbc368cdf46d0b3e3705ca 100644 (file)
@@ -290,7 +290,7 @@ dsbt_get_initial_loadmaps (void)
   gdb_byte *buf;
   struct dsbt_info *info = get_dsbt_info ();
 
-  if (0 >= target_read_alloc (&current_target, TARGET_OBJECT_FDPIC,
+  if (0 >= target_read_alloc (current_target, TARGET_OBJECT_FDPIC,
                              "exec", &buf))
     {
       info->exec_loadmap = NULL;
@@ -300,7 +300,7 @@ dsbt_get_initial_loadmaps (void)
   if (solib_dsbt_debug)
     dsbt_print_loadmap (info->exec_loadmap);
 
-  if (0 >= target_read_alloc (&current_target, TARGET_OBJECT_FDPIC,
+  if (0 >= target_read_alloc (current_target, TARGET_OBJECT_FDPIC,
                              "interp", &buf))
     {
       info->interp_loadmap = NULL;
index 468ab1a35056247c978384f602b7ee682ef2b145..1df7422baca94825b6ceff58085a555a7dde2242 100644 (file)
@@ -171,7 +171,7 @@ spu_current_sos (void)
     ;
 
   /* Determine list of SPU ids.  */
-  size = target_read (&current_target, TARGET_OBJECT_SPU, NULL,
+  size = target_read (current_target, TARGET_OBJECT_SPU, NULL,
                      buf, 0, sizeof buf);
 
   /* Do not add stand-alone SPE executable context as shared library,
@@ -206,7 +206,7 @@ spu_current_sos (void)
         already created the SPE context, but not installed the object-id
         yet.  Skip such entries; we'll be back for them later.  */
       xsnprintf (annex, sizeof annex, "%d/object-id", fd);
-      len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+      len = target_read (current_target, TARGET_OBJECT_SPU, annex,
                         (gdb_byte *) id, 0, sizeof id);
       if (len <= 0 || len >= sizeof id)
        continue;
@@ -421,7 +421,7 @@ spu_enable_break (struct objfile *objfile)
       CORE_ADDR addr = BMSYMBOL_VALUE_ADDRESS (spe_event_sym);
 
       addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), addr,
-                                                 &current_target);
+                                                 current_target);
       create_solib_event_breakpoint (target_gdbarch (), addr);
       return 1;
     }
index 55b8f5566774fb566c00c11b57840973278748d7..a25d4db5e46b019149ebc83a2f8881da65968541 100644 (file)
@@ -459,11 +459,11 @@ read_program_header (int type, int *p_sect_size, int *p_arch_size,
   int pt_phdr_p = 0;
 
   /* Get required auxv elements from target.  */
-  if (target_auxv_search (&current_target, AT_PHDR, &at_phdr) <= 0)
+  if (target_auxv_search (current_target, AT_PHDR, &at_phdr) <= 0)
     return 0;
-  if (target_auxv_search (&current_target, AT_PHENT, &at_phent) <= 0)
+  if (target_auxv_search (current_target, AT_PHENT, &at_phent) <= 0)
     return 0;
-  if (target_auxv_search (&current_target, AT_PHNUM, &at_phnum) <= 0)
+  if (target_auxv_search (current_target, AT_PHNUM, &at_phnum) <= 0)
     return 0;
   if (!at_phdr || !at_phnum)
     return 0;
@@ -1291,7 +1291,7 @@ svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list,
   gdb_assert (annex == NULL || target_augmented_libraries_svr4_read ());
 
   /* Fetch the list of shared libraries.  */
-  svr4_library_document = target_read_stralloc (&current_target,
+  svr4_library_document = target_read_stralloc (current_target,
                                                TARGET_OBJECT_LIBRARIES_SVR4,
                                                annex);
   if (svr4_library_document == NULL)
@@ -1614,7 +1614,7 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)
 
   /* Cause svr4_current_sos() to be run if it hasn't been already.  */
   if (info->main_lm_addr == 0)
-    solib_add (NULL, 0, &current_target, auto_solib_add);
+    solib_add (NULL, 0, current_target, auto_solib_add);
 
   /* svr4_current_sos() will set main_lm_addr for the main executable.  */
   if (objfile == symfile_objfile)
@@ -2274,7 +2274,7 @@ enable_break (struct svr4_info *info, int from_tty)
      mean r_brk has already been relocated.  Assume the dynamic linker
      is the object containing r_brk.  */
 
-  solib_add (NULL, from_tty, &current_target, auto_solib_add);
+  solib_add (NULL, from_tty, current_target, auto_solib_add);
   sym_addr = 0;
   if (info->debug_base && solib_svr4_r_map (info) != 0)
     sym_addr = solib_svr4_r_brk (info);
@@ -2286,7 +2286,7 @@ enable_break (struct svr4_info *info, int from_tty)
       sym_addr = gdbarch_addr_bits_remove
        (target_gdbarch (), gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
                                                             sym_addr,
-                                                            &current_target));
+                                                            current_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
@@ -2403,7 +2403,7 @@ enable_break (struct svr4_info *info, int from_tty)
       /* If we were not able to find the base address of the loader
          from our so_list, then try using the AT_BASE auxilliary entry.  */
       if (!load_addr_found)
-        if (target_auxv_search (&current_target, AT_BASE, &load_addr) > 0)
+        if (target_auxv_search (current_target, AT_BASE, &load_addr) > 0)
          {
            int addr_bit = gdbarch_addr_bit (target_gdbarch ());
 
@@ -2452,7 +2452,7 @@ enable_break (struct svr4_info *info, int from_tty)
          info->debug_loader_name = xstrdup (interp_name);
          info->debug_loader_offset_p = 1;
          info->debug_loader_offset = load_addr;
-         solib_add (NULL, from_tty, &current_target, auto_solib_add);
+         solib_add (NULL, from_tty, current_target, auto_solib_add);
        }
 
       /* Record the relocated start and end address of the dynamic linker
@@ -2527,7 +2527,7 @@ enable_break (struct svr4_info *info, int from_tty)
          sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
          sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
                                                         sym_addr,
-                                                        &current_target);
+                                                        current_target);
          svr4_create_solib_event_breakpoints (target_gdbarch (), sym_addr);
          return 1;
        }
@@ -2544,7 +2544,7 @@ enable_break (struct svr4_info *info, int from_tty)
              sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
              sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
                                                             sym_addr,
-                                                            &current_target);
+                                                            current_target);
              svr4_create_solib_event_breakpoints (target_gdbarch (), sym_addr);
              return 1;
            }
@@ -2647,7 +2647,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
   if ((bfd_get_file_flags (exec_bfd) & DYNAMIC) == 0)
     return 0;
 
-  if (target_auxv_search (&current_target, AT_ENTRY, &entry_point) <= 0)
+  if (target_auxv_search (current_target, AT_ENTRY, &entry_point) <= 0)
     return 0;
 
   exec_displacement = entry_point - bfd_get_start_address (exec_bfd);
index 7745a4a08cdc01436f69f62428be2de6b71d9207..ab700b112eb831cd605f51784e7dd75a1f18ed7e 100644 (file)
@@ -260,7 +260,7 @@ solib_target_current_sos (void)
   int ix;
 
   /* Fetch the list of shared libraries.  */
-  library_document = target_read_stralloc (&current_target,
+  library_document = target_read_stralloc (current_target,
                                           TARGET_OBJECT_LIBRARIES,
                                           NULL);
   if (library_document == NULL)
index 9a6e7dee458ef9923bbe16338f68fe4bd0c4053d..8b63375c9f971570c760a74a29987e7187a307d4 100644 (file)
@@ -1340,7 +1340,7 @@ handle_solib_event (void)
      be adding them automatically.  Switch terminal for any messages
      produced by breakpoint_re_set.  */
   target_terminal_ours_for_output ();
-  solib_add (NULL, 0, &current_target, auto_solib_add);
+  solib_add (NULL, 0, current_target, auto_solib_add);
   target_terminal_inferior ();
 }
 
index b2bba262264e7e5c42335040aaa9b45c97997035..a98902eb543577f895a108847153fdca56b6b038 100644 (file)
@@ -187,7 +187,7 @@ ULONGEST
 sparc_fetch_wcookie (struct gdbarch *gdbarch)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  struct target_ops *ops = &current_target;
+  struct target_ops *ops = current_target;
   gdb_byte buf[8];
   int len;
 
index c94b46e8f4f7b7e2cc10a3ae8a6d041437e820a8..c188baa5071b8ae7e1054b157e17985023e5be72 100644 (file)
@@ -198,7 +198,7 @@ spu_pseudo_register_read_spu (struct regcache *regcache, const char *regname,
     return status;
   xsnprintf (annex, sizeof annex, "%d/%s", (int) id, regname);
   memset (reg, 0, sizeof reg);
-  target_read (&current_target, TARGET_OBJECT_SPU, annex,
+  target_read (current_target, TARGET_OBJECT_SPU, annex,
               reg, 0, sizeof reg);
 
   ul = strtoulst ((char *) reg, NULL, 16);
@@ -229,7 +229,7 @@ spu_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
       if (status != REG_VALID)
        return status;
       xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id);
-      target_read (&current_target, TARGET_OBJECT_SPU, annex, buf, 0, 16);
+      target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, 16);
       return status;
 
     case SPU_SRR0_REGNUM:
@@ -263,7 +263,7 @@ spu_pseudo_register_write_spu (struct regcache *regcache, const char *regname,
   xsnprintf (annex, sizeof annex, "%d/%s", (int) id, regname);
   xsnprintf (reg, sizeof reg, "0x%s",
             phex_nz (extract_unsigned_integer (buf, 4, byte_order), 4));
-  target_write (&current_target, TARGET_OBJECT_SPU, annex,
+  target_write (current_target, TARGET_OBJECT_SPU, annex,
                (gdb_byte *) reg, 0, strlen (reg));
 }
 
@@ -286,7 +286,7 @@ spu_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
     case SPU_FPSCR_REGNUM:
       regcache_raw_read_unsigned (regcache, SPU_ID_REGNUM, &id);
       xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id);
-      target_write (&current_target, TARGET_OBJECT_SPU, annex, buf, 0, 16);
+      target_write (current_target, TARGET_OBJECT_SPU, annex, buf, 0, 16);
       break;
 
     case SPU_SRR0_REGNUM:
@@ -2103,7 +2103,7 @@ info_spu_event_command (char *args, int from_tty)
   id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
 
   xsnprintf (annex, sizeof annex, "%d/event_status", id);
-  len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+  len = target_read (current_target, TARGET_OBJECT_SPU, annex,
                     buf, 0, (sizeof (buf) - 1));
   if (len <= 0)
     error (_("Could not read event_status."));
@@ -2111,7 +2111,7 @@ info_spu_event_command (char *args, int from_tty)
   event_status = strtoulst ((char *) buf, NULL, 16);
  
   xsnprintf (annex, sizeof annex, "%d/event_mask", id);
-  len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+  len = target_read (current_target, TARGET_OBJECT_SPU, annex,
                     buf, 0, (sizeof (buf) - 1));
   if (len <= 0)
     error (_("Could not read event_mask."));
@@ -2160,7 +2160,7 @@ info_spu_signal_command (char *args, int from_tty)
   id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
 
   xsnprintf (annex, sizeof annex, "%d/signal1", id);
-  len = target_read (&current_target, TARGET_OBJECT_SPU, annex, buf, 0, 4);
+  len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, 4);
   if (len < 0)
     error (_("Could not read signal1."));
   else if (len == 4)
@@ -2170,7 +2170,7 @@ info_spu_signal_command (char *args, int from_tty)
     }
     
   xsnprintf (annex, sizeof annex, "%d/signal1_type", id);
-  len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+  len = target_read (current_target, TARGET_OBJECT_SPU, annex,
                     buf, 0, (sizeof (buf) - 1));
   if (len <= 0)
     error (_("Could not read signal1_type."));
@@ -2178,7 +2178,7 @@ info_spu_signal_command (char *args, int from_tty)
   signal1_type = strtoulst ((char *) buf, NULL, 16);
 
   xsnprintf (annex, sizeof annex, "%d/signal2", id);
-  len = target_read (&current_target, TARGET_OBJECT_SPU, annex, buf, 0, 4);
+  len = target_read (current_target, TARGET_OBJECT_SPU, annex, buf, 0, 4);
   if (len < 0)
     error (_("Could not read signal2."));
   else if (len == 4)
@@ -2188,7 +2188,7 @@ info_spu_signal_command (char *args, int from_tty)
     }
     
   xsnprintf (annex, sizeof annex, "%d/signal2_type", id);
-  len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+  len = target_read (current_target, TARGET_OBJECT_SPU, annex,
                     buf, 0, (sizeof (buf) - 1));
   if (len <= 0)
     error (_("Could not read signal2_type."));
@@ -2283,7 +2283,7 @@ info_spu_mailbox_command (char *args, int from_tty)
   chain = make_cleanup_ui_out_tuple_begin_end (current_uiout, "SPUInfoMailbox");
 
   xsnprintf (annex, sizeof annex, "%d/mbox_info", id);
-  len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+  len = target_read (current_target, TARGET_OBJECT_SPU, annex,
                     buf, 0, sizeof buf);
   if (len < 0)
     error (_("Could not read mbox_info."));
@@ -2292,7 +2292,7 @@ info_spu_mailbox_command (char *args, int from_tty)
                         "mbox", "SPU Outbound Mailbox");
 
   xsnprintf (annex, sizeof annex, "%d/ibox_info", id);
-  len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+  len = target_read (current_target, TARGET_OBJECT_SPU, annex,
                     buf, 0, sizeof buf);
   if (len < 0)
     error (_("Could not read ibox_info."));
@@ -2301,7 +2301,7 @@ info_spu_mailbox_command (char *args, int from_tty)
                         "ibox", "SPU Outbound Interrupt Mailbox");
 
   xsnprintf (annex, sizeof annex, "%d/wbox_info", id);
-  len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+  len = target_read (current_target, TARGET_OBJECT_SPU, annex,
                     buf, 0, sizeof buf);
   if (len < 0)
     error (_("Could not read wbox_info."));
@@ -2523,7 +2523,7 @@ info_spu_dma_command (char *args, int from_tty)
   id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
 
   xsnprintf (annex, sizeof annex, "%d/dma_info", id);
-  len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+  len = target_read (current_target, TARGET_OBJECT_SPU, annex,
                     buf, 0, 40 + 16 * 32);
   if (len <= 0)
     error (_("Could not read dma_info."));
@@ -2602,7 +2602,7 @@ info_spu_proxydma_command (char *args, int from_tty)
   id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
 
   xsnprintf (annex, sizeof annex, "%d/proxydma_info", id);
-  len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+  len = target_read (current_target, TARGET_OBJECT_SPU, annex,
                     buf, 0, 24 + 8 * 32);
   if (len <= 0)
     error (_("Could not read proxydma_info."));
index 682e3cab6dc7d6665d93c63c6447f05a58412f0e..6cba9eedbf216caa59148d1cdef85e634e2d7324 100644 (file)
@@ -946,7 +946,7 @@ init_entry_point_info (struct objfile *objfile)
       entry_point
        = gdbarch_convert_from_func_ptr_addr (get_objfile_arch (objfile),
                                              entry_point,
-                                             &current_target);
+                                             current_target);
 
       /* Remove any ISA markers, so that this matches entries in the
         symbol table.  */
index de365c9c6537e390fccb09ec62e8ebf60786fe16..fa7313fbb2331a3d5255eeba3942599cb379bdaa 100644 (file)
@@ -348,11 +348,11 @@ target_find_description (void)
   /* Next try to read the description from the current target using
      target objects.  */
   if (current_target_desc == NULL)
-    current_target_desc = target_read_description_xml (&current_target);
+    current_target_desc = target_read_description_xml (current_target);
 
   /* If that failed try a target-specific hook.  */
   if (current_target_desc == NULL)
-    current_target_desc = target_read_description (&current_target);
+    current_target_desc = target_read_description (current_target);
 
   /* If a non-NULL description was returned, then update the current
      architecture.  */
index 9067033e1f4ca108d35766c7fb1818871b116733..2812b9d68134994bf1a0be77d5c5e55585f0e352 100644 (file)
@@ -397,7 +397,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
     {
       LONGEST len;
 
-      len = target_write_with_progress (current_target.beneath,
+      len = target_write_with_progress (current_target->beneath,
                                        TARGET_OBJECT_MEMORY, NULL,
                                        r->data, r->begin, r->end - r->begin,
                                        progress_cb, r->baton);
@@ -420,7 +420,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
        {
          LONGEST len;
 
-         len = target_write_with_progress (&current_target,
+         len = target_write_with_progress (current_target,
                                            TARGET_OBJECT_FLASH, NULL,
                                            r->data, r->begin,
                                            r->end - r->begin,
index c791aa592891fc0d7a47d078055296edf5c87ed9..345a668517508b9073b3c4ae71fb59c028e4097f 100644 (file)
@@ -130,7 +130,7 @@ static struct target_ops *target_stack;
 /* The target structure we are currently using to talk to a process
    or file or whatever "inferior" we have.  */
 
-struct target_ops current_target;
+struct target_ops *current_target;
 
 /* Command list for target.  */
 
@@ -249,7 +249,7 @@ target_has_all_memory_1 (void)
 {
   struct target_ops *t;
 
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  for (t = current_target->beneath; t != NULL; t = t->beneath)
     if (t->to_has_all_memory (t))
       return 1;
 
@@ -261,7 +261,7 @@ target_has_memory_1 (void)
 {
   struct target_ops *t;
 
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  for (t = current_target->beneath; t != NULL; t = t->beneath)
     if (t->to_has_memory (t))
       return 1;
 
@@ -273,7 +273,7 @@ target_has_stack_1 (void)
 {
   struct target_ops *t;
 
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  for (t = current_target->beneath; t != NULL; t = t->beneath)
     if (t->to_has_stack (t))
       return 1;
 
@@ -285,7 +285,7 @@ target_has_registers_1 (void)
 {
   struct target_ops *t;
 
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  for (t = current_target->beneath; t != NULL; t = t->beneath)
     if (t->to_has_registers (t))
       return 1;
 
@@ -297,7 +297,7 @@ target_has_execution_1 (ptid_t the_ptid)
 {
   struct target_ops *t;
 
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  for (t = current_target->beneath; t != NULL; t = t->beneath)
     if (t->to_has_execution (t, the_ptid))
       return 1;
 
@@ -421,14 +421,14 @@ add_deprecated_target_alias (struct target_ops *t, char *alias)
 void
 target_kill (void)
 {
-  current_target.to_kill (&current_target);
+  current_target->to_kill (current_target);
 }
 
 void
 target_load (const char *arg, int from_tty)
 {
   target_dcache_invalidate ();
-  (*current_target.to_load) (&current_target, arg, from_tty);
+  (*current_target->to_load) (current_target, arg, from_tty);
 }
 
 /* Possible terminal states.  */
@@ -453,7 +453,7 @@ static enum terminal_state terminal_state = terminal_is_ours;
 void
 target_terminal_init (void)
 {
-  (*current_target.to_terminal_init) (&current_target);
+  (*current_target->to_terminal_init) (current_target);
 
   terminal_state = terminal_is_ours;
 }
@@ -483,7 +483,7 @@ target_terminal_inferior (void)
 
   /* If GDB is resuming the inferior in the foreground, install
      inferior's terminal modes.  */
-  (*current_target.to_terminal_inferior) (&current_target);
+  (*current_target->to_terminal_inferior) (current_target);
   terminal_state = terminal_is_inferior;
 }
 
@@ -495,7 +495,7 @@ target_terminal_ours (void)
   if (terminal_state == terminal_is_ours)
     return;
 
-  (*current_target.to_terminal_ours) (&current_target);
+  (*current_target->to_terminal_ours) (current_target);
   terminal_state = terminal_is_ours;
 }
 
@@ -506,7 +506,7 @@ target_terminal_ours_for_output (void)
 {
   if (terminal_state != terminal_is_inferior)
     return;
-  (*current_target.to_terminal_ours_for_output) (&current_target);
+  (*current_target->to_terminal_ours_for_output) (current_target);
   terminal_state = terminal_is_ours_for_output;
 }
 
@@ -517,7 +517,7 @@ target_supports_terminal_ours (void)
 {
   struct target_ops *t;
 
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  for (t = current_target->beneath; t != NULL; t = t->beneath)
     {
       if (t->to_terminal_ours != delegate_terminal_ours
          && t->to_terminal_ours != tdefault_terminal_ours)
@@ -565,7 +565,7 @@ static void
 tcomplain (void)
 {
   error (_("You can't do that when your target is `%s'"),
-        current_target.to_shortname);
+        current_target->to_shortname);
 }
 
 void
@@ -622,16 +622,16 @@ update_current_target (void)
   struct target_ops *t;
 
   /* First, reset current's contents.  */
-  memset (&current_target, 0, sizeof (current_target));
+  memset (current_target, 0, sizeof (struct target_ops));
 
   /* Install the delegators.  */
-  install_delegators (&current_target);
+  install_delegators (current_target);
 
-  current_target.to_stratum = target_stack->to_stratum;
+  current_target->to_stratum = target_stack->to_stratum;
 
 #define INHERIT(FIELD, TARGET) \
-      if (!current_target.FIELD) \
-       current_target.FIELD = (TARGET)->FIELD
+      if (!current_target->FIELD) \
+       current_target->FIELD = (TARGET)->FIELD
 
   /* Do not add any new INHERITs here.  Instead, use the delegation
      mechanism provided by make-target-delegates.  */
@@ -649,7 +649,7 @@ update_current_target (void)
   /* Finally, position the target-stack beneath the squashed
      "current_target".  That way code looking for a non-inherited
      target method can quickly and simply find it.  */
-  current_target.beneath = target_stack;
+  current_target->beneath = target_stack;
 
   if (targetdebug)
     setup_target_debug ();
@@ -771,7 +771,7 @@ unpush_target (struct target_ops *t)
 void
 pop_all_targets_above (enum strata above_stratum)
 {
-  while ((int) (current_target.to_stratum) > (int) above_stratum)
+  while ((int) (current_target->to_stratum) > (int) above_stratum)
     {
       if (!unpush_target (target_stack))
        {
@@ -831,7 +831,7 @@ CORE_ADDR
 target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
 {
   volatile CORE_ADDR addr = 0;
-  struct target_ops *target = &current_target;
+  struct target_ops *target = current_target;
 
   if (gdbarch_fetch_tls_load_module_address_p (target_gdbarch ()))
     {
@@ -1414,10 +1414,10 @@ target_xfer_partial (struct target_ops *ops,
 int
 target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
 {
-  /* Dispatch to the topmost target, not the flattened current_target.
+  /* Dispatch to the topmost target, not the flattened current_target->
      Memory accesses check target->to_has_(all_)memory, and the
      flattened target doesn't inherit those.  */
-  if (target_read (current_target.beneath, TARGET_OBJECT_MEMORY, NULL,
+  if (target_read (current_target->beneath, TARGET_OBJECT_MEMORY, NULL,
                   myaddr, memaddr, len) == len)
     return 0;
   else
@@ -1448,8 +1448,8 @@ int
 target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
 {
   /* See comment in target_read_memory about why the request starts at
-     current_target.beneath.  */
-  if (target_read (current_target.beneath, TARGET_OBJECT_RAW_MEMORY, NULL,
+     current_target->beneath.  */
+  if (target_read (current_target->beneath, TARGET_OBJECT_RAW_MEMORY, NULL,
                   myaddr, memaddr, len) == len)
     return 0;
   else
@@ -1463,8 +1463,8 @@ int
 target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
 {
   /* See comment in target_read_memory about why the request starts at
-     current_target.beneath.  */
-  if (target_read (current_target.beneath, TARGET_OBJECT_STACK_MEMORY, NULL,
+     current_target->beneath.  */
+  if (target_read (current_target->beneath, TARGET_OBJECT_STACK_MEMORY, NULL,
                   myaddr, memaddr, len) == len)
     return 0;
   else
@@ -1478,8 +1478,8 @@ int
 target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
 {
   /* See comment in target_read_memory about why the request starts at
-     current_target.beneath.  */
-  if (target_read (current_target.beneath, TARGET_OBJECT_CODE_MEMORY, NULL,
+     current_target->beneath.  */
+  if (target_read (current_target->beneath, TARGET_OBJECT_CODE_MEMORY, NULL,
                   myaddr, memaddr, len) == len)
     return 0;
   else
@@ -1496,8 +1496,8 @@ int
 target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
 {
   /* See comment in target_read_memory about why the request starts at
-     current_target.beneath.  */
-  if (target_write (current_target.beneath, TARGET_OBJECT_MEMORY, NULL,
+     current_target->beneath.  */
+  if (target_write (current_target->beneath, TARGET_OBJECT_MEMORY, NULL,
                    myaddr, memaddr, len) == len)
     return 0;
   else
@@ -1514,8 +1514,8 @@ int
 target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
 {
   /* See comment in target_read_memory about why the request starts at
-     current_target.beneath.  */
-  if (target_write (current_target.beneath, TARGET_OBJECT_RAW_MEMORY, NULL,
+     current_target->beneath.  */
+  if (target_write (current_target->beneath, TARGET_OBJECT_RAW_MEMORY, NULL,
                    myaddr, memaddr, len) == len)
     return 0;
   else
@@ -1532,7 +1532,7 @@ target_memory_map (void)
   int ix;
   struct target_ops *t;
 
-  result = current_target.to_memory_map (&current_target);
+  result = current_target->to_memory_map (current_target);
   if (result == NULL)
     return NULL;
 
@@ -1563,13 +1563,13 @@ target_memory_map (void)
 void
 target_flash_erase (ULONGEST address, LONGEST length)
 {
-  current_target.to_flash_erase (&current_target, address, length);
+  current_target->to_flash_erase (current_target, address, length);
 }
 
 void
 target_flash_done (void)
 {
-  current_target.to_flash_done (&current_target);
+  current_target->to_flash_done (current_target);
 }
 
 static void
@@ -2072,7 +2072,7 @@ target_insert_breakpoint (struct gdbarch *gdbarch,
       return 1;
     }
 
-  return current_target.to_insert_breakpoint (&current_target,
+  return current_target->to_insert_breakpoint (current_target,
                                              gdbarch, bp_tgt);
 }
 
@@ -2092,7 +2092,7 @@ target_remove_breakpoint (struct gdbarch *gdbarch,
       return 1;
     }
 
-  return current_target.to_remove_breakpoint (&current_target,
+  return current_target->to_remove_breakpoint (current_target,
                                              gdbarch, bp_tgt);
 }
 
@@ -2235,7 +2235,7 @@ target_detach (const char *args, int from_tty)
 
   prepare_for_detach ();
 
-  current_target.to_detach (&current_target, args, from_tty);
+  current_target->to_detach (current_target, args, from_tty);
 }
 
 void
@@ -2246,13 +2246,13 @@ target_disconnect (const char *args, int from_tty)
      disconnecting.  */
   remove_breakpoints ();
 
-  current_target.to_disconnect (&current_target, args, from_tty);
+  current_target->to_disconnect (current_target, args, from_tty);
 }
 
 ptid_t
 target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
 {
-  return (current_target.to_wait) (&current_target, ptid, status, options);
+  return (current_target->to_wait) (current_target, ptid, status, options);
 }
 
 /* See target.h.  */
@@ -2269,13 +2269,13 @@ default_target_wait (struct target_ops *ops,
 char *
 target_pid_to_str (ptid_t ptid)
 {
-  return (*current_target.to_pid_to_str) (&current_target, ptid);
+  return (*current_target->to_pid_to_str) (current_target, ptid);
 }
 
 char *
 target_thread_name (struct thread_info *info)
 {
-  return current_target.to_thread_name (&current_target, info);
+  return current_target->to_thread_name (current_target, info);
 }
 
 void
@@ -2285,7 +2285,7 @@ target_resume (ptid_t ptid, int step, enum gdb_signal signal)
 
   target_dcache_invalidate ();
 
-  current_target.to_resume (&current_target, ptid, step, signal);
+  current_target->to_resume (current_target, ptid, step, signal);
 
   registers_changed_ptid (ptid);
   /* We only set the internal executing state here.  The user/frontend
@@ -2297,13 +2297,13 @@ target_resume (ptid_t ptid, int step, enum gdb_signal signal)
 void
 target_pass_signals (int numsigs, unsigned char *pass_signals)
 {
-  (*current_target.to_pass_signals) (&current_target, numsigs, pass_signals);
+  (*current_target->to_pass_signals) (current_target, numsigs, pass_signals);
 }
 
 void
 target_program_signals (int numsigs, unsigned char *program_signals)
 {
-  (*current_target.to_program_signals) (&current_target,
+  (*current_target->to_program_signals) (current_target,
                                        numsigs, program_signals);
 }
 
@@ -2322,7 +2322,7 @@ default_follow_fork (struct target_ops *self, int follow_child,
 int
 target_follow_fork (int follow_child, int detach_fork)
 {
-  return current_target.to_follow_fork (&current_target,
+  return current_target->to_follow_fork (current_target,
                                        follow_child, detach_fork);
 }
 
@@ -2331,7 +2331,7 @@ target_follow_fork (int follow_child, int detach_fork)
 void
 target_follow_exec (struct inferior *inf, char *execd_pathname)
 {
-  current_target.to_follow_exec (&current_target, inf, execd_pathname);
+  current_target->to_follow_exec (current_target, inf, execd_pathname);
 }
 
 static void
@@ -2344,7 +2344,7 @@ default_mourn_inferior (struct target_ops *self)
 void
 target_mourn_inferior (void)
 {
-  current_target.to_mourn_inferior (&current_target);
+  current_target->to_mourn_inferior (current_target);
 
   /* We no longer need to keep handles on any of the object files.
      Make sure to release them to avoid unnecessarily locking any
@@ -2477,7 +2477,7 @@ default_search_memory (struct target_ops *self,
                       CORE_ADDR *found_addrp)
 {
   /* Start over from the top of the target stack.  */
-  return simple_search_memory (current_target.beneath,
+  return simple_search_memory (current_target->beneath,
                               start_addr, search_space_len,
                               pattern, pattern_len, found_addrp);
 }
@@ -2494,7 +2494,7 @@ target_search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
                      const gdb_byte *pattern, ULONGEST pattern_len,
                      CORE_ADDR *found_addrp)
 {
-  return current_target.to_search_memory (&current_target, start_addr,
+  return current_target->to_search_memory (current_target, start_addr,
                                          search_space_len,
                                          pattern, pattern_len, found_addrp);
 }
@@ -2600,7 +2600,7 @@ find_attach_target (void)
   struct target_ops *t;
 
   /* If a target on the current stack can attach, use it.  */
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  for (t = current_target->beneath; t != NULL; t = t->beneath)
     {
       if (t->to_attach != NULL)
        break;
@@ -2621,7 +2621,7 @@ find_run_target (void)
   struct target_ops *t;
 
   /* If a target on the current stack can attach, use it.  */
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  for (t = current_target->beneath; t != NULL; t = t->beneath)
     {
       if (t->to_create_inferior != NULL)
        break;
@@ -2644,8 +2644,8 @@ target_info_proc (const char *args, enum info_proc_what what)
   /* If we're already connected to something that can get us OS
      related data, use it.  Otherwise, try using the native
      target.  */
-  if (current_target.to_stratum >= process_stratum)
-    t = current_target.beneath;
+  if (current_target->to_stratum >= process_stratum)
+    t = current_target->beneath;
   else
     t = find_default_run_target (NULL);
 
@@ -2682,7 +2682,7 @@ target_supports_disable_randomization (void)
 {
   struct target_ops *t;
 
-  for (t = &current_target; t != NULL; t = t->beneath)
+  for (t = current_target; t != NULL; t = t->beneath)
     if (t->to_supports_disable_randomization)
       return t->to_supports_disable_randomization (t);
 
@@ -2697,8 +2697,8 @@ target_get_osdata (const char *type)
   /* If we're already connected to something that can get us OS
      related data, use it.  Otherwise, try using the native
      target.  */
-  if (current_target.to_stratum >= process_stratum)
-    t = current_target.beneath;
+  if (current_target->to_stratum >= process_stratum)
+    t = current_target->beneath;
   else
     t = find_default_run_target ("get OS data");
 
@@ -2732,7 +2732,7 @@ target_thread_address_space (ptid_t ptid)
 {
   struct address_space *aspace;
 
-  aspace = current_target.to_thread_address_space (&current_target, ptid);
+  aspace = current_target->to_thread_address_space (current_target, ptid);
   gdb_assert (aspace != NULL);
 
   return aspace;
@@ -2746,8 +2746,8 @@ default_fileio_target (void)
 {
   /* If we're already connected to something that can perform
      file I/O, use it. Otherwise, try using the native target.  */
-  if (current_target.to_stratum >= process_stratum)
-    return current_target.beneath;
+  if (current_target->to_stratum >= process_stratum)
+    return current_target->beneath;
   else
     return find_default_run_target ("file I/O");
 }
@@ -3202,7 +3202,7 @@ find_target_at (enum strata stratum)
 {
   struct target_ops *t;
 
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  for (t = current_target->beneath; t != NULL; t = t->beneath)
     if (t->to_stratum == stratum)
       return t;
 
@@ -3321,13 +3321,13 @@ target_close (struct target_ops *targ)
 int
 target_thread_alive (ptid_t ptid)
 {
-  return current_target.to_thread_alive (&current_target, ptid);
+  return current_target->to_thread_alive (current_target, ptid);
 }
 
 void
 target_update_thread_list (void)
 {
-  current_target.to_update_thread_list (&current_target);
+  current_target->to_update_thread_list (current_target);
 }
 
 void
@@ -3339,7 +3339,7 @@ target_stop (ptid_t ptid)
       return;
     }
 
-  (*current_target.to_stop) (&current_target, ptid);
+  (*current_target->to_stop) (current_target, ptid);
 }
 
 void
@@ -3351,7 +3351,7 @@ target_interrupt (ptid_t ptid)
       return;
     }
 
-  (*current_target.to_interrupt) (&current_target, ptid);
+  (*current_target->to_interrupt) (current_target, ptid);
 }
 
 /* See target.h.  */
@@ -3359,7 +3359,7 @@ target_interrupt (ptid_t ptid)
 void
 target_check_pending_interrupt (void)
 {
-  (*current_target.to_check_pending_interrupt) (&current_target);
+  (*current_target->to_check_pending_interrupt) (current_target);
 }
 
 /* See target/target.h.  */
@@ -3475,7 +3475,7 @@ debug_print_register (const char * func,
 void
 target_fetch_registers (struct regcache *regcache, int regno)
 {
-  current_target.to_fetch_registers (&current_target, regcache, regno);
+  current_target->to_fetch_registers (current_target, regcache, regno);
   if (targetdebug)
     debug_print_register ("target_fetch_registers", regcache, regno);
 }
@@ -3488,7 +3488,7 @@ target_store_registers (struct regcache *regcache, int regno)
   if (!may_write_registers)
     error (_("Writing to registers is not allowed (regno %d)"), regno);
 
-  current_target.to_store_registers (&current_target, regcache, regno);
+  current_target->to_store_registers (current_target, regcache, regno);
   if (targetdebug)
     {
       debug_print_register ("target_store_registers", regcache, regno);
@@ -3498,7 +3498,7 @@ target_store_registers (struct regcache *regcache, int regno)
 int
 target_core_of_thread (ptid_t ptid)
 {
-  return current_target.to_core_of_thread (&current_target, ptid);
+  return current_target->to_core_of_thread (current_target, ptid);
 }
 
 int
@@ -3536,14 +3536,14 @@ default_verify_memory (struct target_ops *self,
                       const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
 {
   /* Start over from the top of the target stack.  */
-  return simple_verify_memory (current_target.beneath,
+  return simple_verify_memory (current_target->beneath,
                               data, memaddr, size);
 }
 
 int
 target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
 {
-  return current_target.to_verify_memory (&current_target,
+  return current_target->to_verify_memory (current_target,
                                          data, memaddr, size);
 }
 
@@ -3553,7 +3553,7 @@ target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
 int
 target_insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw)
 {
-  return current_target.to_insert_mask_watchpoint (&current_target,
+  return current_target->to_insert_mask_watchpoint (current_target,
                                                   addr, mask, rw);
 }
 
@@ -3563,7 +3563,7 @@ target_insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw)
 int
 target_remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw)
 {
-  return current_target.to_remove_mask_watchpoint (&current_target,
+  return current_target->to_remove_mask_watchpoint (current_target,
                                                   addr, mask, rw);
 }
 
@@ -3573,7 +3573,7 @@ target_remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw)
 int
 target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
 {
-  return current_target.to_masked_watch_num_registers (&current_target,
+  return current_target->to_masked_watch_num_registers (current_target,
                                                       addr, mask);
 }
 
@@ -3583,7 +3583,7 @@ target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
 int
 target_ranged_break_num_registers (void)
 {
-  return current_target.to_ranged_break_num_registers (&current_target);
+  return current_target->to_ranged_break_num_registers (current_target);
 }
 
 /* See target.h.  */
@@ -3591,7 +3591,7 @@ target_ranged_break_num_registers (void)
 int
 target_supports_btrace (enum btrace_format format)
 {
-  return current_target.to_supports_btrace (&current_target, format);
+  return current_target->to_supports_btrace (current_target, format);
 }
 
 /* See target.h.  */
@@ -3599,7 +3599,7 @@ target_supports_btrace (enum btrace_format format)
 struct btrace_target_info *
 target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
 {
-  return current_target.to_enable_btrace (&current_target, ptid, conf);
+  return current_target->to_enable_btrace (current_target, ptid, conf);
 }
 
 /* See target.h.  */
@@ -3607,7 +3607,7 @@ target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
 void
 target_disable_btrace (struct btrace_target_info *btinfo)
 {
-  current_target.to_disable_btrace (&current_target, btinfo);
+  current_target->to_disable_btrace (current_target, btinfo);
 }
 
 /* See target.h.  */
@@ -3615,7 +3615,7 @@ target_disable_btrace (struct btrace_target_info *btinfo)
 void
 target_teardown_btrace (struct btrace_target_info *btinfo)
 {
-  current_target.to_teardown_btrace (&current_target, btinfo);
+  current_target->to_teardown_btrace (current_target, btinfo);
 }
 
 /* See target.h.  */
@@ -3625,7 +3625,7 @@ target_read_btrace (struct btrace_data *btrace,
                    struct btrace_target_info *btinfo,
                    enum btrace_read_type type)
 {
-  return current_target.to_read_btrace (&current_target, btrace, btinfo, type);
+  return current_target->to_read_btrace (current_target, btrace, btinfo, type);
 }
 
 /* See target.h.  */
@@ -3633,7 +3633,7 @@ target_read_btrace (struct btrace_data *btrace,
 const struct btrace_config *
 target_btrace_conf (const struct btrace_target_info *btinfo)
 {
-  return current_target.to_btrace_conf (&current_target, btinfo);
+  return current_target->to_btrace_conf (current_target, btinfo);
 }
 
 /* See target.h.  */
@@ -3641,7 +3641,7 @@ target_btrace_conf (const struct btrace_target_info *btinfo)
 void
 target_stop_recording (void)
 {
-  current_target.to_stop_recording (&current_target);
+  current_target->to_stop_recording (current_target);
 }
 
 /* See target.h.  */
@@ -3649,7 +3649,7 @@ target_stop_recording (void)
 void
 target_save_record (const char *filename)
 {
-  current_target.to_save_record (&current_target, filename);
+  current_target->to_save_record (current_target, filename);
 }
 
 /* See target.h.  */
@@ -3659,7 +3659,7 @@ target_supports_delete_record (void)
 {
   struct target_ops *t;
 
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  for (t = current_target->beneath; t != NULL; t = t->beneath)
     if (t->to_delete_record != delegate_delete_record
        && t->to_delete_record != tdefault_delete_record)
       return 1;
@@ -3672,7 +3672,7 @@ target_supports_delete_record (void)
 void
 target_delete_record (void)
 {
-  current_target.to_delete_record (&current_target);
+  current_target->to_delete_record (current_target);
 }
 
 /* See target.h.  */
@@ -3680,7 +3680,7 @@ target_delete_record (void)
 int
 target_record_is_replaying (ptid_t ptid)
 {
-  return current_target.to_record_is_replaying (&current_target, ptid);
+  return current_target->to_record_is_replaying (current_target, ptid);
 }
 
 /* See target.h.  */
@@ -3688,7 +3688,7 @@ target_record_is_replaying (ptid_t ptid)
 int
 target_record_will_replay (ptid_t ptid, int dir)
 {
-  return current_target.to_record_will_replay (&current_target, ptid, dir);
+  return current_target->to_record_will_replay (current_target, ptid, dir);
 }
 
 /* See target.h.  */
@@ -3696,7 +3696,7 @@ target_record_will_replay (ptid_t ptid, int dir)
 void
 target_record_stop_replaying (void)
 {
-  current_target.to_record_stop_replaying (&current_target);
+  current_target->to_record_stop_replaying (current_target);
 }
 
 /* See target.h.  */
@@ -3704,7 +3704,7 @@ target_record_stop_replaying (void)
 void
 target_goto_record_begin (void)
 {
-  current_target.to_goto_record_begin (&current_target);
+  current_target->to_goto_record_begin (current_target);
 }
 
 /* See target.h.  */
@@ -3712,7 +3712,7 @@ target_goto_record_begin (void)
 void
 target_goto_record_end (void)
 {
-  current_target.to_goto_record_end (&current_target);
+  current_target->to_goto_record_end (current_target);
 }
 
 /* See target.h.  */
@@ -3720,7 +3720,7 @@ target_goto_record_end (void)
 void
 target_goto_record (ULONGEST insn)
 {
-  current_target.to_goto_record (&current_target, insn);
+  current_target->to_goto_record (current_target, insn);
 }
 
 /* See target.h.  */
@@ -3728,7 +3728,7 @@ target_goto_record (ULONGEST insn)
 void
 target_insn_history (int size, int flags)
 {
-  current_target.to_insn_history (&current_target, size, flags);
+  current_target->to_insn_history (current_target, size, flags);
 }
 
 /* See target.h.  */
@@ -3736,7 +3736,7 @@ target_insn_history (int size, int flags)
 void
 target_insn_history_from (ULONGEST from, int size, int flags)
 {
-  current_target.to_insn_history_from (&current_target, from, size, flags);
+  current_target->to_insn_history_from (current_target, from, size, flags);
 }
 
 /* See target.h.  */
@@ -3744,7 +3744,7 @@ target_insn_history_from (ULONGEST from, int size, int flags)
 void
 target_insn_history_range (ULONGEST begin, ULONGEST end, int flags)
 {
-  current_target.to_insn_history_range (&current_target, begin, end, flags);
+  current_target->to_insn_history_range (current_target, begin, end, flags);
 }
 
 /* See target.h.  */
@@ -3752,7 +3752,7 @@ target_insn_history_range (ULONGEST begin, ULONGEST end, int flags)
 void
 target_call_history (int size, int flags)
 {
-  current_target.to_call_history (&current_target, size, flags);
+  current_target->to_call_history (current_target, size, flags);
 }
 
 /* See target.h.  */
@@ -3760,7 +3760,7 @@ target_call_history (int size, int flags)
 void
 target_call_history_from (ULONGEST begin, int size, int flags)
 {
-  current_target.to_call_history_from (&current_target, begin, size, flags);
+  current_target->to_call_history_from (current_target, begin, size, flags);
 }
 
 /* See target.h.  */
@@ -3768,7 +3768,7 @@ target_call_history_from (ULONGEST begin, int size, int flags)
 void
 target_call_history_range (ULONGEST begin, ULONGEST end, int flags)
 {
-  current_target.to_call_history_range (&current_target, begin, end, flags);
+  current_target->to_call_history_range (current_target, begin, end, flags);
 }
 
 /* See target.h.  */
@@ -3776,7 +3776,7 @@ target_call_history_range (ULONGEST begin, ULONGEST end, int flags)
 const struct frame_unwind *
 target_get_unwinder (void)
 {
-  return current_target.to_get_unwinder (&current_target);
+  return current_target->to_get_unwinder (current_target);
 }
 
 /* See target.h.  */
@@ -3784,7 +3784,7 @@ target_get_unwinder (void)
 const struct frame_unwind *
 target_get_tailcall_unwinder (void)
 {
-  return current_target.to_get_tailcall_unwinder (&current_target);
+  return current_target->to_get_tailcall_unwinder (current_target);
 }
 
 /* See target.h.  */
@@ -3792,7 +3792,7 @@ target_get_tailcall_unwinder (void)
 void
 target_prepare_to_generate_core (void)
 {
-  current_target.to_prepare_to_generate_core (&current_target);
+  current_target->to_prepare_to_generate_core (current_target);
 }
 
 /* See target.h.  */
@@ -3800,15 +3800,15 @@ target_prepare_to_generate_core (void)
 void
 target_done_generating_core (void)
 {
-  current_target.to_done_generating_core (&current_target);
+  current_target->to_done_generating_core (current_target);
 }
 
 static void
 setup_target_debug (void)
 {
-  memcpy (&debug_target, &current_target, sizeof debug_target);
+  memcpy (&debug_target, current_target, sizeof debug_target);
 
-  init_debug_target (&current_target);
+  init_debug_target (current_target);
 }
 \f
 
@@ -3852,7 +3852,7 @@ void
 target_async (int enable)
 {
   infrun_async (enable);
-  current_target.to_async (&current_target, enable);
+  current_target->to_async (current_target, enable);
 }
 
 /* Controls if targets can report that they can/are async.  This is
@@ -3892,7 +3892,7 @@ maint_show_target_async_command (struct ui_file *file, int from_tty,
 static int
 target_always_non_stop_p (void)
 {
-  return current_target.to_always_non_stop_p (&current_target);
+  return current_target->to_always_non_stop_p (current_target);
 }
 
 /* See target.h.  */
@@ -4006,6 +4006,8 @@ set_write_memory_permission (char *args, int from_tty,
 void
 initialize_targets (void)
 {
+  current_target = XCNEW (struct target_ops);
+
   init_dummy_target ();
   push_target (&dummy_target);
 
index da04e47b7708281c6f0d6a26fae5c3e5a015f67a..e31927111beddf45d0673fae0e7df959c7218a2a 100644 (file)
@@ -1259,12 +1259,12 @@ struct target_ops
 /* The ops structure for our "current" target process.  This should
    never be NULL.  If there is no target, it points to the dummy_target.  */
 
-extern struct target_ops current_target;
+extern struct target_ops *current_target;
 
 /* Define easy words for doing these operations on our current target.  */
 
-#define        target_shortname        (current_target.to_shortname)
-#define        target_longname         (current_target.to_longname)
+#define        target_shortname        (current_target->to_shortname)
+#define        target_longname         (current_target->to_longname)
 
 /* Does whatever cleanup is required for a target that we are no
    longer going to be calling.  This routine is automatically always
@@ -1292,7 +1292,7 @@ extern struct target_ops *find_run_target (void);
    These targets must set to_attach_no_wait.  */
 
 #define target_attach_no_wait \
-     (current_target.to_attach_no_wait)
+     (current_target->to_attach_no_wait)
 
 /* The target_attach operation places a process under debugger control,
    and stops the process.
@@ -1300,7 +1300,7 @@ extern struct target_ops *find_run_target (void);
    This operation provides a target-specific hook that allows the
    necessary bookkeeping to be performed after an attach completes.  */
 #define target_post_attach(pid) \
-     (*current_target.to_post_attach) (&current_target, pid)
+     (*current_target->to_post_attach) (current_target, pid)
 
 /* Takes a program previously attached to and detaches it.
    The program may resume execution (some targets do, some don't) and will
@@ -1365,7 +1365,7 @@ extern void target_store_registers (struct regcache *regcache, int regs);
    debugged.  */
 
 #define        target_prepare_to_store(regcache)       \
-     (*current_target.to_prepare_to_store) (&current_target, regcache)
+     (*current_target->to_prepare_to_store) (current_target, regcache)
 
 /* Determine current address space of thread PTID.  */
 
@@ -1382,7 +1382,7 @@ int target_info_proc (const char *, enum info_proc_what);
    simultaneously.  */
 
 #define        target_supports_multi_process() \
-     (*current_target.to_supports_multi_process) (&current_target)
+     (*current_target->to_supports_multi_process) (current_target)
 
 /* Returns true if this target can disable address space randomization.  */
 
@@ -1392,22 +1392,22 @@ int target_supports_disable_randomization (void);
    while a trace experiment is running.  */
 
 #define target_supports_enable_disable_tracepoint() \
-  (*current_target.to_supports_enable_disable_tracepoint) (&current_target)
+  (*current_target->to_supports_enable_disable_tracepoint) (current_target)
 
 #define target_supports_string_tracing() \
-  (*current_target.to_supports_string_tracing) (&current_target)
+  (*current_target->to_supports_string_tracing) (current_target)
 
 /* Returns true if this target can handle breakpoint conditions
    on its end.  */
 
 #define target_supports_evaluation_of_breakpoint_conditions() \
-  (*current_target.to_supports_evaluation_of_breakpoint_conditions) (&current_target)
+  (*current_target->to_supports_evaluation_of_breakpoint_conditions) (current_target)
 
 /* Returns true if this target can handle breakpoint commands
    on its end.  */
 
 #define target_can_run_breakpoint_commands() \
-  (*current_target.to_can_run_breakpoint_commands) (&current_target)
+  (*current_target->to_can_run_breakpoint_commands) (current_target)
 
 extern int target_read_string (CORE_ADDR, char **, int, int *);
 
@@ -1482,7 +1482,7 @@ int target_write_memory_blocks (VEC(memory_write_request_s) *requests,
 /* Print a line about the current target.  */
 
 #define        target_files_info()     \
-     (*current_target.to_files_info) (&current_target)
+     (*current_target->to_files_info) (current_target)
 
 /* Insert a breakpoint at address BP_TGT->placed_address in
    the target machine.  Returns 0 for success, and returns non-zero or
@@ -1539,7 +1539,7 @@ extern struct cleanup *make_cleanup_restore_target_terminal (void);
    exists.  */
 
 #define target_terminal_info(arg, from_tty) \
-     (*current_target.to_terminal_info) (&current_target, arg, from_tty)
+     (*current_target->to_terminal_info) (current_target, arg, from_tty)
 
 /* Kill the inferior process.   Make it go away.  */
 
@@ -1569,7 +1569,7 @@ extern void target_load (const char *arg, int from_tty);
    Such targets will supply an appropriate definition for this function.  */
 
 #define target_post_startup_inferior(ptid) \
-     (*current_target.to_post_startup_inferior) (&current_target, ptid)
+     (*current_target->to_post_startup_inferior) (current_target, ptid)
 
 /* On some targets, we can catch an inferior fork or vfork event when
    it occurs.  These functions insert/remove an already-created
@@ -1577,16 +1577,16 @@ extern void target_load (const char *arg, int from_tty);
    catchpoint type is not supported and -1 for failure.  */
 
 #define target_insert_fork_catchpoint(pid) \
-     (*current_target.to_insert_fork_catchpoint) (&current_target, pid)
+     (*current_target->to_insert_fork_catchpoint) (current_target, pid)
 
 #define target_remove_fork_catchpoint(pid) \
-     (*current_target.to_remove_fork_catchpoint) (&current_target, pid)
+     (*current_target->to_remove_fork_catchpoint) (current_target, pid)
 
 #define target_insert_vfork_catchpoint(pid) \
-     (*current_target.to_insert_vfork_catchpoint) (&current_target, pid)
+     (*current_target->to_insert_vfork_catchpoint) (current_target, pid)
 
 #define target_remove_vfork_catchpoint(pid) \
-     (*current_target.to_remove_vfork_catchpoint) (&current_target, pid)
+     (*current_target->to_remove_vfork_catchpoint) (current_target, pid)
 
 /* If the inferior forks or vforks, this function will be called at
    the next resume in order to perform any bookkeeping and fiddling
@@ -1609,10 +1609,10 @@ void target_follow_exec (struct inferior *inf, char *execd_pathname);
    catchpoint type is not supported and -1 for failure.  */
 
 #define target_insert_exec_catchpoint(pid) \
-     (*current_target.to_insert_exec_catchpoint) (&current_target, pid)
+     (*current_target->to_insert_exec_catchpoint) (current_target, pid)
 
 #define target_remove_exec_catchpoint(pid) \
-     (*current_target.to_remove_exec_catchpoint) (&current_target, pid)
+     (*current_target->to_remove_exec_catchpoint) (current_target, pid)
 
 /* Syscall catch.
 
@@ -1635,7 +1635,7 @@ void target_follow_exec (struct inferior *inf, char *execd_pathname);
    for failure.  */
 
 #define target_set_syscall_catchpoint(pid, needed, any_count, table_size, table) \
-     (*current_target.to_set_syscall_catchpoint) (&current_target,     \
+     (*current_target->to_set_syscall_catchpoint) (current_target,     \
                                                  pid, needed, any_count, \
                                                  table_size, table)
 
@@ -1643,7 +1643,7 @@ void target_follow_exec (struct inferior *inf, char *execd_pathname);
    exit code of PID, if any.  */
 
 #define target_has_exited(pid,wait_status,exit_status) \
-     (*current_target.to_has_exited) (&current_target, \
+     (*current_target->to_has_exited) (current_target, \
                                      pid,wait_status,exit_status)
 
 /* The debugger has completed a blocking wait() call.  There is now
@@ -1725,7 +1725,7 @@ extern void target_check_pending_interrupt (void);
    placed in OUTBUF.  */
 
 #define target_rcmd(command, outbuf) \
-     (*current_target.to_rcmd) (&current_target, command, outbuf)
+     (*current_target->to_rcmd) (current_target, command, outbuf)
 
 
 /* Does the target include all of memory, or only part of it?  This
@@ -1781,16 +1781,16 @@ extern int default_child_has_execution (struct target_ops *ops,
    Can it lock the thread scheduler?  */
 
 #define target_can_lock_scheduler \
-     (current_target.to_has_thread_control & tc_schedlock)
+     (current_target->to_has_thread_control & tc_schedlock)
 
 /* Controls whether async mode is permitted.  */
 extern int target_async_permitted;
 
 /* Can the target support asynchronous execution?  */
-#define target_can_async_p() (current_target.to_can_async_p (&current_target))
+#define target_can_async_p() (current_target->to_can_async_p (current_target))
 
 /* Is the target in asynchronous execution mode?  */
-#define target_is_async_p() (current_target.to_is_async_p (&current_target))
+#define target_is_async_p() (current_target->to_is_async_p (current_target))
 
 /* Enables/disabled async target events.  */
 extern void target_async (int enable);
@@ -1805,7 +1805,7 @@ extern enum auto_boolean target_non_stop_enabled;
 extern int target_is_non_stop_p (void);
 
 #define target_execution_direction() \
-  (current_target.to_execution_direction (&current_target))
+  (current_target->to_execution_direction (current_target))
 
 /* Converts a process id to a string.  Usually, the string just contains
    `process xyz', but on some systems it may contain
@@ -1820,7 +1820,7 @@ extern char *normal_pid_to_str (ptid_t ptid);
    is okay.  */
 
 #define target_extra_thread_info(TP) \
-     (current_target.to_extra_thread_info (&current_target, TP))
+     (current_target->to_extra_thread_info (current_target, TP))
 
 /* Return the thread's name.  A NULL result means that the target
    could not determine this thread's name.  */
@@ -1840,12 +1840,12 @@ extern char *target_thread_name (struct thread_info *);
    it must persist.  */
 
 #define target_pid_to_exec_file(pid) \
-     (current_target.to_pid_to_exec_file) (&current_target, pid)
+     (current_target->to_pid_to_exec_file) (current_target, pid)
 
 /* See the to_thread_architecture description in struct target_ops.  */
 
 #define target_thread_architecture(ptid) \
-     (current_target.to_thread_architecture (&current_target, ptid))
+     (current_target->to_thread_architecture (current_target, ptid))
 
 /*
  * Iterator function for target memory regions.
@@ -1855,21 +1855,21 @@ extern char *target_thread_name (struct thread_info *);
  */
 
 #define target_find_memory_regions(FUNC, DATA) \
-     (current_target.to_find_memory_regions) (&current_target, FUNC, DATA)
+     (current_target->to_find_memory_regions) (current_target, FUNC, DATA)
 
 /*
  * Compose corefile .note section.
  */
 
 #define target_make_corefile_notes(BFD, SIZE_P) \
-     (current_target.to_make_corefile_notes) (&current_target, BFD, SIZE_P)
+     (current_target->to_make_corefile_notes) (current_target, BFD, SIZE_P)
 
 /* Bookmark interfaces.  */
 #define target_get_bookmark(ARGS, FROM_TTY) \
-     (current_target.to_get_bookmark) (&current_target, ARGS, FROM_TTY)
+     (current_target->to_get_bookmark) (current_target, ARGS, FROM_TTY)
 
 #define target_goto_bookmark(ARG, FROM_TTY) \
-     (current_target.to_goto_bookmark) (&current_target, ARG, FROM_TTY)
+     (current_target->to_goto_bookmark) (current_target, ARG, FROM_TTY)
 
 /* Hardware watchpoint interfaces.  */
 
@@ -1877,32 +1877,32 @@ extern char *target_thread_name (struct thread_info *);
    write).  Only the INFERIOR_PTID task is being queried.  */
 
 #define target_stopped_by_watchpoint()         \
-  ((*current_target.to_stopped_by_watchpoint) (&current_target))
+  ((*current_target->to_stopped_by_watchpoint) (current_target))
 
 /* Returns non-zero if the target stopped because it executed a
    software breakpoint instruction.  */
 
 #define target_stopped_by_sw_breakpoint()              \
-  ((*current_target.to_stopped_by_sw_breakpoint) (&current_target))
+  ((*current_target->to_stopped_by_sw_breakpoint) (current_target))
 
 #define target_supports_stopped_by_sw_breakpoint() \
-  ((*current_target.to_supports_stopped_by_sw_breakpoint) (&current_target))
+  ((*current_target->to_supports_stopped_by_sw_breakpoint) (current_target))
 
 #define target_stopped_by_hw_breakpoint()                              \
-  ((*current_target.to_stopped_by_hw_breakpoint) (&current_target))
+  ((*current_target->to_stopped_by_hw_breakpoint) (current_target))
 
 #define target_supports_stopped_by_hw_breakpoint() \
-  ((*current_target.to_supports_stopped_by_hw_breakpoint) (&current_target))
+  ((*current_target->to_supports_stopped_by_hw_breakpoint) (current_target))
 
 /* Non-zero if we have steppable watchpoints  */
 
 #define target_have_steppable_watchpoint \
-   (current_target.to_have_steppable_watchpoint)
+   (current_target->to_have_steppable_watchpoint)
 
 /* Non-zero if we have continuable watchpoints  */
 
 #define target_have_continuable_watchpoint \
-   (current_target.to_have_continuable_watchpoint)
+   (current_target->to_have_continuable_watchpoint)
 
 /* Provide defaults for hardware watchpoint functions.  */
 
@@ -1918,19 +1918,19 @@ extern char *target_thread_name (struct thread_info *);
    one.  OTHERTYPE is who knows what...  */
 
 #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
- (*current_target.to_can_use_hw_breakpoint) (&current_target,  \
-                                            TYPE, CNT, OTHERTYPE)
+ (*current_target->to_can_use_hw_breakpoint) (current_target,  \
+                                            TYPE, CNT, OTHERTYPE);
 
 /* Returns the number of debug registers needed to watch the given
    memory region, or zero if not supported.  */
 
 #define target_region_ok_for_hw_watchpoint(addr, len) \
-    (*current_target.to_region_ok_for_hw_watchpoint) (&current_target, \
+    (*current_target->to_region_ok_for_hw_watchpoint) (current_target, \
                                                      addr, len)
 
 
 #define target_can_do_single_step() \
-  (*current_target.to_can_do_single_step) (&current_target)
+  (*current_target->to_can_do_single_step) (current_target)
 
 /* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes.
    TYPE is 0 for write, 1 for read, and 2 for read/write accesses.
@@ -1939,11 +1939,11 @@ extern char *target_thread_name (struct thread_info *);
    -1 for failure.  */
 
 #define        target_insert_watchpoint(addr, len, type, cond) \
-     (*current_target.to_insert_watchpoint) (&current_target,  \
+     (*current_target->to_insert_watchpoint) (current_target,  \
                                             addr, len, type, cond)
 
 #define        target_remove_watchpoint(addr, len, type, cond) \
-     (*current_target.to_remove_watchpoint) (&current_target,  \
+     (*current_target->to_remove_watchpoint) (current_target,  \
                                             addr, len, type, cond)
 
 /* Insert a new masked watchpoint at ADDR using the mask MASK.
@@ -1966,11 +1966,11 @@ extern int target_remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, int);
    message) otherwise.  */
 
 #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \
-     (*current_target.to_insert_hw_breakpoint) (&current_target,       \
+     (*current_target->to_insert_hw_breakpoint) (current_target,       \
                                                gdbarch, bp_tgt)
 
 #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \
-     (*current_target.to_remove_hw_breakpoint) (&current_target,       \
+     (*current_target->to_remove_hw_breakpoint) (current_target,       \
                                                gdbarch, bp_tgt)
 
 /* Return number of debug registers needed for a ranged breakpoint,
@@ -2000,7 +2000,7 @@ extern int target_ranged_break_num_registers (void);
    For this reason, GDB will still evaluate the condition expression when
    the watchpoint triggers.  */
 #define target_can_accel_watchpoint_condition(addr, len, type, cond) \
-  (*current_target.to_can_accel_watchpoint_condition) (&current_target,        \
+  (*current_target->to_can_accel_watchpoint_condition) (current_target,        \
                                                       addr, len, type, cond)
 
 /* Return number of debug registers needed for a masked watchpoint,
@@ -2011,12 +2011,12 @@ extern int target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask);
 
 /* Target can execute in reverse?  */
 #define target_can_execute_reverse \
-      current_target.to_can_execute_reverse (&current_target)
+      current_target->to_can_execute_reverse (current_target)
 
 extern const struct target_desc *target_read_description (struct target_ops *);
 
 #define target_get_ada_task_ptid(lwp, tid) \
-     (*current_target.to_get_ada_task_ptid) (&current_target, lwp,tid)
+     (*current_target->to_get_ada_task_ptid) (current_target, lwp,tid)
 
 /* Utility implementation of searching memory.  */
 extern int simple_search_memory (struct target_ops* ops,
@@ -2038,7 +2038,7 @@ extern int target_search_memory (CORE_ADDR start_addr,
 /* Return nonzero if the filesystem seen by the current inferior
    is the local filesystem, zero otherwise.  */
 #define target_filesystem_is_local() \
-  current_target.to_filesystem_is_local (&current_target)
+  current_target->to_filesystem_is_local (current_target)
 
 /* Open FILENAME on the target, in the filesystem as seen by INF,
    using FLAGS and MODE.  If INF is NULL, use the filesystem seen
@@ -2126,105 +2126,105 @@ extern char *target_fileio_read_stralloc (struct inferior *inf,
 /* Tracepoint-related operations.  */
 
 #define target_trace_init() \
-  (*current_target.to_trace_init) (&current_target)
+  (*current_target->to_trace_init) (current_target)
 
 #define target_download_tracepoint(t) \
-  (*current_target.to_download_tracepoint) (&current_target, t)
+  (*current_target->to_download_tracepoint) (current_target, t)
 
 #define target_can_download_tracepoint() \
-  (*current_target.to_can_download_tracepoint) (&current_target)
+  (*current_target->to_can_download_tracepoint) (current_target)
 
 #define target_download_trace_state_variable(tsv) \
-  (*current_target.to_download_trace_state_variable) (&current_target, tsv)
+  (*current_target->to_download_trace_state_variable) (current_target, tsv)
 
 #define target_enable_tracepoint(loc) \
-  (*current_target.to_enable_tracepoint) (&current_target, loc)
+  (*current_target->to_enable_tracepoint) (current_target, loc)
 
 #define target_disable_tracepoint(loc) \
-  (*current_target.to_disable_tracepoint) (&current_target, loc)
+  (*current_target->to_disable_tracepoint) (current_target, loc)
 
 #define target_trace_start() \
-  (*current_target.to_trace_start) (&current_target)
+  (*current_target->to_trace_start) (current_target)
 
 #define target_trace_set_readonly_regions() \
-  (*current_target.to_trace_set_readonly_regions) (&current_target)
+  (*current_target->to_trace_set_readonly_regions) (current_target)
 
 #define target_get_trace_status(ts) \
-  (*current_target.to_get_trace_status) (&current_target, ts)
+  (*current_target->to_get_trace_status) (current_target, ts)
 
 #define target_get_tracepoint_status(tp,utp)           \
-  (*current_target.to_get_tracepoint_status) (&current_target, tp, utp)
+  (*current_target->to_get_tracepoint_status) (current_target, tp, utp)
 
 #define target_trace_stop() \
-  (*current_target.to_trace_stop) (&current_target)
+  (*current_target->to_trace_stop) (current_target)
 
 #define target_trace_find(type,num,addr1,addr2,tpp) \
-  (*current_target.to_trace_find) (&current_target, \
+  (*current_target->to_trace_find) (current_target, \
                                   (type), (num), (addr1), (addr2), (tpp))
 
 #define target_get_trace_state_variable_value(tsv,val) \
-  (*current_target.to_get_trace_state_variable_value) (&current_target,        \
+  (*current_target->to_get_trace_state_variable_value) (current_target,        \
                                                       (tsv), (val))
 
 #define target_save_trace_data(filename) \
-  (*current_target.to_save_trace_data) (&current_target, filename)
+  (*current_target->to_save_trace_data) (current_target, filename)
 
 #define target_upload_tracepoints(utpp) \
-  (*current_target.to_upload_tracepoints) (&current_target, utpp)
+  (*current_target->to_upload_tracepoints) (current_target, utpp)
 
 #define target_upload_trace_state_variables(utsvp) \
-  (*current_target.to_upload_trace_state_variables) (&current_target, utsvp)
+  (*current_target->to_upload_trace_state_variables) (current_target, utsvp)
 
 #define target_get_raw_trace_data(buf,offset,len) \
-  (*current_target.to_get_raw_trace_data) (&current_target,    \
+  (*current_target->to_get_raw_trace_data) (current_target,    \
                                           (buf), (offset), (len))
 
 #define target_get_min_fast_tracepoint_insn_len() \
-  (*current_target.to_get_min_fast_tracepoint_insn_len) (&current_target)
+  (*current_target->to_get_min_fast_tracepoint_insn_len) (current_target)
 
 #define target_set_disconnected_tracing(val) \
-  (*current_target.to_set_disconnected_tracing) (&current_target, val)
+  (*current_target->to_set_disconnected_tracing) (current_target, val)
 
 #define        target_set_circular_trace_buffer(val)   \
-  (*current_target.to_set_circular_trace_buffer) (&current_target, val)
+  (*current_target->to_set_circular_trace_buffer) (current_target, val)
 
 #define        target_set_trace_buffer_size(val)       \
-  (*current_target.to_set_trace_buffer_size) (&current_target, val)
+  (*current_target->to_set_trace_buffer_size) (current_target, val)
 
 #define        target_set_trace_notes(user,notes,stopnotes)            \
-  (*current_target.to_set_trace_notes) (&current_target,       \
+  (*current_target->to_set_trace_notes) (current_target,       \
                                        (user), (notes), (stopnotes))
 
 #define target_get_tib_address(ptid, addr) \
-  (*current_target.to_get_tib_address) (&current_target, (ptid), (addr))
+  (*current_target->to_get_tib_address) (current_target, (ptid), (addr))
 
 #define target_set_permissions() \
-  (*current_target.to_set_permissions) (&current_target)
+  (*current_target->to_set_permissions) (current_target)
 
 #define target_static_tracepoint_marker_at(addr, marker) \
-  (*current_target.to_static_tracepoint_marker_at) (&current_target,   \
+  (*current_target->to_static_tracepoint_marker_at) (current_target,   \
                                                    addr, marker)
 
 #define target_static_tracepoint_markers_by_strid(marker_id) \
-  (*current_target.to_static_tracepoint_markers_by_strid) (&current_target, \
+  (*current_target->to_static_tracepoint_markers_by_strid) (current_target, \
                                                           marker_id)
 
 #define target_traceframe_info() \
-  (*current_target.to_traceframe_info) (&current_target)
+  (*current_target->to_traceframe_info) (current_target)
 
 #define target_use_agent(use) \
-  (*current_target.to_use_agent) (&current_target, use)
+  (*current_target->to_use_agent) (current_target, use)
 
 #define target_can_use_agent() \
-  (*current_target.to_can_use_agent) (&current_target)
+  (*current_target->to_can_use_agent) (current_target)
 
 #define target_augmented_libraries_svr4_read() \
-  (*current_target.to_augmented_libraries_svr4_read) (&current_target)
+  (*current_target->to_augmented_libraries_svr4_read) (current_target)
 
 /* Command logging facility.  */
 
 #define target_log_command(p)                                  \
-  (*current_target.to_log_command) (&current_target, p)
+  (*current_target->to_log_command) (current_target, p)
 
 
 extern int target_core_of_thread (ptid_t ptid);
index 6ca66e7c8d1849992d03c604d4a2e6b68b164d14..152481364548db4330260b3fcc55cffb1e241e78 100644 (file)
@@ -4142,7 +4142,7 @@ sdata_make_value (struct gdbarch *gdbarch, struct internalvar *var,
   gdb_byte *buf;
 
   /* We need to read the whole object before we know its size.  */
-  size = target_read_alloc (&current_target,
+  size = target_read_alloc (current_target,
                            TARGET_OBJECT_STATIC_TRACE_DATA,
                            NULL, &buf);
   if (size >= 0)
index 1e372efc88bace91e84ee1005503773a8453851c..fb0a312400a8ffae60ac77c95ea92115b65858cd 100644 (file)
@@ -967,7 +967,7 @@ read_value_memory (struct value *val, int embedded_offset,
       enum target_xfer_status status;
       ULONGEST xfered_partial;
 
-      status = target_xfer_partial (current_target.beneath,
+      status = target_xfer_partial (current_target->beneath,
                                    TARGET_OBJECT_MEMORY, NULL,
                                    buffer + xfered_total * unit_size, NULL,
                                    memaddr + xfered_total,
@@ -1203,7 +1203,7 @@ value_assign (struct value *toval, struct value *fromval)
     case lval_register:
     case lval_computed:
 
-      observer_notify_target_changed (&current_target);
+      observer_notify_target_changed (current_target);
 
       /* Having destroyed the frame cache, restore the selected
         frame.  */
index c053a817815ee6180165dbdb83260126adc763a3..f634782135261b00a176f78e49905f0cc7cbff5d 100644 (file)
@@ -1788,7 +1788,7 @@ print_function_pointer_address (const struct value_print_options *options,
 {
   CORE_ADDR func_addr
     = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
-                                         &current_target);
+                                         current_target);
 
   /* If the function pointer is represented by a description, print
      the address of the description.  */
index 91bf49e43899a3a47822e83e8362bb376d90498f..ebf4e0fee4f3545e6b1bcc38fd93fba8183cf0b9 100644 (file)
@@ -3164,7 +3164,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
 
       set_value_address (v,
        gdbarch_convert_from_func_ptr_addr
-          (gdbarch, BMSYMBOL_VALUE_ADDRESS (msym), &current_target));
+          (gdbarch, BMSYMBOL_VALUE_ADDRESS (msym), current_target));
     }
 
   if (arg1p)
index 58e8fcacd3f163808e343e4912eef4d1fc9493b2..e18fe684c097f972414ae6aa55ddba2d4eebb303 100644 (file)
@@ -330,7 +330,7 @@ display_one_tib (ptid_t ptid)
       return -1;
     }
 
-  if (target_read (&current_target, TARGET_OBJECT_MEMORY,
+  if (target_read (current_target, TARGET_OBJECT_MEMORY,
                   NULL, tib, thread_local_base, tib_size) != tib_size)
     {
       printf_filtered (_("Unable to read thread information "