* gdb.texinfo (Continuing and Stepping): When talking about "step"
[deliverable/binutils-gdb.git] / gdb / remote-udi.c
index afe9dd4be8b5ccddc0e6c2d64021f1f4523aa2a4..17c1016065e03460e59c42066f7e2a4e67249d66 100644 (file)
@@ -52,7 +52,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 extern int stop_soon_quietly;           /* for wait_for_inferior */
 extern struct value *call_function_by_hand();
-static void udi_resume PARAMS ((int pid, int step, int sig));
+static void udi_resume PARAMS ((int pid, int step, enum target_signal sig));
 static void udi_fetch_registers PARAMS ((int regno));
 static void udi_load PARAMS ((char *args, int from_tty));
 static void fetch_register PARAMS ((int regno));
@@ -115,10 +115,6 @@ extern     char    dfe_errmsg[];           /* error string */
 /* malloc'd name of the program on the remote system.  */
 static char *prog_name = NULL;
 
-/* Number of SIGTRAPs we need to simulate.  That is, the next
-   NEED_ARTIFICIAL_TRAP calls to udi_wait should just return
-   SIGTRAP without actually waiting for anything.  */
-
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 
@@ -154,7 +150,19 @@ udi_create_inferior (execfile, args, env)
 
   args1 = alloca (strlen(execfile) + strlen(args) + 2);
 
-  strcpy (args1, execfile);
+  if (execfile[0] == '\0')
+
+    /* It is empty.  We need to quote it somehow, or else the target
+       will think there is no argument being passed here.  According
+       to the UDI spec it is quoted "according to TIP OS rules" which
+       I guess means quoting it like the Unix shell should work
+       (sounds pretty bogus to me...).  In fact it doesn't work (with
+       isstip anyway), but passing in two quotes as the argument seems
+       like a reasonable enough behavior anyway (I guess).  */
+
+    strcpy (args1, "''");
+  else
+    strcpy (args1, execfile);
   strcat (args1, " ");
   strcat (args1, args);
 
@@ -180,6 +188,9 @@ udi_mourn()
      to work between "target udi" and "run", so why not now?  */
   pop_target ();                /* Pop back to no-child state */
 #endif
+  /* But if we're going to want to run it again, we better remove the
+     breakpoints...  */
+  remove_breakpoints ();
   generic_mourn_inferior ();
 }
 
@@ -292,10 +303,15 @@ udi_close (quitting)      /*FIXME: how is quitting used */
     return;
 
   /* We should never get here if there isn't something valid in
-     udi_session_id. */
+     udi_session_id.  */
 
   if (UDIDisconnect (udi_session_id, UDITerminateSession))
-    error ("UDIDisconnect() failed in udi_close");
+    {
+      if (quitting)
+       warning ("UDIDisconnect() failed in udi_close");
+      else
+       error ("UDIDisconnect() failed in udi_close");
+    }
 
   /* Do not try to close udi_session_id again, later in the program.  */
   udi_session_id = -1;
@@ -321,6 +337,9 @@ udi_attach (args, from_tty)
   UDIBool      HostEndian = 0;
   UDIError     err;
 
+  if (args == NULL)
+    error_no_arg ("program to attach");
+
   if (udi_session_id < 0)
       error ("UDI connection not opened yet, use the 'target udi' command.\n");
        
@@ -349,8 +368,11 @@ udi_detach (args,from_tty)
   if (UDIDisconnect (udi_session_id, UDIContinueSession))
     error ("UDIDisconnect() failed in udi_detach");
 
-  pop_target();                /* calls udi_close to do the real work */
+  /* calls udi_close to do the real work (which looks like it calls
+     UDIDisconnect with UDITerminateSession, FIXME).  */
+  pop_target();
 
+  /* FIXME, message too similar to what udi_close prints.  */
   if (from_tty)
     printf_unfiltered ("Ending remote debugging\n");
 }
@@ -993,10 +1015,18 @@ just invoke udi_close, which seems to get things right.
 
   if (from_tty)
     printf_unfiltered("Target has been stopped.");
-#else
+#endif /* 0 */
+#if 0
   udi_close(0);
-#endif
   pop_target();
+#endif /* 0 */
+
+  /* Keep the target around, e.g. so "run" can do the right thing when
+     we are already debugging something.  FIXME-maybe: should we kill the
+     TIP with UDIDisconnect using UDITerminateSession, and then restart
+     it on the next "run"?  */
+
+  inferior_pid = 0;
 }
 
 /* 
This page took 0.023833 seconds and 4 git commands to generate.