Conditional Z1 breakpoint hangs GDBserver.
[deliverable/binutils-gdb.git] / gdb / gdbserver / server.c
index 115aca4d8f9eddee87883e9d8116f4638d52fd4b..8317ac07d126e6faf5f4d8ef2ead747002c0996f 100644 (file)
@@ -2367,8 +2367,18 @@ resume (struct thread_resume *actions, size_t num_actions)
     {
       last_ptid = mywait (minus_one_ptid, &last_status, 0, 1);
 
+      if (last_status.kind == TARGET_WAITKIND_NO_RESUMED)
+       {
+         /* No proper RSP support for this yet.  At least return
+            error.  */
+         sprintf (own_buf, "E.No unwaited-for children left.");
+         disable_async_io ();
+         return;
+       }
+
       if (last_status.kind != TARGET_WAITKIND_EXITED
-          && last_status.kind != TARGET_WAITKIND_SIGNALLED)
+          && last_status.kind != TARGET_WAITKIND_SIGNALLED
+         && last_status.kind != TARGET_WAITKIND_NO_RESUMED)
        current_inferior->last_status = last_status;
 
       /* From the client's perspective, all-stop mode always stops all
@@ -3340,6 +3350,15 @@ main (int argc, char *argv[])
     }
 }
 
+/* Skip PACKET until the next semi-colon (or end of string).  */
+
+static void
+skip_to_semicolon (char **packet)
+{
+  while (**packet != '\0' && **packet != ';')
+    (*packet)++;
+}
+
 /* Process options coming from Z packets for *point at address
    POINT_ADDR.  PACKET is the packet buffer.  *PACKET is updated
    to point to the first char after the last processed option.  */
@@ -3366,7 +3385,8 @@ process_point_options (CORE_ADDR point_addr, char **packet)
          /* Conditional expression.  */
          if (debug_threads)
            debug_printf ("Found breakpoint condition.\n");
-         add_breakpoint_condition (point_addr, &dataptr);
+         if (!add_breakpoint_condition (point_addr, &dataptr))
+           skip_to_semicolon (&dataptr);
        }
       else if (strncmp (dataptr, "cmds:", strlen ("cmds:")) == 0)
        {
@@ -3375,15 +3395,15 @@ process_point_options (CORE_ADDR point_addr, char **packet)
            debug_printf ("Found breakpoint commands %s.\n", dataptr);
          persist = (*dataptr == '1');
          dataptr += 2;
-         add_breakpoint_commands (point_addr, &dataptr, persist);
+         if (add_breakpoint_commands (point_addr, &dataptr, persist))
+           skip_to_semicolon (&dataptr);
        }
       else
        {
          fprintf (stderr, "Unknown token %c, ignoring.\n",
                   *dataptr);
          /* Skip tokens until we find one that we recognize.  */
-         while (*dataptr && *dataptr != ';')
-           dataptr++;
+         skip_to_semicolon (&dataptr);
        }
     }
   *packet = dataptr;
@@ -3897,7 +3917,11 @@ handle_target_event (int err, gdb_client_data client_data)
   last_ptid = mywait (minus_one_ptid, &last_status,
                      TARGET_WNOHANG, 1);
 
-  if (last_status.kind != TARGET_WAITKIND_IGNORE)
+  if (last_status.kind == TARGET_WAITKIND_NO_RESUMED)
+    {
+      /* No RSP support for this yet.  */
+    }
+  else if (last_status.kind != TARGET_WAITKIND_IGNORE)
     {
       int pid = ptid_get_pid (last_ptid);
       struct process_info *process = find_process_pid (pid);
This page took 0.024724 seconds and 4 git commands to generate.