From: Pedro Alves <pedro@codesourcery.com>
To: Aleksandar Ristovski <aristovski@qnx.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] gdbserver: qXfer multiprocess
Date: Fri, 19 Jun 2009 13:41:00 -0000 [thread overview]
Message-ID: <200906191442.16707.pedro@codesourcery.com> (raw)
In-Reply-To: <4A393E82.90900@qnx.com>
On Wednesday 17 June 2009 20:05:38, Aleksandar Ristovski wrote:
> Pedro Alves wrote:
> > Thanks. This is still not complete, though.
> >
> > You need to make sure that the "multi_process" flag stays turned off
> > if the backend doesn't support MP, otherwise, things like
>
> Ok, then something like this?
> - strcat (own_buf, ";multiprocess+");
> + if (target_supports_multiprocess ())
> + strcat (own_buf, ";multiprocess+");
> + else
> + /* Override GDB's ability to support multiprocess. */
> + multi_process = 0;
Indentation is off here. I'd prefer if we didn't turn the
flag on at all in the first place. Checked in as below. Thanks.
--
Pedro Alves
* 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/linux-low.c | 7 +++++++
gdb/gdbserver/server.c | 11 ++++++++---
gdb/gdbserver/target.h | 7 +++++++
3 files changed, 22 insertions(+), 3 deletions(-)
Index: src/gdb/gdbserver/target.h
===================================================================
--- src.orig/gdb/gdbserver/target.h 2009-06-19 14:26:36.000000000 +0100
+++ src/gdb/gdbserver/target.h 2009-06-19 14:34:09.000000000 +0100
@@ -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);
Index: src/gdb/gdbserver/server.c
===================================================================
--- src.orig/gdb/gdbserver/server.c 2009-06-19 14:26:36.000000000 +0100
+++ src/gdb/gdbserver/server.c 2009-06-19 14:34:09.000000000 +0100
@@ -1074,9 +1074,13 @@ handle_query (char *own_buf, int packet_
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_
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: src/gdb/gdbserver/linux-low.c
===================================================================
--- src.orig/gdb/gdbserver/linux-low.c 2009-06-19 14:26:36.000000000 +0100
+++ src/gdb/gdbserver/linux-low.c 2009-06-19 14:34:09.000000000 +0100
@@ -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_op
linux_supports_non_stop,
linux_async,
linux_start_non_stop,
+ linux_supports_multi_process
};
static void
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.
---
gdb/gdbserver/linux-low.c | 7 +++++++
gdb/gdbserver/server.c | 11 ++++++++---
gdb/gdbserver/target.h | 7 +++++++
3 files changed, 22 insertions(+), 3 deletions(-)
Index: src/gdb/gdbserver/target.h
===================================================================
--- src.orig/gdb/gdbserver/target.h 2009-06-19 14:26:36.000000000 +0100
+++ src/gdb/gdbserver/target.h 2009-06-19 14:34:09.000000000 +0100
@@ -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);
Index: src/gdb/gdbserver/server.c
===================================================================
--- src.orig/gdb/gdbserver/server.c 2009-06-19 14:26:36.000000000 +0100
+++ src/gdb/gdbserver/server.c 2009-06-19 14:34:09.000000000 +0100
@@ -1074,9 +1074,13 @@ handle_query (char *own_buf, int packet_
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_
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: src/gdb/gdbserver/linux-low.c
===================================================================
--- src.orig/gdb/gdbserver/linux-low.c 2009-06-19 14:26:36.000000000 +0100
+++ src/gdb/gdbserver/linux-low.c 2009-06-19 14:34:09.000000000 +0100
@@ -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_op
linux_supports_non_stop,
linux_async,
linux_start_non_stop,
+ linux_supports_multi_process
};
static void
prev parent reply other threads:[~2009-06-19 13:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-16 20:10 Aleksandar Ristovski
2009-06-16 21:09 ` Pedro Alves
2009-06-17 0:56 ` Aleksandar Ristovski
2009-06-17 1:04 ` Pedro Alves
2009-06-17 1:17 ` Aleksandar Ristovski
2009-06-17 17:19 ` Aleksandar Ristovski
2009-06-17 18:04 ` Pedro Alves
2009-06-17 19:06 ` Aleksandar Ristovski
2009-06-19 13:41 ` Pedro Alves [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200906191442.16707.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=aristovski@qnx.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox