Make sure target supports non-stop.
authorVladimir Prus <vladimir@codesourcery.com>
Tue, 19 Aug 2008 13:22:14 +0000 (13:22 +0000)
committerVladimir Prus <vladimir@codesourcery.com>
Tue, 19 Aug 2008 13:22:14 +0000 (13:22 +0000)
        * infcmd.c (run_command_1, attach_command): If non-stop mode
        is requested, verify the target supports it.
        * linux-nat.c (linux_nat_supports_non_stop): New.
        (linux_nat_add_target): Register the above.
        * target.c (find_default_supports_non_stop)
        (target_supports_non_stop): New.
        (init_dummy_target): Register find_default_supports_non_stop.
        * target.h (struct target_ops): New field to_supports_non_stop.
        (target_supports_non_stop): New.

gdb/ChangeLog
gdb/infcmd.c
gdb/linux-nat.c
gdb/target.c
gdb/target.h

index 7b3564e9190282197b06ec47d374d78ef5e1101d..35bd2acda734249f5370abf8c1c8e7235ed37b64 100644 (file)
@@ -1,3 +1,16 @@
+2008-08-19  Vladimir Prus  <vladimir@codesourcery.com>
+
+       Make sure target supports non-stop.
+        * infcmd.c (run_command_1, attach_command): If non-stop mode
+        is requested, verify the target supports it.
+        * linux-nat.c (linux_nat_supports_non_stop): New.
+        (linux_nat_add_target): Register the above.
+        * target.c (find_default_supports_non_stop)
+        (target_supports_non_stop): New.
+        (init_dummy_target): Register find_default_supports_non_stop.
+        * target.h (struct target_ops): New field to_supports_non_stop.
+        (target_supports_non_stop): New.
+
 2008-08-19  Pedro Alves  <pedro@codesourcery.com>
            Vladimir Prus  <vladimir@codesourcery.com>
 
index 82d4710d1ddf798f982affc77aa4eafe0a80185a..02ec980d6aaa4928de0a996cca2f505e78da2bb7 100644 (file)
@@ -503,6 +503,9 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main)
 
   exec_file = (char *) get_exec_file (0);
 
+  if (non_stop && !target_supports_non_stop ())
+    error (_("The target does not support running in non-stop mode."));
+
   /* We keep symbols from add-symbol-file, on the grounds that the
      user might want to add some symbols before running the program
      (right?).  But sometimes (dynamic loading where the user manually
@@ -2020,6 +2023,9 @@ attach_command (char *args, int from_tty)
      this function should probably be moved into target_pre_inferior.  */
   target_pre_inferior (from_tty);
 
+  if (non_stop && !target_supports_non_stop ())
+    error (_("Cannot attach to this target in non-stop mode"));
+
   if (args)
     {
       async_exec = strip_bg_char (&args);
index b25104e86af38ae698fe8ae84d96d64b48d426c4..126f7dcb781222c90221d6f90a5d757290c0afe2 100644 (file)
@@ -4018,6 +4018,12 @@ linux_nat_can_async_p (void)
   return linux_nat_async_mask_value;
 }
 
+static int
+linux_nat_supports_non_stop (void)
+{
+  return 1;
+}
+
 /* target_async_mask implementation.  */
 
 static int
@@ -4374,6 +4380,7 @@ linux_nat_add_target (struct target_ops *t)
 
   t->to_can_async_p = linux_nat_can_async_p;
   t->to_is_async_p = linux_nat_is_async_p;
+  t->to_supports_non_stop = linux_nat_supports_non_stop;
   t->to_async = linux_nat_async;
   t->to_async_mask = linux_nat_async_mask;
   t->to_terminal_inferior = linux_nat_terminal_inferior;
index e4699053f4fe2fb25fb6308ed072fa1e6f39309e..1f658194d2ef983e88f6d35cbdd9c7679af9f50c 100644 (file)
@@ -2126,6 +2126,29 @@ find_default_is_async_p (void)
   return 0;
 }
 
+int
+find_default_supports_non_stop (void)
+{
+  struct target_ops *t;
+
+  t = find_default_run_target (NULL);
+  if (t && t->to_supports_non_stop)
+    return (t->to_supports_non_stop) ();
+  return 0;
+}
+
+int
+target_supports_non_stop ()
+{
+  struct target_ops *t;
+  for (t = &current_target; t != NULL; t = t->beneath)
+    if (t->to_supports_non_stop)
+      return t->to_supports_non_stop ();
+
+  return 0;
+}
+
+
 static int
 default_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
 {
@@ -2400,6 +2423,7 @@ init_dummy_target (void)
   dummy_target.to_create_inferior = find_default_create_inferior;
   dummy_target.to_can_async_p = find_default_can_async_p;
   dummy_target.to_is_async_p = find_default_is_async_p;
+  dummy_target.to_supports_non_stop = find_default_supports_non_stop;
   dummy_target.to_pid_to_str = normal_pid_to_str;
   dummy_target.to_stratum = dummy_stratum;
   dummy_target.to_find_memory_regions = dummy_find_memory_regions;
index 350a7c4f9f1123189dd5bd0675e4d56021df6cf5..067c031d8c94621f391ffdeff67525d029967656 100644 (file)
@@ -422,6 +422,7 @@ struct target_ops
     int (*to_is_async_p) (void);
     void (*to_async) (void (*) (enum inferior_event_type, void *), void *);
     int (*to_async_mask) (int);
+    int (*to_supports_non_stop) (void);
     int (*to_find_memory_regions) (int (*) (CORE_ADDR,
                                            unsigned long,
                                            int, int, int,
@@ -966,6 +967,8 @@ extern int target_async_permitted;
 /* Is the target in asynchronous execution mode? */
 #define target_is_async_p() (current_target.to_is_async_p ())
 
+int target_supports_non_stop (void);
+
 /* Put the target in async mode with the specified callback function. */
 #define target_async(CALLBACK,CONTEXT) \
      (current_target.to_async ((CALLBACK), (CONTEXT)))
This page took 0.035456 seconds and 4 git commands to generate.