Replace ../include/wait.h with gdb_wait.h.
[deliverable/binutils-gdb.git] / gdb / remote-rdi.c
index 69addf6ed35d22dbc68a5d3ffd108d7319d09896..b432515600702ccef9b7a36394306c0bdb02d875 100644 (file)
 #include "bfd.h"
 #include "symfile.h"
 #include "target.h"
-#include "wait.h"
+#include "gdb_wait.h"
 #include "gdbcmd.h"
 #include "objfiles.h"
 #include "gdb-stabs.h"
 #include "gdbthread.h"
 #include "gdbcore.h"
+#include "breakpoint.h"
 
 #ifdef USG
 #include <sys/types.h>
@@ -108,13 +109,13 @@ static int max_load_size;
 static int execute_status;
 
 /* Send heatbeat packets? */
-static int   rdi_heartbeat = 0;
+static int rdi_heartbeat = 0;
 
 /* Target has ROM at address 0. */
 static int rom_at_zero = 0;
 
 /* Enable logging? */
-static int   log_enable = 0;
+static int log_enable = 0;
 
 /* Name of the log file. Default is "rdi.log". */
 static char *log_filename;
@@ -236,8 +237,8 @@ device is attached to the remote system (e.g. /dev/ttya).");
 
   /* split name after whitespace, pass tail as arg to open command */
 
-  devName = strdup(name);
-  p = strchr(devName,' ');
+  devName = xstrdup (name);
+  p = strchr (devName, ' ');
   if (p)
     {
       *p = '\0';
@@ -251,7 +252,7 @@ device is attached to the remote system (e.g. /dev/ttya).");
 
   /* Make the basic low-level connection.  */
 
-  Adp_CloseDevice ();
+  arm_rdi_close (0);
   rslt = Adp_OpenDevice (devName, openArgs, rdi_heartbeat);
 
   if (rslt != adp_ok)
@@ -280,7 +281,7 @@ device is attached to the remote system (e.g. /dev/ttya).");
     {
       printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt));
       Adp_CloseDevice ();
-      error("RID_open failed\n");
+      error ("RID_open failed\n");
     }
 
   rslt = angel_RDI_info (RDIInfo_Target, &arg1, &arg2);
@@ -738,6 +739,12 @@ arm_rdi_kill ()
 static void
 arm_rdi_mourn_inferior ()
 {
+  /* We remove the inserted breakpoints in case the user wants to
+     issue another target and load commands to rerun his application;
+     This is something that wouldn't work on a native target, for instance,
+     as the process goes away when the inferior exits, but it works with
+     some remote targets like this one.  That is why this is done here. */
+  remove_breakpoints();
   unpush_target (&arm_rdi_ops);
   generic_mourn_inferior ();
 }
@@ -999,47 +1006,49 @@ Specify the serial device it is connected to (e.g. /dev/ttya).";
   arm_rdi_ops.to_magic = OPS_MAGIC;
 }
 
-static void rdilogfile_command (char *arg, int from_tty)
+static void 
+rdilogfile_command (char *arg, int from_tty)
 {
   if (!arg || strlen (arg) == 0)
     {
       printf_filtered ("rdi log file is '%s'\n", log_filename);
       return;
     }
-  
+
   if (log_filename)
     free (log_filename);
-  
-  log_filename = strdup (arg);
+
+  log_filename = xstrdup (arg);
 
   Adp_SetLogfile (log_filename);
 }
 
-static void rdilogenable_command (char *args, int from_tty)
+static void 
+rdilogenable_command (char *args, int from_tty)
 {
   if (!args || strlen (args) == 0)
     {
       printf_filtered ("rdi log is %s\n", log_enable ? "enabled" : "disabled");
       return;
     }
-  
-  if (!strcasecmp (args,"1") || 
-      !strcasecmp (args,"y") ||
-      !strcasecmp (args,"yes") ||
-      !strcasecmp (args,"on") ||
-      !strcasecmp (args,"t") ||
-      !strcasecmp (args,"true"))
-    Adp_SetLogEnable (log_enable=1);
-  else if (!strcasecmp (args,"0") || 
-      !strcasecmp (args,"n") ||
-      !strcasecmp (args,"no") ||
-      !strcasecmp (args,"off") ||
-      !strcasecmp (args,"f") ||
-      !strcasecmp (args,"false"))
-    Adp_SetLogEnable (log_enable=0);
+
+  if (!strcasecmp (args, "1") ||
+      !strcasecmp (args, "y") ||
+      !strcasecmp (args, "yes") ||
+      !strcasecmp (args, "on") ||
+      !strcasecmp (args, "t") ||
+      !strcasecmp (args, "true"))
+    Adp_SetLogEnable (log_enable = 1);
+  else if (!strcasecmp (args, "0") ||
+          !strcasecmp (args, "n") ||
+          !strcasecmp (args, "no") ||
+          !strcasecmp (args, "off") ||
+          !strcasecmp (args, "f") ||
+          !strcasecmp (args, "false"))
+    Adp_SetLogEnable (log_enable = 0);
   else
     printf_filtered ("rdilogenable: unrecognized argument '%s'\n"
-                     "              try y or n\n",args);
+                    "              try y or n\n", args);
 }
 
 void
@@ -1048,9 +1057,9 @@ _initialize_remote_rdi ()
   init_rdi_ops ();
   add_target (&arm_rdi_ops);
 
-  log_filename = strdup("rdi.log");
-  Adp_SetLogfile(log_filename);
-  Adp_SetLogEnable(log_enable);
+  log_filename = xstrdup ("rdi.log");
+  Adp_SetLogfile (log_filename);
+  Adp_SetLogEnable (log_enable);
 
   add_cmd ("rdilogfile", class_maintenance,
           rdilogfile_command,
@@ -1061,7 +1070,7 @@ Without an argument, shows the current logfile name.\n\
 See also: rdilogenable\n",
           &maintenancelist);
 
-  add_cmd("rdilogenable", class_maintenance,
+  add_cmd ("rdilogenable", class_maintenance,
           rdilogenable_command,
           "Set enable logging of ADP packets.\n\
 This will log ADP packets exchanged between gdb and the\n\
@@ -1078,7 +1087,7 @@ Withough an argument, it will display current state.\n",
 A true value disables vector catching, false enables vector catching.\n\
 This is evaluated at the time the 'target rdi' command is executed\n",
                  &setlist),
-    &showlist);
+     &showlist);
 
   add_show_from_set
     (add_set_cmd ("rdiheartbeat", no_class,
@@ -1088,7 +1097,7 @@ I don't know why you would want this. If you enable them,\n\
 it will confuse ARM and EPI JTAG interface boxes as well\n\
 as the Angel Monitor.\n",
                  &setlist),
-    &showlist);
+     &showlist);
 }
 
 /* A little dummy to make linking with the library succeed. */
This page took 0.025843 seconds and 4 git commands to generate.