From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by sourceware.org (Postfix) with ESMTPS id 224373892853 for ; Wed, 13 Jul 2022 22:25:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 224373892853 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-f45.google.com with SMTP id r14so52478wrg.1 for ; Wed, 13 Jul 2022 15:25:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eNNv49AHzq+obK/yPLL9ZNotnL2kTaiHoF5QjaYEQK4=; b=LRGU/3zpBBSDjdrfo0W243+QI4UT643QTK4G0ZVDZ4KC7wmXfycl31YpyEgOmOfW4i 8oo11tzGPNyB7MQBIkzL+FFXuieGy9SPVWUP5WqI1+0qaO6DhtBNRsOy8V56TN43O3nA PM1ehkeLFXplfbvAFsS0bwLvmxzaNUWqs3iCp+xgRWcj2k+Ahjb43uiBA0vCfIOgxGGh du3uMsBzJ5QjNVZrVliEOUtkWz9WXpcLZzYVvEE8Dr1sxiM7rBSS3l0PolEB0jwCjaEk Fsw4qvUC2m4bmpa8bSJpWEUnQWcWExIqmtFVVEg8LB/vkwdXvwGoNoxW2aSmrvkybVvh /M7w== X-Gm-Message-State: AJIora8d/XkAaOn8mAoM3/3dGGankEj+WFfVB3X41EVJsRQkcfgBoyud mpvz/DGluszt9U1F+WFFFNi/kLUfVJw= X-Google-Smtp-Source: AGRyM1uRRJLoGz6GZ2ZMcWs769mIM3XGPa6rAlUqr0LtGkqyZoWL2AJhEIhYjSCMlTM2OF8LcS8A7w== X-Received: by 2002:a5d:4a09:0:b0:21d:a9ad:3b1b with SMTP id m9-20020a5d4a09000000b0021da9ad3b1bmr5024397wrq.3.1657751104428; Wed, 13 Jul 2022 15:25:04 -0700 (PDT) Received: from localhost ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id j5-20020adfea45000000b0021d6a23fdf3sm11889625wrn.15.2022.07.13.15.25.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Jul 2022 15:25:03 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 13/29] all-stop/synchronous RSP support thread-exit events Date: Wed, 13 Jul 2022 23:24:17 +0100 Message-Id: <20220713222433.374898-14-pedro@palves.net> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220713222433.374898-1-pedro@palves.net> References: <20220713222433.374898-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 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, T_SCC_BODY_TEXT_LINE 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: , X-List-Received-Date: Wed, 13 Jul 2022 22:25:07 -0000 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_TO_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 18c31c3e811..090ea47aa38 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8187,7 +8187,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); @@ -8373,7 +8374,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 3526e1d000e..75a23e2c692 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -3060,6 +3060,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; -- 2.36.0