*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / target.c
index 5a050afcb6f329cced8074c6357cd6fbc3fccbf3..fbfc58a6be57812a5a2539f8a8bd93b3c91a8d6b 100644 (file)
@@ -1,7 +1,8 @@
 /* Select target systems and architectures at runtime for GDB.
 
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.
 
@@ -19,8 +20,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
 #include <errno.h>
@@ -47,7 +48,7 @@ static void kill_or_be_killed (int);
 
 static void default_terminal_info (char *, int);
 
-static int default_region_size_ok_for_hw_watchpoint (int);
+static int default_region_ok_for_hw_watchpoint (CORE_ADDR, int);
 
 static int nosymbol (char *, CORE_ADDR *);
 
@@ -71,8 +72,8 @@ static void nosupport_runtime (void);
 
 static LONGEST default_xfer_partial (struct target_ops *ops,
                                     enum target_object object,
-                                    const char *annex, void *readbuf,
-                                    const void *writebuf,
+                                    const char *annex, gdb_byte *readbuf,
+                                    const gdb_byte *writebuf,
                                     ULONGEST offset, LONGEST len);
 
 /* Transfer LEN bytes between target address MEMADDR and GDB address
@@ -81,7 +82,7 @@ static LONGEST default_xfer_partial (struct target_ops *ops,
    partial transfers, try either target_read_memory_partial or
    target_write_memory_partial).  */
 
-static int target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
+static int target_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
                               int write);
 
 static void init_dummy_target (void);
@@ -108,21 +109,17 @@ static void debug_to_store_registers (int);
 
 static void debug_to_prepare_to_store (void);
 
-static int deprecated_debug_xfer_memory (CORE_ADDR, char *, int, int,
-                                        struct mem_attrib *,
-                                        struct target_ops *);
-
 static void debug_to_files_info (struct target_ops *);
 
-static int debug_to_insert_breakpoint (CORE_ADDR, char *);
+static int debug_to_insert_breakpoint (CORE_ADDR, gdb_byte *);
 
-static int debug_to_remove_breakpoint (CORE_ADDR, char *);
+static int debug_to_remove_breakpoint (CORE_ADDR, gdb_byte *);
 
 static int debug_to_can_use_hw_breakpoint (int, int, int);
 
-static int debug_to_insert_hw_breakpoint (CORE_ADDR, char *);
+static int debug_to_insert_hw_breakpoint (CORE_ADDR, gdb_byte *);
 
-static int debug_to_remove_hw_breakpoint (CORE_ADDR, char *);
+static int debug_to_remove_hw_breakpoint (CORE_ADDR, gdb_byte *);
 
 static int debug_to_insert_watchpoint (CORE_ADDR, int, int);
 
@@ -132,7 +129,7 @@ static int debug_to_stopped_by_watchpoint (void);
 
 static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *);
 
-static int debug_to_region_size_ok_for_hw_watchpoint (int);
+static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, int);
 
 static void debug_to_terminal_init (void);
 
@@ -203,6 +200,12 @@ int attach_flag;
 /* Non-zero if we want to see trace of target level stuff.  */
 
 static int targetdebug = 0;
+static void
+show_targetdebug (struct ui_file *file, int from_tty,
+                 struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("Target debugging is %s.\n"), value);
+}
 
 static void setup_target_debug (void);
 
@@ -242,12 +245,12 @@ add_target (struct target_ops *t)
   target_structs[target_struct_size++] = t;
 
   if (targetlist == NULL)
-    add_prefix_cmd ("target", class_run, target_command,
-                   "Connect to a target machine or process.\n\
+    add_prefix_cmd ("target", class_run, target_command, _("\
+Connect to a target machine or process.\n\
 The first argument is the type or protocol of the target machine.\n\
 Remaining arguments are interpreted by the target protocol.  For more\n\
 information on the arguments for a particular protocol, type\n\
-`help target ' followed by the protocol name.",
+`help target ' followed by the protocol name."),
                    &targetlist, "target ", 0, &cmdlist);
   add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc, &targetlist);
 }
@@ -277,14 +280,14 @@ nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
 static void
 tcomplain (void)
 {
-  error ("You can't do that when your target is `%s'",
+  error (_("You can't do that when your target is `%s'"),
         current_target.to_shortname);
 }
 
 void
 noprocess (void)
 {
-  error ("You can't do that without a process to debug.");
+  error (_("You can't do that without a process to debug."));
 }
 
 static int
@@ -299,14 +302,14 @@ nosupport_runtime (void)
   if (ptid_equal (inferior_ptid, null_ptid))
     noprocess ();
   else
-    error ("No run-time support for this");
+    error (_("No run-time support for this"));
 }
 
 
 static void
 default_terminal_info (char *args, int from_tty)
 {
-  printf_unfiltered ("No saved terminal information.\n");
+  printf_unfiltered (_("No saved terminal information.\n"));
 }
 
 /* This is the default target_create_inferior and target_attach function.
@@ -319,18 +322,18 @@ kill_or_be_killed (int from_tty)
 {
   if (target_has_execution)
     {
-      printf_unfiltered ("You are already running a program:\n");
+      printf_unfiltered (_("You are already running a program:\n"));
       target_files_info ();
       if (query ("Kill it? "))
        {
          target_kill ();
          if (target_has_execution)
-           error ("Killing the program did not help.");
+           error (_("Killing the program did not help."));
          return;
        }
       else
        {
-         error ("Program not killed.");
+         error (_("Program not killed."));
        }
     }
   tcomplain ();
@@ -403,7 +406,7 @@ update_current_target (void)
       INHERIT (to_stopped_data_address, t);
       INHERIT (to_stopped_by_watchpoint, t);
       INHERIT (to_have_continuable_watchpoint, t);
-      INHERIT (to_region_size_ok_for_hw_watchpoint, t);
+      INHERIT (to_region_ok_for_hw_watchpoint, t);
       INHERIT (to_terminal_init, t);
       INHERIT (to_terminal_inferior, t);
       INHERIT (to_terminal_ours_for_output, t);
@@ -420,7 +423,7 @@ update_current_target (void)
       INHERIT (to_remove_fork_catchpoint, t);
       INHERIT (to_insert_vfork_catchpoint, t);
       INHERIT (to_remove_vfork_catchpoint, t);
-      INHERIT (to_follow_fork, t);
+      /* Do not inherit to_follow_fork.  */
       INHERIT (to_insert_exec_catchpoint, t);
       INHERIT (to_remove_exec_catchpoint, t);
       INHERIT (to_reported_exec_events_per_exec_call, t);
@@ -499,7 +502,7 @@ update_current_target (void)
            (void (*) (void)) 
            noprocess);
   de_fault (deprecated_xfer_memory, 
-           (int (*) (CORE_ADDR, char *, int, int, struct mem_attrib *, struct target_ops *)) 
+           (int (*) (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *, struct target_ops *)) 
            nomemory);
   de_fault (to_files_info, 
            (void (*) (struct target_ops *)) 
@@ -512,10 +515,10 @@ update_current_target (void)
            (int (*) (int, int, int))
            return_zero);
   de_fault (to_insert_hw_breakpoint,
-           (int (*) (CORE_ADDR, char *))
+           (int (*) (CORE_ADDR, gdb_byte *))
            return_minus_one);
   de_fault (to_remove_hw_breakpoint,
-           (int (*) (CORE_ADDR, char *))
+           (int (*) (CORE_ADDR, gdb_byte *))
            return_minus_one);
   de_fault (to_insert_watchpoint,
            (int (*) (CORE_ADDR, int, int))
@@ -529,8 +532,8 @@ update_current_target (void)
   de_fault (to_stopped_data_address,
            (int (*) (struct target_ops *, CORE_ADDR *))
            return_zero);
-  de_fault (to_region_size_ok_for_hw_watchpoint,
-           default_region_size_ok_for_hw_watchpoint);
+  de_fault (to_region_ok_for_hw_watchpoint,
+           default_region_ok_for_hw_watchpoint);
   de_fault (to_terminal_init, 
            (void (*) (void)) 
            target_ignore);
@@ -577,9 +580,6 @@ update_current_target (void)
   de_fault (to_remove_vfork_catchpoint, 
            (int (*) (int)) 
            tcomplain);
-  de_fault (to_follow_fork,
-           (int (*) (int)) 
-           target_ignore);
   de_fault (to_insert_exec_catchpoint, 
            (void (*) (int)) 
            tcomplain);
@@ -664,7 +664,7 @@ push_target (struct target_ops *t)
       fprintf_unfiltered (gdb_stderr,
                          "Magic number of %s target struct wrong\n",
                          t->to_shortname);
-      internal_error (__FILE__, __LINE__, "failed internal consistency check");
+      internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
     }
 
   /* Find the proper stratum to install this target in.  */
@@ -675,7 +675,7 @@ push_target (struct target_ops *t)
     }
 
   /* If there's already targets at this stratum, remove them.  */
-  /* FIXME: cagney/2003-10-15: I think this should be poping all
+  /* FIXME: cagney/2003-10-15: I think this should be popping all
      targets to CUR, and not just those at this stratum level.  */
   while ((*cur) != NULL && t->to_stratum == (*cur)->to_stratum)
     {
@@ -749,7 +749,7 @@ pop_target (void)
   fprintf_unfiltered (gdb_stderr,
                      "pop_target couldn't find target %s\n",
                      current_target.to_shortname);
-  internal_error (__FILE__, __LINE__, "failed internal consistency check");
+  internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
 }
 
 #undef MIN
@@ -765,7 +765,7 @@ int
 target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
 {
   int tlen, origlen, offset, i;
-  char buf[4];
+  gdb_byte buf[4];
   int errcode = 0;
   char *buffer;
   int buffer_allocated;
@@ -784,7 +784,7 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
       tlen = MIN (len, 4 - (memaddr & 3));
       offset = memaddr & 3;
 
-      errcode = target_read_memory (memaddr & ~3, buf, 4);
+      errcode = target_read_memory (memaddr & ~3, buf, sizeof buf);
       if (errcode != 0)
        {
          /* The transfer request might have crossed the boundary to an
@@ -960,9 +960,9 @@ xfer_using_stratum (enum target_object object, const char *annex,
            return 0;
          offset += xfered;
          if (readbuf != NULL)
-           readbuf = (bfd_byte *) readbuf + xfered;
+           readbuf = (gdb_byte *) readbuf + xfered;
          if (writebuf != NULL)
-           writebuf = (bfd_byte *) writebuf + xfered;
+           writebuf = (gdb_byte *) writebuf + xfered;
          target = target_stack;
        }
       else if (xfered < 0)
@@ -995,7 +995,7 @@ xfer_using_stratum (enum target_object object, const char *annex,
    deal with partial reads should call target_read_memory_partial. */
 
 int
-target_read_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len)
+target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
 {
   if (target_xfer_partial_p ())
     return xfer_using_stratum (TARGET_OBJECT_MEMORY, NULL,
@@ -1005,9 +1005,9 @@ target_read_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len)
 }
 
 int
-target_write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
+target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len)
 {
-  bfd_byte *bytes = alloca (len);
+  gdb_byte *bytes = alloca (len);
   memcpy (bytes, myaddr, len);
   if (target_xfer_partial_p ())
     return xfer_using_stratum (TARGET_OBJECT_MEMORY, NULL,
@@ -1032,6 +1032,14 @@ target_stopped_data_address_p (struct target_ops *target)
 #endif
 
 static int trust_readonly = 0;
+static void
+show_trust_readonly (struct ui_file *file, int from_tty,
+                    struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("\
+Mode for reading from readonly sections is %s.\n"),
+                   value);
+}
 
 /* Move memory to or from the targets.  The top target gets priority;
    if it cannot handle it, it is offered to the next one down, etc.
@@ -1039,7 +1047,7 @@ static int trust_readonly = 0;
    Result is -1 on error, or the number of bytes transfered.  */
 
 int
-do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+do_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
                struct mem_attrib *attrib)
 {
   int res;
@@ -1100,7 +1108,7 @@ do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
    Result is 0 or errno value.  */
 
 static int
-target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write)
+target_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write)
 {
   int res;
   int reg_len;
@@ -1137,7 +1145,7 @@ target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write)
        {
          if (region->attrib.cache)
            res = dcache_xfer_memory (target_dcache, memaddr, myaddr,
-                                    reg_len, write);
+                                     reg_len, write);
          else
            res = do_xfer_memory (memaddr, myaddr, reg_len, write,
                                 &region->attrib);
@@ -1168,10 +1176,11 @@ target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write)
 
 /* Perform a partial memory transfer.
 
-   Result is -1 on error, or the number of bytes transfered.  */
+   If we succeed, set *ERR to zero and return the number of bytes transferred.
+   If we fail, set *ERR to a non-zero errno value, and return -1.  */
 
 static int
-target_xfer_memory_partial (CORE_ADDR memaddr, char *myaddr, int len,
+target_xfer_memory_partial (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
                            int write_p, int *err)
 {
   int res;
@@ -1232,21 +1241,59 @@ target_xfer_memory_partial (CORE_ADDR memaddr, char *myaddr, int len,
 }
 
 int
-target_read_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
+target_read_memory_partial (CORE_ADDR memaddr, gdb_byte *buf,
+                           int len, int *err)
 {
   if (target_xfer_partial_p ())
-    return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
-                               buf, NULL, memaddr, len);
+    {
+      int retval;
+
+      retval = target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY,
+                                   NULL, buf, NULL, memaddr, len);
+
+      if (retval <= 0)
+       {
+         if (errno)
+           *err = errno;
+         else
+           *err = EIO;
+         return -1;
+       }
+      else
+       {
+         *err = 0;
+         return retval;
+       }
+    }
   else
     return target_xfer_memory_partial (memaddr, buf, len, 0, err);
 }
 
 int
-target_write_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
+target_write_memory_partial (CORE_ADDR memaddr, gdb_byte *buf,
+                            int len, int *err)
 {
   if (target_xfer_partial_p ())
-    return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
-                               NULL, buf, memaddr, len);
+    {
+      int retval;
+
+      retval = target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY,
+                                   NULL, NULL, buf, memaddr, len);
+
+      if (retval <= 0)
+       {
+         if (errno)
+           *err = errno;
+         else
+           *err = EIO;
+         return -1;
+       }
+      else
+       {
+         *err = 0;
+         return retval;
+       }
+    }
   else
     return target_xfer_memory_partial (memaddr, buf, len, 1, err);
 }
@@ -1255,8 +1302,8 @@ target_write_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
 
 static LONGEST
 default_xfer_partial (struct target_ops *ops, enum target_object object,
-                     const char *annex, void *readbuf, 
-                     const void *writebuf, ULONGEST offset, LONGEST len)
+                     const char *annex, gdb_byte *readbuf, 
+                     const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
 {
   if (object == TARGET_OBJECT_MEMORY
       && ops->deprecated_xfer_memory != NULL)
@@ -1302,7 +1349,7 @@ default_xfer_partial (struct target_ops *ops, enum target_object object,
 LONGEST
 target_read_partial (struct target_ops *ops,
                     enum target_object object,
-                    const char *annex, void *buf,
+                    const char *annex, gdb_byte *buf,
                     ULONGEST offset, LONGEST len)
 {
   return target_xfer_partial (ops, object, annex, buf, NULL, offset, len);
@@ -1311,7 +1358,7 @@ target_read_partial (struct target_ops *ops,
 LONGEST
 target_write_partial (struct target_ops *ops,
                      enum target_object object,
-                     const char *annex, const void *buf,
+                     const char *annex, const gdb_byte *buf,
                      ULONGEST offset, LONGEST len)
 {
   return target_xfer_partial (ops, object, annex, NULL, buf, offset, len);
@@ -1321,14 +1368,14 @@ target_write_partial (struct target_ops *ops,
 LONGEST
 target_read (struct target_ops *ops,
             enum target_object object,
-            const char *annex, void *buf,
+            const char *annex, gdb_byte *buf,
             ULONGEST offset, LONGEST len)
 {
   LONGEST xfered = 0;
   while (xfered < len)
     {
       LONGEST xfer = target_read_partial (ops, object, annex,
-                                         (bfd_byte *) buf + xfered,
+                                         (gdb_byte *) buf + xfered,
                                          offset + xfered, len - xfered);
       /* Call an observer, notifying them of the xfer progress?  */
       if (xfer <= 0)
@@ -1343,14 +1390,14 @@ target_read (struct target_ops *ops,
 LONGEST
 target_write (struct target_ops *ops,
              enum target_object object,
-             const char *annex, const void *buf,
+             const char *annex, const gdb_byte *buf,
              ULONGEST offset, LONGEST len)
 {
   LONGEST xfered = 0;
   while (xfered < len)
     {
       LONGEST xfer = target_write_partial (ops, object, annex,
-                                          (bfd_byte *) buf + xfered,
+                                          (gdb_byte *) buf + xfered,
                                           offset + xfered, len - xfered);
       /* Call an observer, notifying them of the xfer progress?  */
       if (xfer <= 0)
@@ -1365,7 +1412,7 @@ target_write (struct target_ops *ops,
 /* Memory transfer methods.  */
 
 void
-get_target_memory (struct target_ops *ops, CORE_ADDR addr, void *buf,
+get_target_memory (struct target_ops *ops, CORE_ADDR addr, gdb_byte *buf,
                   LONGEST len)
 {
   if (target_read (ops, TARGET_OBJECT_MEMORY, NULL, buf, addr, len)
@@ -1377,7 +1424,7 @@ ULONGEST
 get_target_memory_unsigned (struct target_ops *ops,
                            CORE_ADDR addr, int len)
 {
-  char buf[sizeof (ULONGEST)];
+  gdb_byte buf[sizeof (ULONGEST)];
 
   gdb_assert (len <= sizeof (buf));
   get_target_memory (ops, addr, buf, len);
@@ -1391,7 +1438,7 @@ target_info (char *args, int from_tty)
   int has_all_mem = 0;
 
   if (symfile_objfile != NULL)
-    printf_unfiltered ("Symbols from \"%s\".\n", symfile_objfile->name);
+    printf_unfiltered (_("Symbols from \"%s\".\n"), symfile_objfile->name);
 
   for (t = target_stack; t != NULL; t = t->beneath)
     {
@@ -1401,7 +1448,7 @@ target_info (char *args, int from_tty)
       if ((int) (t->to_stratum) <= (int) dummy_stratum)
        continue;
       if (has_all_mem)
-       printf_unfiltered ("\tWhile running this, GDB does not access memory from...\n");
+       printf_unfiltered (_("\tWhile running this, GDB does not access memory from...\n"));
       printf_unfiltered ("%s:\n", t->to_longname);
       (t->to_files_info) (t);
       has_all_mem = t->to_has_all_memory;
@@ -1419,10 +1466,10 @@ target_preopen (int from_tty)
   if (target_has_execution)
     {
       if (!from_tty
-          || query ("A program is being debugged already.  Kill it? "))
+          || query (_("A program is being debugged already.  Kill it? ")))
        target_kill ();
       else
-       error ("Program not killed.");
+       error (_("Program not killed."));
     }
 
   /* Calling target_kill may remove the target from the stack.  But if
@@ -1446,19 +1493,6 @@ target_disconnect (char *args, int from_tty)
   (current_target.to_disconnect) (args, from_tty);
 }
 
-void
-target_link (char *modname, CORE_ADDR *t_reloc)
-{
-  if (DEPRECATED_STREQ (current_target.to_shortname, "rombug"))
-    {
-      (current_target.to_lookup_symbol) (modname, t_reloc);
-      if (*t_reloc == 0)
-       error ("Unable to link to %s and get relocation in rombug", modname);
-    }
-  else
-    *t_reloc = (CORE_ADDR) -1;
-}
-
 int
 target_async_mask (int mask)
 {
@@ -1467,6 +1501,31 @@ target_async_mask (int mask)
   return saved_async_masked_status;
 }
 
+/* Look through the list of possible targets for a target that can
+   follow forks.  */
+
+int
+target_follow_fork (int follow_child)
+{
+  struct target_ops *t;
+
+  for (t = current_target.beneath; t != NULL; t = t->beneath)
+    {
+      if (t->to_follow_fork != NULL)
+       {
+         int retval = t->to_follow_fork (t, follow_child);
+         if (targetdebug)
+           fprintf_unfiltered (gdb_stdlog, "target_follow_fork (%d) = %d\n",
+                               follow_child, retval);
+         return retval;
+       }
+    }
+
+  /* Some target returned a fork event, but did not know how to follow it.  */
+  internal_error (__FILE__, __LINE__,
+                 "could not find a target to follow fork");
+}
+
 /* Look through the list of possible targets for a target that can
    execute a run or attach command without any other data.  This is
    used to locate the default process stratum.
@@ -1493,7 +1552,7 @@ find_default_run_target (char *do_mesg)
     }
 
   if (count != 1)
-    error ("Don't know how to %s.  Try \"help target\".", do_mesg);
+    error (_("Don't know how to %s.  Try \"help target\"."), do_mesg);
 
   return runable;
 }
@@ -1520,9 +1579,9 @@ find_default_create_inferior (char *exec_file, char *allargs, char **env,
 }
 
 static int
-default_region_size_ok_for_hw_watchpoint (int byte_count)
+default_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
 {
-  return (byte_count <= TYPE_LENGTH (builtin_type_void_data_ptr));
+  return (len <= TYPE_LENGTH (builtin_type_void_data_ptr));
 }
 
 static int
@@ -1753,29 +1812,29 @@ store_waitstatus (struct target_waitstatus *ourstatus, int hoststatus)
 int (*target_activity_function) (void);
 int target_activity_fd;
 \f
-/* Convert a normal process ID to a string.  Returns the string in a static
-   buffer.  */
+/* Convert a normal process ID to a string.  Returns the string in a
+   static buffer.  */
 
 char *
 normal_pid_to_str (ptid_t ptid)
 {
-  static char buf[30];
+  static char buf[32];
 
-  sprintf (buf, "process %d", PIDGET (ptid));
+  xsnprintf (buf, sizeof buf, "process %d", ptid_get_pid (ptid));
   return buf;
 }
 
 /* Error-catcher for target_find_memory_regions */
 static int dummy_find_memory_regions (int (*ignore1) (), void *ignore2)
 {
-  error ("No target.");
+  error (_("No target."));
   return 0;
 }
 
 /* Error-catcher for target_make_corefile_notes */
 static char * dummy_make_corefile_notes (bfd *ignore1, int *ignore2)
 {
-  error ("No target.");
+  error (_("No target."));
   return NULL;
 }
 
@@ -1967,7 +2026,7 @@ debug_to_prepare_to_store (void)
 }
 
 static int
-deprecated_debug_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
+deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
                              int write, struct mem_attrib *attrib,
                              struct target_ops *target)
 {
@@ -2016,7 +2075,7 @@ debug_to_files_info (struct target_ops *target)
 }
 
 static int
-debug_to_insert_breakpoint (CORE_ADDR addr, char *save)
+debug_to_insert_breakpoint (CORE_ADDR addr, gdb_byte *save)
 {
   int retval;
 
@@ -2030,7 +2089,7 @@ debug_to_insert_breakpoint (CORE_ADDR addr, char *save)
 }
 
 static int
-debug_to_remove_breakpoint (CORE_ADDR addr, char *save)
+debug_to_remove_breakpoint (CORE_ADDR addr, gdb_byte *save)
 {
   int retval;
 
@@ -2060,15 +2119,16 @@ debug_to_can_use_hw_breakpoint (int type, int cnt, int from_tty)
 }
 
 static int
-debug_to_region_size_ok_for_hw_watchpoint (int byte_count)
+debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
 {
   CORE_ADDR retval;
 
-  retval = debug_target.to_region_size_ok_for_hw_watchpoint (byte_count);
+  retval = debug_target.to_region_ok_for_hw_watchpoint (addr, len);
 
   fprintf_unfiltered (gdb_stdlog,
-                     "TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT (%ld) = 0x%lx\n",
-                     (unsigned long) byte_count,
+                     "TARGET_REGION_OK_FOR_HW_WATCHPOINT (%ld, %ld) = 0x%lx\n",
+                     (unsigned long) addr,
+                     (unsigned long) len,
                      (unsigned long) retval);
   return retval;
 }
@@ -2101,7 +2161,7 @@ debug_to_stopped_data_address (struct target_ops *target, CORE_ADDR *addr)
 }
 
 static int
-debug_to_insert_hw_breakpoint (CORE_ADDR addr, char *save)
+debug_to_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *save)
 {
   int retval;
 
@@ -2115,7 +2175,7 @@ debug_to_insert_hw_breakpoint (CORE_ADDR addr, char *save)
 }
 
 static int
-debug_to_remove_hw_breakpoint (CORE_ADDR addr, char *save)
+debug_to_remove_hw_breakpoint (CORE_ADDR addr, gdb_byte *save)
 {
   int retval;
 
@@ -2303,17 +2363,6 @@ debug_to_remove_vfork_catchpoint (int pid)
   return retval;
 }
 
-static int
-debug_to_follow_fork (int follow_child)
-{
-  int retval =  debug_target.to_follow_fork (follow_child);
-
-  fprintf_unfiltered (gdb_stdlog, "target_follow_fork (%d) = %d\n",
-                     follow_child, retval);
-
-  return retval;
-}
-
 static void
 debug_to_insert_exec_catchpoint (int pid)
 {
@@ -2489,7 +2538,7 @@ setup_target_debug (void)
   current_target.to_remove_watchpoint = debug_to_remove_watchpoint;
   current_target.to_stopped_by_watchpoint = debug_to_stopped_by_watchpoint;
   current_target.to_stopped_data_address = debug_to_stopped_data_address;
-  current_target.to_region_size_ok_for_hw_watchpoint = debug_to_region_size_ok_for_hw_watchpoint;
+  current_target.to_region_ok_for_hw_watchpoint = debug_to_region_ok_for_hw_watchpoint;
   current_target.to_terminal_init = debug_to_terminal_init;
   current_target.to_terminal_inferior = debug_to_terminal_inferior;
   current_target.to_terminal_ours_for_output = debug_to_terminal_ours_for_output;
@@ -2506,7 +2555,6 @@ setup_target_debug (void)
   current_target.to_remove_fork_catchpoint = debug_to_remove_fork_catchpoint;
   current_target.to_insert_vfork_catchpoint = debug_to_insert_vfork_catchpoint;
   current_target.to_remove_vfork_catchpoint = debug_to_remove_vfork_catchpoint;
-  current_target.to_follow_fork = debug_to_follow_fork;
   current_target.to_insert_exec_catchpoint = debug_to_insert_exec_catchpoint;
   current_target.to_remove_exec_catchpoint = debug_to_remove_exec_catchpoint;
   current_target.to_reported_exec_events_per_exec_call = debug_to_reported_exec_events_per_exec_call;
@@ -2539,9 +2587,7 @@ do_monitor_command (char *cmd,
       || (current_target.to_rcmd == debug_to_rcmd
          && (debug_target.to_rcmd
              == (void (*) (char *, struct ui_file *)) tcomplain)))
-    {
-      error ("\"monitor\" command not supported by this target.\n");
-    }
+    error (_("\"monitor\" command not supported by this target."));
   target_rcmd (cmd, gdb_stdtarg);
 }
 
@@ -2554,28 +2600,29 @@ initialize_targets (void)
   add_info ("target", target_info, targ_desc);
   add_info ("files", target_info, targ_desc);
 
-  deprecated_add_show_from_set 
-    (add_set_cmd ("target", class_maintenance, var_zinteger,
-                 (char *) &targetdebug,
-                 "Set target debugging.\n\
+  add_setshow_zinteger_cmd ("target", class_maintenance, &targetdebug, _("\
+Set target debugging."), _("\
+Show target debugging."), _("\
 When non-zero, target debugging is enabled.  Higher numbers are more\n\
 verbose.  Changes do not take effect until the next \"run\" or \"target\"\n\
-command.", &setdebuglist),
-     &showdebuglist);
+command."),
+                           NULL,
+                           show_targetdebug,
+                           &setdebuglist, &showdebuglist);
 
   add_setshow_boolean_cmd ("trust-readonly-sections", class_support, 
-                          &trust_readonly, "\
-Set mode for reading from readonly sections.""\
-Show mode for reading from readonly sections.""\
+                          &trust_readonly, _("\
+Set mode for reading from readonly sections."), _("\
+Show mode for reading from readonly sections."), _("\
 When this mode is on, memory reads from readonly sections (such as .text)\n\
 will be read from the object file instead of from the target.  This will\n\
-result in significant performance improvement for remote targets.", "\
-Mode for reading from readonly sections is %s.",
-                          NULL, NULL,
+result in significant performance improvement for remote targets."),
+                          NULL,
+                          show_trust_readonly,
                           &setlist, &showlist);
 
   add_com ("monitor", class_obscure, do_monitor_command,
-          "Send a command to the remote monitor (remote targets only).");
+          _("Send a command to the remote monitor (remote targets only)."));
 
   target_dcache = dcache_init ();
 }
This page took 0.036106 seconds and 4 git commands to generate.