From patchwork Thu Mar 17 22:02:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 11367 Received: (qmail 96276 invoked by alias); 17 Mar 2016 22:03:06 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 95875 invoked by uid 89); 17 Mar 2016 22:03:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=Tell, detach, NEWS, news X-HELO: mail-wm0-f45.google.com Received: from mail-wm0-f45.google.com (HELO mail-wm0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 17 Mar 2016 22:02:55 +0000 Received: by mail-wm0-f45.google.com with SMTP id l124so10822847wmf.1 for ; Thu, 17 Mar 2016 15:02:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=x+KiTWegqWcmGimHUwFAmPO9ZzdSZT1iOO9ixWtfCC0=; b=QdRyJZ9/Z3+qs1uH66ZTNH6hPMwRig1e7HJnV7YuX6puQyjULcc5bCcPF1HK9r2sip IE/cxgEY4zD4EbJ5RO3loPSB05OohjFAkPVJmllJP+MvCZPuCZSWz6gkX605yDobwnr/ UDCF9EXHl0LtFxzcfWZcoZTUND8LCRX/Z6e/PugCOwL653Zxmg/AIIO2WffohGK7bBwY qykKJAqOvRr59dChwU7buK6PygIg7qfxrzEqsWOObMoEbK0UEqoVjrJB6YgIsnit9xKQ MFWsdvO/8yngaClCrSJ9tQB08Dej0NnmRh/eJNJd2teFn7xcUX0EpbflJiXeZ2fEFMyS KC9A== X-Gm-Message-State: AD7BkJI0emhvU7z7SvxO8TbxYbOIAm4NGkYe7NAiEigM9LskWw9XUpjS7o6yiAkePGGPQA== X-Received: by 10.194.23.37 with SMTP id j5mr11950838wjf.171.1458252172570; Thu, 17 Mar 2016 15:02:52 -0700 (PDT) Received: from localhost ([46.189.28.198]) by smtp.gmail.com with ESMTPSA id y62sm9959101wmg.12.2016.03.17.15.02.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Mar 2016 15:02:51 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb/remote: Don't use vKill if multi-process features are disabled Date: Thu, 17 Mar 2016 22:02:24 +0000 Message-Id: <1458252144-3496-1-git-send-email-andrew.burgess@embecosm.com> X-IsSubscribed: yes The below was tested using native gdbserver on x86-64 Fedora Linux with no regressions. --- The gdb remote protocol documentation is clear that the vKill command should not be used unless the multi-process feature is reported as supported by the remote target. Currently within gdb we check to see if the vKill packet is enabled or not before using the vKill command, however, the only way to disable vKill is from the gdb console, the result is that vKill will be sent to targets that don't support it, and never claimed to support it. After this commit I guard use of vKill with a check to see if the multi-process feature is enabled or not. I have removed the ability to disable vkill specifically from the console, the user must now disable the whole multi-process feature set as one. I did consider leaving the separate vKill control switch in addition to the multi-process control switch, but this seemed unnecessary, and I worried that in the future another bug could be introduced where PACKET_vKill was used to guard sending a vKill. Removed: set remote kill-packet (auto|on|off) show remote kill-packet Instead Use: set remote multiprocess-feature-packet (auto|on|off) show set remote multiprocess-feature-packet gdb/ChangeLog: * remote.c (PACKET enum): Remove PACKET_vKill. (remote_kill): Use remote_multi_process_p. (remote_vKill): Use PACKET_multiprocess_feature. (_initialize_remote): Remove vKill configuration. * NEWS: Mention removed commands. --- gdb/ChangeLog | 8 ++++++++ gdb/NEWS | 9 +++++++++ gdb/remote.c | 10 +++------- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2df6ccd..db2768c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2016-03-17 Andrew Burgess + + * remote.c (PACKET enum): Remove PACKET_vKill. + (remote_kill): Use remote_multi_process_p. + (remote_vKill): Use PACKET_multiprocess_feature. + (_initialize_remote): Remove vKill configuration. + * NEWS: Mention removed commands. + 2016-03-17 Jan Kratochvil * linux-thread-db.c (check_pid_namespace_match): Extend the message. diff --git a/gdb/NEWS b/gdb/NEWS index 34c5a8d..be10da6 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -24,6 +24,15 @@ Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3] 0x0000000000400d7c in upper () at i386-mpx-sigsegv.c:68 +* The following commands which disabled use of the remote vKill packet + has been removed: + set remote kill-packet (auto|on|off) + show remote kill-packet + Instead, vKill is part of a larged feature set which can be enabled + or disabled as one using: + set remote multiprocess-feature-packet (auto|on|off) + show set remote multiprocess-feature-packet + * New commands skip -file file diff --git a/gdb/remote.c b/gdb/remote.c index af0a08a..87c1078 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1398,7 +1398,6 @@ enum { PACKET_vAttach, PACKET_vRun, PACKET_QStartNoAckMode, - PACKET_vKill, PACKET_qXfer_siginfo_read, PACKET_qXfer_siginfo_write, PACKET_qAttached, @@ -8907,7 +8906,7 @@ remote_kill (struct target_ops *ops) int pid = ptid_get_pid (inferior_ptid); struct remote_state *rs = get_remote_state (); - if (packet_support (PACKET_vKill) != PACKET_DISABLE) + if (remote_multi_process_p (rs)) { /* If we're stopped while forking and we haven't followed yet, kill the child task. We need to do this before killing the @@ -8948,7 +8947,7 @@ remote_kill (struct target_ops *ops) static int remote_vkill (int pid, struct remote_state *rs) { - if (packet_support (PACKET_vKill) == PACKET_DISABLE) + if (!remote_multi_process_p (rs)) return -1; /* Tell the remote target to detach. */ @@ -8957,7 +8956,7 @@ remote_vkill (int pid, struct remote_state *rs) getpkt (&rs->buf, &rs->buf_size, 0); switch (packet_ok (rs->buf, - &remote_protocol_packets[PACKET_vKill])) + &remote_protocol_packets[PACKET_multiprocess_feature])) { case PACKET_OK: return 0; @@ -13756,9 +13755,6 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL, add_packet_config_cmd (&remote_protocol_packets[PACKET_QStartNoAckMode], "QStartNoAckMode", "noack", 0); - add_packet_config_cmd (&remote_protocol_packets[PACKET_vKill], - "vKill", "kill", 0); - add_packet_config_cmd (&remote_protocol_packets[PACKET_qAttached], "qAttached", "query-attached", 0);