]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2009-06-19 Aleksandar Ristovski <aristovski@qnx.com>
authorPedro Alves <palves@redhat.com>
Fri, 19 Jun 2009 13:35:35 +0000 (13:35 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 19 Jun 2009 13:35:35 +0000 (13:35 +0000)
    Pedro Alves <pedro@codesourcery.com>

* target.h (struct target_ops) <supports_multi_process>: New
callback.
(target_supports_multi_process): New.
* server.c (handle_query): Even if GDB reports support, only
enable multi-process if the target also supports it.  Report
multi-process support only if the target backend supports it.
* linux-low.c (linux_supports_multi_process): New function.
(linux_target_ops): Install it as target_supports_multi_process
callback.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c
gdb/gdbserver/server.c
gdb/gdbserver/target.h

index 25bf3116a645e2bd184b879db9b5a79ce69b24bb..b973d55a679ca3665474006bb7d035eb1bedcf86 100644 (file)
@@ -1,3 +1,16 @@
+2009-06-19  Aleksandar Ristovski  <aristovski@qnx.com>
+           Pedro Alves <pedro@codesourcery.com>
+
+       * target.h (struct target_ops) <supports_multi_process>: New
+       callback.
+       (target_supports_multi_process): New.
+       * server.c (handle_query): Even if GDB reports support, only
+       enable multi-process if the target also supports it.  Report
+       multi-process support only if the target backend supports it.
+       * linux-low.c (linux_supports_multi_process): New function.
+       (linux_target_ops): Install it as target_supports_multi_process
+       callback.
+
 2009-05-24  Doug Evans  <dje@google.com>
 
        Global renaming of find_thread_pid to find_thread_ptid.
index 9af9e6eeeecbadd9f66f8b1389c7773a0ff5cad1..21bf523a9e0714b17cb7b2239b53b6f8dd5ffc51 100644 (file)
@@ -3008,6 +3008,12 @@ linux_start_non_stop (int nonstop)
   return 0;
 }
 
+static int
+linux_supports_multi_process (void)
+{
+  return 1;
+}
+
 static struct target_ops linux_target_ops = {
   linux_create_inferior,
   linux_attach,
@@ -3045,6 +3051,7 @@ static struct target_ops linux_target_ops = {
   linux_supports_non_stop,
   linux_async,
   linux_start_non_stop,
+  linux_supports_multi_process
 };
 
 static void
index 423427c356eadcdef61d1825bab225db5424b100..a9bf4a82d5a444e0e271bf8cc9d853b053cb7a7c 100644 (file)
@@ -1074,9 +1074,13 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
             p != NULL;
             p = strtok (NULL, ";"))
          {
-           /* Record if GDB knows about multiprocess support.  */
            if (strcmp (p, "multiprocess+") == 0)
-             multi_process = 1;
+             {
+               /* GDB supports and wants multi-process support if
+                  possible.  */
+               if (target_supports_multi_process ())
+                 multi_process = 1;
+             }
          }
 
       sprintf (own_buf, "PacketSize=%x;QPassSignals+", PBUFSIZ - 1);
@@ -1106,7 +1110,8 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
       if (the_target->qxfer_osdata != NULL)
        strcat (own_buf, ";qXfer:osdata:read+");
 
-      strcat (own_buf, ";multiprocess+");
+      if (target_supports_multi_process ())
+       strcat (own_buf, ";multiprocess+");
 
       if (target_supports_non_stop ())
        strcat (own_buf, ";QNonStop+");
index 7ff38493ea370ce4edf67a14c747f823bb1b4121..70b5d01e53ad0ded917b6209911ca9311bee541c 100644 (file)
@@ -275,6 +275,9 @@ struct target_ops
   /* Switch to non-stop (1) or all-stop (0) mode.  Return 0 on
      success, -1 otherwise.  */
   int (*start_non_stop) (int);
+
+  /* Returns true if the target supports multi-process debugging.  */
+  int (*supports_multi_process) (void);
 };
 
 extern struct target_ops *the_target;
@@ -311,6 +314,10 @@ void set_target_ops (struct target_ops *);
 #define target_async(enable) \
   (the_target->async ? (*the_target->async) (enable) : 0)
 
+#define target_supports_multi_process() \
+  (the_target->supports_multi_process ? \
+   (*the_target->supports_multi_process) () : 0)
+
 /* Start non-stop mode, returns 0 on success, -1 on failure.   */
 
 int start_non_stop (int nonstop);