From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26976 invoked by alias); 17 Jun 2009 19:06:44 -0000 Received: (qmail 26965 invoked by uid 22791); 17 Jun 2009 19:06:43 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from qnxmail.qnx.com (HELO qnxmail.qnx.com) (209.226.137.76) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Jun 2009 19:06:37 +0000 Received: from Nebula.ott.qnx.com (nebula.ott.qnx.com [10.42.3.30]) by hub.ott.qnx.com (8.9.3/8.9.3) with ESMTP id PAA08356; Wed, 17 Jun 2009 15:06:30 -0400 Received: from [127.0.0.1] ([10.42.100.129]) by Nebula.ott.qnx.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 17 Jun 2009 15:06:35 -0400 Message-ID: <4A393E82.90900@qnx.com> Date: Wed, 17 Jun 2009 19:06:00 -0000 From: Aleksandar Ristovski User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches@sourceware.org Subject: Re: [patch] gdbserver: qXfer multiprocess References: <200906170204.45325.pedro@codesourcery.com> <4A39258E.2000506@qnx.com> <200906171905.13381.pedro@codesourcery.com> In-Reply-To: <200906171905.13381.pedro@codesourcery.com> Content-Type: multipart/mixed; boundary="------------050008040402050909070307" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00445.txt.bz2 This is a multi-part message in MIME format. --------------050008040402050909070307 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1359 Pedro Alves wrote: > On Wednesday 17 June 2009 18:19:10, Aleksandar Ristovski wrote: > >> Here is a patch that does what you described. > > 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 > remote-utils.c:write_ptid will still misbehave (gdb will realize the > target doesn't support multi-process, but the remote target will > be replying with multi-process packets, how odd would that be?!). > That flag is currently bound to GDB's multi-process support, > because current gdbserver is assuming all backends support mp. > > /* Record if GDB knows about multiprocess support. */ > if (strcmp (p, "multiprocess+") == 0) > multi_process = 1; > > > To see this in action, you can connect with > "target extended-remote :foo"/"set debug remote 1", and make sure that > the packets flowing in both directions don't use multi-process thread > id extensions (e.g., 'p1.1' vs '1'). > Ok, then something like this? -- Aleksandar Ristovski QNX Software Systems * target.h (supports_multiprocess): New function. * server.c (handle_query): Use supports_multiprocess and output multiprocess accordingly. * linux-low.c (linux_supports_multiprocess): New function. (linux_target_ops): Set supports_multiprocess. --------------050008040402050909070307 Content-Type: text/x-patch; name="gdbserver-supports_multiprocess-20090617-1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdbserver-supports_multiprocess-20090617-1.diff" Content-length: 2340 Index: target.h =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/target.h,v retrieving revision 1.36 diff -u -p -r1.36 target.h --- target.h 1 Apr 2009 22:50:24 -0000 1.36 +++ target.h 17 Jun 2009 18:57:30 -0000 @@ -275,6 +283,8 @@ struct target_ops /* Switch to non-stop (1) or all-stop (0) mode. Return 0 on success, -1 otherwise. */ int (*start_non_stop) (int); + + int (*supports_multiprocess) (void); }; extern struct target_ops *the_target; @@ -311,6 +321,10 @@ void set_target_ops (struct target_ops * #define target_async(enable) \ (the_target->async ? (*the_target->async) (enable) : 0) +#define target_supports_multiprocess() \ + (the_target->supports_multiprocess ? \ + (*the_target->supports_multiprocess) () : 0) + /* Start non-stop mode, returns 0 on success, -1 on failure. */ int start_non_stop (int nonstop); Index: server.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/server.c,v retrieving revision 1.97 diff -u -p -r1.97 server.c --- server.c 24 May 2009 21:06:53 -0000 1.97 +++ server.c 17 Jun 2009 18:57:30 -0000 @@ -1106,7 +1106,11 @@ 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_multiprocess ()) + strcat (own_buf, ";multiprocess+"); + else + /* Override GDB's ability to support multiprocess. */ + multi_process = 0; if (target_supports_non_stop ()) strcat (own_buf, ";QNonStop+"); Index: linux-low.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v retrieving revision 1.105 diff -u -p -r1.105 linux-low.c --- linux-low.c 24 May 2009 17:44:19 -0000 1.105 +++ linux-low.c 17 Jun 2009 18:57:30 -0000 @@ -3008,6 +3008,12 @@ linux_start_non_stop (int nonstop) return 0; } +static int +linux_supports_multiprocess (void) +{ + return 1; +} + static struct target_ops linux_target_ops = { linux_create_inferior, linux_attach, @@ -3045,6 +3053,7 @@ static struct target_ops linux_target_op linux_supports_non_stop, linux_async, linux_start_non_stop, + linux_supports_multiprocess }; static void --------------050008040402050909070307--