From patchwork Mon Dec 12 20:30:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 61831 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8018B3864A02 for ; Mon, 12 Dec 2022 20:32:44 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by sourceware.org (Postfix) with ESMTPS id E0BBF384D3EC for ; Mon, 12 Dec 2022 20:31:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E0BBF384D3EC Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f49.google.com with SMTP id h16so4490527wrz.12 for ; Mon, 12 Dec 2022 12:31:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NCl5SuJ6M0OdQ0mnCN7bP7wb/GguN+7mcZayHYLvvaY=; b=iJMsy+XbSu1aO1hAk91OiyuRrTwKKsI0EeubDEZqmQWeaSYIyjBKWASIyu78aFKvOd elBlC3C0C30GFEsxYK0VrQn7exaIwkMRvd4oMDqDgnGve6gb3kRKh3TG3i4iPLtpwSPW qdwWD9uNvW+IiAbChFecXSaBmtixZ8sdFcqaCx4cLsmdHYcr/kfqLTpXXr5Z+pMWd7H0 AFMg7/qs+L2C0WA+0gNHx8sro+vyT5JZDY9yVUL7/VFoqyLiC/7Qv1tgmBUfbyIZmlF+ yU005qcW0cxb3qjArTgX3mtBJA3B+t3yUYE/qn4aPDTXisAvW+qDQqlgKqjAzbfhBtiY 3n/A== X-Gm-Message-State: ANoB5plcYdKEP5VDlWoLdKPF1ORis4Rtup0e6z8kWo6VBBM3Plt4GS/d qAouWz1WCSCe7aWm51f7d189FN3w7Y+VWA== X-Google-Smtp-Source: AA0mqf6VUMineUzIhcDwYIGR2NYFZqpflLhnjjfoN1BihJPTs4IpDfCe5CR4oJSiuqYoaiugOeLEFg== X-Received: by 2002:a5d:54c8:0:b0:242:19b1:bfae with SMTP id x8-20020a5d54c8000000b0024219b1bfaemr13245226wrv.53.1670877076826; Mon, 12 Dec 2022 12:31:16 -0800 (PST) Received: from localhost ([2001:8a0:f912:6700:afd9:8b6d:223f:6170]) by smtp.gmail.com with ESMTPSA id bj5-20020a0560001e0500b002362f6fcaf5sm10125202wrb.48.2022.12.12.12.31.16 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Dec 2022 12:31:16 -0800 (PST) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 14/31] all-stop/synchronous RSP support thread-exit events Date: Mon, 12 Dec 2022 20:30:44 +0000 Message-Id: <20221212203101.1034916-15-pedro@palves.net> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20221212203101.1034916-1-pedro@palves.net> References: <20221212203101.1034916-1-pedro@palves.net> MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Currently, GDB does not understand the THREAD_EXITED stop reply in remote all-stop mode. There's no good reason for this, it just happened that THREAD_EXITED was only ever reported in non-stop mode so far. This patch teaches GDB to parse that event in all-stop RSP too. There is no need to add a qSupported feature for this, because the server won't send a THREAD_EXITED event unless GDB explicitly asks for it, with QThreadEvents, or with the GDB_THREAD_OPTION_EXIT QThreadOptions option added in the next patch. Change-Id: Ide5d12391adf432779fe4c79526801c4a5630966 --- gdb/remote.c | 5 +++-- gdbserver/server.cc | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index 9de8ed8a068..f7ab8523fd5 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8172,7 +8172,8 @@ remote_target::process_stop_reply (struct stop_reply *stop_reply, && status->kind () != TARGET_WAITKIND_NO_RESUMED) { /* Expedited registers. */ - if (!stop_reply->regcache.empty ()) + if (status->kind () != TARGET_WAITKIND_THREAD_EXITED + && !stop_reply->regcache.empty ()) { struct regcache *regcache = get_thread_arch_regcache (this, ptid, stop_reply->arch); @@ -8358,7 +8359,7 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status, again. Keep waiting for events. */ rs->waiting_for_stop_reply = 1; break; - case 'N': case 'T': case 'S': case 'X': case 'W': + case 'N': case 'T': case 'S': case 'X': case 'W': case 'w': { /* There is a stop reply to handle. */ rs->waiting_for_stop_reply = 0; diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 07a3319d114..5099db1ee31 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -3061,6 +3061,7 @@ resume (struct thread_resume *actions, size_t num_actions) if (cs.last_status.kind () != TARGET_WAITKIND_EXITED && cs.last_status.kind () != TARGET_WAITKIND_SIGNALLED + && cs.last_status.kind () != TARGET_WAITKIND_THREAD_EXITED && cs.last_status.kind () != TARGET_WAITKIND_NO_RESUMED) current_thread->last_status = cs.last_status;