From patchwork Fri Jan 20 18:13:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 6325 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 36CE923F8D for ; Fri, 20 Jan 2012 18:13:45 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 208F7A18167 for ; Fri, 20 Jan 2012 18:13:45 +0000 (UTC) Received: by bkar19 with SMTP id r19so767252bka.11 for ; Fri, 20 Jan 2012 10:13:44 -0800 (PST) Received: by 10.205.141.72 with SMTP id jd8mr7657396bkc.135.1327083223100; Fri, 20 Jan 2012 10:13:43 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs13049bkc; Fri, 20 Jan 2012 10:13:42 -0800 (PST) Received: by 10.14.9.193 with SMTP id 41mr3564460eet.64.1327083221700; Fri, 20 Jan 2012 10:13:41 -0800 (PST) Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com. [195.75.94.111]) by mx.google.com with ESMTPS id q48si2329030eeh.174.2012.01.20.10.13.41 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 20 Jan 2012 10:13:41 -0800 (PST) Received-SPF: pass (google.com: domain of uweigand@de.ibm.com designates 195.75.94.111 as permitted sender) client-ip=195.75.94.111; Authentication-Results: mx.google.com; spf=pass (google.com: domain of uweigand@de.ibm.com designates 195.75.94.111 as permitted sender) smtp.mail=uweigand@de.ibm.com Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 20 Jan 2012 18:13:41 -0000 Received: from d06nrmr1307.portsmouth.uk.ibm.com (9.149.38.129) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 20 Jan 2012 18:13:38 -0000 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q0KIDbJp2654272 for ; Fri, 20 Jan 2012 18:13:38 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q0KIDbcW031403 for ; Fri, 20 Jan 2012 11:13:37 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q0KIDaTr031352 for ; Fri, 20 Jan 2012 11:13:36 -0700 Message-Id: <201201201813.q0KIDaTr031352@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 20 Jan 2012 19:13:36 +0100 Subject: [rfc v4][2/6] Always enable multi-process remote extension if possible To: patches@linaro.org Date: Fri, 20 Jan 2012 19:13:36 +0100 (CET) From: "Ulrich Weigand" X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 x-cbid: 12012018-0342-0000-0000-000000AE5D72 http://sourceware.org/ml/gdb-patches/2012-01/msg00687.html From: Pedro Alves ChangeLog: * remote.c (remote_multi_process_p): Only check for multi-process protocol feature, do not check for extended protocol. (remote_supports_multi_process): Check for extended protocol here. (set_general_process): Likewise. (extended_remote_kill): Likewise. (remote_pid_to_str): Likewise. (remote_query_supported): Always query multiprocess mode. gdbserver/ChangeLog: * server.c (handle_v_requests): Only support vAttach and vRun to start multiple processes when in extended protocol mode. Index: gdb-head/gdb/gdbserver/server.c =================================================================== --- gdb-head.orig/gdb/gdbserver/server.c 2012-01-19 10:38:32.000000000 +0100 +++ gdb-head/gdb/gdbserver/server.c 2012-01-19 10:39:30.000000000 +0100 @@ -2144,7 +2144,7 @@ handle_v_requests (char *own_buf, int pa if (strncmp (own_buf, "vAttach;", 8) == 0) { - if (!multi_process && target_running ()) + if ((!extended_protocol || !multi_process) && target_running ()) { fprintf (stderr, "Already debugging a process\n"); write_enn (own_buf); @@ -2156,7 +2156,7 @@ handle_v_requests (char *own_buf, int pa if (strncmp (own_buf, "vRun;", 5) == 0) { - if (!multi_process && target_running ()) + if ((!extended_protocol || !multi_process) && target_running ()) { fprintf (stderr, "Already debugging a process\n"); write_enn (own_buf); Index: gdb-head/gdb/remote.c =================================================================== --- gdb-head.orig/gdb/remote.c 2012-01-19 10:39:29.000000000 +0100 +++ gdb-head/gdb/remote.c 2012-01-19 10:39:30.000000000 +0100 @@ -359,7 +359,7 @@ free_private_thread_info (struct private static int remote_multi_process_p (struct remote_state *rs) { - return rs->extended && rs->multi_process_aware; + return rs->multi_process_aware; } /* This data could be associated with a target, but we do not always @@ -1713,7 +1713,7 @@ set_general_process (void) struct remote_state *rs = get_remote_state (); /* If the remote can't handle multiple processes, don't bother. */ - if (!remote_multi_process_p (rs)) + if (!rs->extended || !remote_multi_process_p (rs)) return; /* We only need to change the remote current thread if it's pointing @@ -3885,8 +3885,7 @@ remote_query_supported (void) char *q = NULL; struct cleanup *old_chain = make_cleanup (free_current_contents, &q); - if (rs->extended) - q = remote_query_supported_append (q, "multiprocess+"); + q = remote_query_supported_append (q, "multiprocess+"); if (remote_support_xml) q = remote_query_supported_append (q, remote_support_xml); @@ -7440,7 +7439,7 @@ extended_remote_kill (struct target_ops struct remote_state *rs = get_remote_state (); res = remote_vkill (pid, rs); - if (res == -1 && !remote_multi_process_p (rs)) + if (res == -1 && !(rs->extended && remote_multi_process_p (rs))) { /* Don't try 'k' on a multi-process aware stub -- it has no way to specify the pid. */ @@ -8832,7 +8831,7 @@ remote_pid_to_str (struct target_ops *op { if (ptid_equal (magic_null_ptid, ptid)) xsnprintf (buf, sizeof buf, "Thread
"); - else if (remote_multi_process_p (rs)) + else if (rs->extended && remote_multi_process_p (rs)) xsnprintf (buf, sizeof buf, "Thread %d.%ld", ptid_get_pid (ptid), ptid_get_tid (ptid)); else @@ -9773,7 +9772,11 @@ remote_supports_multi_process (void) { struct remote_state *rs = get_remote_state (); - return remote_multi_process_p (rs); + /* Only extended-remote handles being attached to multiple + processes, even though plain remote can use the multi-process + thread id extensions, so that GDB knows the target process's + PID. */ + return rs->extended && remote_multi_process_p (rs); } int