From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26430 invoked by alias); 15 Jan 2013 09:02:03 -0000 Received: (qmail 26394 invoked by uid 22791); 15 Jan 2013 09:02:01 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,SARE_SUB_OBFU_Q1 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Jan 2013 09:01:55 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Tv2P5-00067l-8i from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Tue, 15 Jan 2013 01:01:55 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 15 Jan 2013 01:01:54 -0800 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.1.289.1; Tue, 15 Jan 2013 01:01:53 -0800 From: Yao Qi To: Subject: [PATCH,gdbserver] Put 'multiprocess+' in to qSupported reply if GDB supports multiprocess Date: Tue, 15 Jan 2013 09:02:00 -0000 Message-ID: <1358240468-11484-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain 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: 2013-01/txt/msg00297.txt.bz2 GDBserver put 'multiprocess+' in to qSupported reply regardless of whether GDB supports multiprocess. It doesn't cause any problems because if GDB doesn't support multiprocess, GDB doesn't understand 'multiprocess+'. However, I feel it is better not to send 'multiprocess+' to GDB if GDB doesn't support multiprocess. In this patch, GDBserver only sends 'multiprocess+' back to GDB if both GDB and the target of GDBserver supports multiprocess. Beside this change, this patch also add a new struct 'gdb_supports' to represent various features GDB supports. (it paves the way for my patches on querying supported notifications.) Regression tested with board file native-gdbserver, native-extended-gdbserver and unix on x86_64-linux. Is it OK to apply? gdb/gdbserver: 2013-01-15 Yao Qi * server.c (handle_query): New 'struct gdb_supports'. Update. Set 'gdb_supports.multi_process' if GDB supports multiprocess. Add 'multiprocess+' to the reply if both GDBserver target and GDB support multiprocess. --- gdb/gdbserver/server.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 4af9436..b149a1b 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -1527,7 +1527,12 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) && (own_buf[10] == ':' || own_buf[10] == '\0')) { char *p = &own_buf[10]; - int gdb_supports_qRelocInsn = 0; + /* Features that GDB support. */ + struct gdb_supports + { + int qRelocInsn; + int multi_process; + } gdb_supports = { 0, 0 }; /* Start processing qSupported packet. */ target_process_qsupported (NULL); @@ -1559,13 +1564,14 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) { /* GDB supports and wants multi-process support if possible. */ + gdb_supports.multi_process = 1; if (target_supports_multi_process ()) multi_process = 1; } else if (strcmp (p, "qRelocInsn+") == 0) { /* GDB supports relocate instruction requests. */ - gdb_supports_qRelocInsn = 1; + gdb_supports.qRelocInsn = 1; } else target_process_qsupported (p); @@ -1613,7 +1619,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+"); - if (target_supports_multi_process ()) + if (gdb_supports.multi_process + && target_supports_multi_process ()) strcat (own_buf, ";multiprocess+"); if (target_supports_non_stop ()) @@ -1630,7 +1637,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) strcat (own_buf, ";TraceStateVariables+"); strcat (own_buf, ";TracepointSource+"); strcat (own_buf, ";DisconnectedTracing+"); - if (gdb_supports_qRelocInsn && target_supports_fast_tracepoints ()) + if (gdb_supports.qRelocInsn && target_supports_fast_tracepoints ()) strcat (own_buf, ";FastTracepoints+"); strcat (own_buf, ";StaticTracepoints+"); strcat (own_buf, ";InstallInTrace+"); -- 1.7.7.6