Add "make pdf" and "make install-pdf", from Brooks Moses
[deliverable/binutils-gdb.git] / gdb / ocd.c
index a0179090e8ef06a5a71c59fdece31e1aa1682230..f52990088aac75d21c319941edc04b6f7ac05ff7 100644 (file)
--- a/gdb/ocd.c
+++ b/gdb/ocd.c
@@ -1,7 +1,7 @@
 /* Target communications support for Macraigor Systems' On-Chip Debugging
 
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 Free
-   Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006, 2007
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,8 +17,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 "gdbcore.h"
@@ -128,7 +128,7 @@ ocd_error (char *s, int error_code)
       s = buf;
     }
 
-  error ("%s", s);
+  error (("%s"), s);
 }
 
 /*  Return nonzero if the thread TH is still alive on the remote system.  */
@@ -177,19 +177,19 @@ ocd_start_remote (void *dummy)
   p = ocd_get_packet (buf[0], &pktlen, remote_timeout);
 
   if (pktlen < 2)
-    error ("Truncated response packet from OCD device");
+    error (_("Truncated response packet from OCD device"));
 
   status = p[1];
   error_code = p[2];
 
   if (error_code != 0)
-    ocd_error ("OCD_INIT:", error_code);
+    ocd_error (_("OCD_INIT:"), error_code);
 
   ocd_do_command (OCD_AYT, &status, &pktlen);
 
   p = ocd_do_command (OCD_GET_VERSION, &status, &pktlen);
 
-  printf_unfiltered ("[Wiggler version %x.%x, capability 0x%x]\n",
+  printf_unfiltered (_("[Wiggler version %x.%x, capability 0x%x]\n"),
                     p[0], p[1], (p[2] << 16) | p[3]);
 
   /* If processor is still running, stop it.  */
@@ -208,7 +208,7 @@ ocd_start_remote (void *dummy)
   p = ocd_get_packet (buf[0], &pktlen, remote_timeout);
 
   if (pktlen < 2)
-    error ("Truncated response packet from OCD device");
+    error (_("Truncated response packet from OCD device"));
 
   status = p[1];
   error_code = p[2];
@@ -223,7 +223,7 @@ ocd_start_remote (void *dummy)
    doesn't happen here (in fact, it may not be possible to get the monitor to
    send the appropriate packet).  */
 
-  flush_cached_frames ();
+  reinit_frame_cache ();
   registers_changed ();
   stop_pc = read_pc ();
   print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
@@ -252,8 +252,8 @@ ocd_open (char *name, int from_tty, enum ocd_target_type target_type,
   int pktlen;
 
   if (name == 0)
-    error ("To open an OCD connection, you need to specify the\n\
-device the OCD device is attached to (e.g. /dev/ttya).");
+    error (_("To open an OCD connection, you need to specify the\n\
+device the OCD device is attached to (e.g. /dev/ttya)."));
 
   target_preopen (from_tty);
 
@@ -304,7 +304,7 @@ device the OCD device is attached to (e.g. /dev/ttya).");
                     RETURN_MASK_ALL))
     {
       pop_target ();
-      error ("Failed to connect to OCD.");
+      error (_("Failed to connect to OCD."));
     }
 }
 
@@ -317,7 +317,7 @@ void
 ocd_detach (char *args, int from_tty)
 {
   if (args)
-    error ("Argument given to \"detach\" when remotely debugging.");
+    error (_("Argument given to \"detach\" when remotely debugging."));
 
   pop_target ();
   if (from_tty)
@@ -346,7 +346,7 @@ ocd_stop (void)
   ocd_do_command (OCD_STOP, &status, &pktlen);
 
   if (!(status & OCD_FLAG_BDM))
-    error ("Can't stop target via BDM");
+    error (_("Can't stop target via BDM"));
 }
 
 static volatile int ocd_interrupt_flag;
@@ -397,7 +397,7 @@ interrupt_query (void)
 Give up (and stop debugging it)? "))
     {
       target_mourn_inferior ();
-      throw_exception (RETURN_QUIT);
+      deprecated_throw_reason (RETURN_QUIT);
     }
 
   target_terminal_inferior ();
@@ -435,7 +435,7 @@ ocd_wait (void)
       signal (SIGINT, ofunc);
 
       if (pktlen < 2)
-       error ("Truncated response packet from OCD device");
+       error (_("Truncated response packet from OCD device"));
 
       last_run_status = p[1];
       error_code = p[2];
@@ -444,9 +444,9 @@ ocd_wait (void)
        ocd_error ("target_wait:", error_code);
 
       if (last_run_status & OCD_FLAG_PWF)
-       error ("OCD device lost VCC at BDM interface.");
+       error (_("OCD device lost VCC at BDM interface."));
       else if (last_run_status & OCD_FLAG_CABLE_DISC)
-       error ("OCD device cable appears to have been disconnected.");
+       error (_("OCD device cable appears to have been disconnected."));
     }
 
   if (ocd_interrupt_flag)
@@ -490,7 +490,7 @@ ocd_read_bdm_registers (int first_bdm_regno, int last_bdm_regno, int *reglen)
 
   if (i > pktlen - 4
       || ((i & 3) != 0))
-    error ("Register block size bad:  %d", i);
+    error (_("Register block size bad:  %d"), i);
 
   *reglen = i;
 
@@ -534,7 +534,7 @@ ocd_write_bdm_registers (int first_bdm_regno, unsigned char *regptr, int reglen)
   p = ocd_get_packet (OCD_WRITE_REGS, &pktlen, remote_timeout);
 
   if (pktlen < 3)
-    error ("Truncated response packet from OCD device");
+    error (_("Truncated response packet from OCD device"));
 
   status = p[1];
   error_code = p[2];
@@ -600,7 +600,7 @@ ocd_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
       ocd_put_packet (buf, 8 + numbytes);
       p = ocd_get_packet (OCD_WRITE_MEM, &pktlen, remote_timeout);
       if (pktlen < 3)
-       error ("Truncated response packet from OCD device");
+       error (_("Truncated response packet from OCD device"));
 
       status = p[1];
       error_code = p[2];
@@ -670,7 +670,7 @@ ocd_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
       ocd_put_packet (buf, 7);
       p = ocd_get_packet (OCD_READ_MEM, &pktlen, remote_timeout);
       if (pktlen < 4)
-       error ("Truncated response packet from OCD device");
+       error (_("Truncated response packet from OCD device"));
 
       status = p[1];
       error_code = p[2];
@@ -744,9 +744,9 @@ readchar (int timeout)
   switch (ch)
     {
     case SERIAL_EOF:
-      error ("Remote connection closed");
+      error (_("Remote connection closed"));
     case SERIAL_ERROR:
-      perror_with_name ("Remote communication error");
+      perror_with_name (_("Remote communication error"));
     case SERIAL_TIMEOUT:
     default:
       return ch;
@@ -786,7 +786,7 @@ ocd_put_packet (unsigned char *buf, int len)
 
   *packet_ptr++ = -checksum;
   if (serial_write (ocd_desc, packet, packet_ptr - packet))
-    perror_with_name ("output_packet: write failed");
+    perror_with_name (_("output_packet: write failed"));
 }
 
 /* Get a packet from the OCD device.  Timeout is only enforced for the
@@ -807,10 +807,10 @@ ocd_get_packet (int cmd, int *lenp, int timeout)
   ch = readchar (timeout);
 
   if (ch < 0)
-    error ("ocd_get_packet (readchar): %d", ch);
+    error (_("ocd_get_packet (readchar): %d"), ch);
 
   if (ch != 0x55)
-    error ("ocd_get_packet (readchar): %d", ch);
+    error (_("ocd_get_packet (readchar): %d"), ch);
 
 /* Found the start of a packet */
 
@@ -822,7 +822,7 @@ ocd_get_packet (int cmd, int *lenp, int timeout)
   ch = readchar (timeout);
 
   if (ch < 0)
-    error ("ocd_get_packet (readchar): %d", ch);
+    error (_("ocd_get_packet (readchar): %d"), ch);
 
   *packet_ptr++ = ch;
   checksum += ch;
@@ -832,7 +832,7 @@ ocd_get_packet (int cmd, int *lenp, int timeout)
   ch = readchar (timeout);
 
   if (ch < 0)
-    error ("ocd_get_packet (readchar): %d", ch);
+    error (_("ocd_get_packet (readchar): %d"), ch);
   *packet_ptr++ = ch;
   checksum += ch;
 
@@ -841,7 +841,7 @@ ocd_get_packet (int cmd, int *lenp, int timeout)
   ch = readchar (timeout);
 
   if (ch < 0)
-    error ("ocd_get_packet (readchar): %d", ch);
+    error (_("ocd_get_packet (readchar): %d"), ch);
   *packet_ptr++ = ch;
   checksum += ch;
 
@@ -901,7 +901,7 @@ ocd_get_packet (int cmd, int *lenp, int timeout)
          len = 257;
          break;
        default:
-         error ("ocd_get_packet: unknown packet type 0x%x\n", ch);
+         error (_("ocd_get_packet: unknown packet type 0x%x."), ch);
        }
     }
 
@@ -910,7 +910,7 @@ ocd_get_packet (int cmd, int *lenp, int timeout)
       ch = readchar (timeout);
 
       if (ch < 0)
-       error ("ocd_get_packet (readchar): %d", ch);
+       error (_("ocd_get_packet (readchar): %d"), ch);
       *packet_ptr++ = ch;
       checksum += ch;
       len = ch;
@@ -923,16 +923,16 @@ ocd_get_packet (int cmd, int *lenp, int timeout)
       ch = readchar (timeout);
 
       if (ch < 0)
-       error ("ocd_get_packet (readchar): %d", ch);
+       error (_("ocd_get_packet (readchar): %d"), ch);
       *packet_ptr++ = ch;
       checksum += ch;
     }
 
   if (checksum != 0)
-    error ("ocd_get_packet: bad packet checksum");
+    error (_("ocd_get_packet: bad packet checksum"));
 
   if (cmd != -1 && cmd != packet[0])
-    error ("Response phase error.  Got 0x%x, expected 0x%x", packet[0], cmd);
+    error (_("Response phase error.  Got 0x%x, expected 0x%x"), packet[0], cmd);
 
   *lenp = packet_ptr - packet - 1;     /* Subtract checksum byte */
   return packet;
@@ -956,7 +956,7 @@ ocd_do_command (int cmd, int *statusp, int *lenp)
   p = ocd_get_packet (*buf, lenp, remote_timeout);
 
   if (*lenp < 3)
-    error ("Truncated response packet from OCD device");
+    error (_("Truncated response packet from OCD device"));
 
   status = p[1];
   error_code = p[2];
@@ -968,9 +968,9 @@ ocd_do_command (int cmd, int *statusp, int *lenp)
     }
 
   if (status & OCD_FLAG_PWF)
-    error ("OCD device can't detect VCC at BDM interface.");
+    error (_("OCD device can't detect VCC at BDM interface."));
   else if (status & OCD_FLAG_CABLE_DISC)
-    error ("BDM cable appears to be disconnected.");
+    error (_("BDM cable appears to be disconnected."));
 
   *statusp = status;
 
@@ -1011,17 +1011,16 @@ ocd_mourn (void)
   generic_mourn_inferior ();
 }
 
-/* All we actually do is set the PC to the start address of exec_bfd, and start
-   the program at that point.  */
+/* All we actually do is set the PC to the start address of exec_bfd.  */
 
 void
 ocd_create_inferior (char *exec_file, char *args, char **env, int from_tty)
 {
   if (args && (*args != '\000'))
-    error ("Args are not supported by BDM.");
+    error (_("Args are not supported by BDM."));
 
   clear_proceed_status ();
-  proceed (bfd_get_start_address (exec_bfd), TARGET_SIGNAL_0, 0);
+  write_pc (bfd_get_start_address (exec_bfd));
 }
 
 void
@@ -1049,34 +1048,33 @@ ocd_load (char *args, int from_tty)
 /* BDM (at least on CPU32) uses a different breakpoint */
 
 int
-ocd_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
+ocd_insert_breakpoint (struct bp_target_info *bp_tgt)
 {
   static char break_insn[] = BDM_BREAKPOINT;
   int val;
 
-  val = target_read_memory (addr, contents_cache, sizeof (break_insn));
+  bp_tgt->placed_size = bp_tgt->shadow_len = sizeof (break_insn);
+  val = target_read_memory (bp_tgt->placed_address, bp_tgt->shadow_contents,
+                           bp_tgt->placed_size);
 
   if (val == 0)
-    val = target_write_memory (addr, break_insn, sizeof (break_insn));
+    val = target_write_memory (bp_tgt->placed_address, break_insn,
+                              bp_tgt->placed_size);
 
   return val;
 }
 
 int
-ocd_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
+ocd_remove_breakpoint (struct bp_target_info *bp_tgt)
 {
-  static char break_insn[] = BDM_BREAKPOINT;
-  int val;
-
-  val = target_write_memory (addr, contents_cache, sizeof (break_insn));
-
-  return val;
+  return target_write_memory (bp_tgt->placed_address, bp_tgt->shadow_contents,
+                             bp_tgt->placed_size);
 }
 
 static void
 bdm_command (char *args, int from_tty)
 {
-  error ("bdm command must be followed by `reset'");
+  error (_("bdm command must be followed by `reset'"));
 }
 
 static void
@@ -1085,7 +1083,7 @@ bdm_reset_command (char *args, int from_tty)
   int status, pktlen;
 
   if (!ocd_desc)
-    error ("Not connected to OCD device.");
+    error (_("Not connected to OCD device."));
 
   ocd_do_command (OCD_RESET, &status, &pktlen);
   dcache_invalidate (target_dcache);
@@ -1098,7 +1096,7 @@ bdm_restart_command (char *args, int from_tty)
   int status, pktlen;
 
   if (!ocd_desc)
-    error ("Not connected to OCD device.");
+    error (_("Not connected to OCD device."));
 
   ocd_do_command (OCD_RESET_RUN, &status, &pktlen);
   last_run_status = status;
@@ -1123,10 +1121,10 @@ bdm_update_flash_command (char *args, int from_tty)
   void (*store_registers_tmp) (int);
 
   if (!ocd_desc)
-    error ("Not connected to OCD device.");
+    error (_("Not connected to OCD device."));
 
   if (!args)
-    error ("Must specify file containing new OCD code.");
+    error (_("Must specify file containing new OCD code."));
 
 /*  old_chain = make_cleanup (flash_cleanup, 0); */
 
@@ -1156,16 +1154,19 @@ _initialize_remote_ocd (void)
   extern struct cmd_list_element *cmdlist;
   static struct cmd_list_element *ocd_cmd_list = NULL;
 
-  deprecated_add_show_from_set
-    (add_set_cmd ("remotetimeout", no_class,
-                 var_integer, (char *) &remote_timeout,
-                 "Set timeout value for remote read.\n", &setlist),
-     &showlist);
-
-  add_prefix_cmd ("ocd", class_obscure, bdm_command, "", &ocd_cmd_list, "ocd ",
-                 0, &cmdlist);
-
-  add_cmd ("reset", class_obscure, bdm_reset_command, "", &ocd_cmd_list);
-  add_cmd ("restart", class_obscure, bdm_restart_command, "", &ocd_cmd_list);
-  add_cmd ("update-flash", class_obscure, bdm_update_flash_command, "", &ocd_cmd_list);
+  add_setshow_integer_cmd ("remotetimeout", no_class, &remote_timeout, _("\
+Set timeout value for remote read."), _("\
+Show timeout value for remote read."), NULL,
+                          NULL,
+                          NULL, /* FIXME: i18n: */
+                          &setlist, &showlist);
+
+  /* FIXME: i18n: What documentation?  */
+  add_prefix_cmd ("ocd", class_obscure, bdm_command, (""), &ocd_cmd_list,
+                 "ocd ", 0, &cmdlist);
+
+  /* FIXME: i18n: what documentation? */
+  add_cmd ("reset", class_obscure, bdm_reset_command, (""), &ocd_cmd_list);
+  add_cmd ("restart", class_obscure, bdm_restart_command, (""), &ocd_cmd_list);
+  add_cmd ("update-flash", class_obscure, bdm_update_flash_command, (""), &ocd_cmd_list);
 }
This page took 0.031765 seconds and 4 git commands to generate.