From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by sourceware.org (Postfix) with ESMTPS id 560B83858D39 for ; Thu, 3 Mar 2022 14:40:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 560B83858D39 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-f41.google.com with SMTP id x15so8156012wru.13 for ; Thu, 03 Mar 2022 06:40:24 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=Cxt33Lb3ImKG41CBomFltOv2Kl5712cstY1Rh/tB3c8=; b=b+ZGkhflOnaE8zczHcKyWwcaY7fFKzBgt1M+iZuDbfkIAL7s2/ZmKqNNR6nlNJUzxH DYXpd73MCdvyj8PyjO4Pq0gP1lUn60WhRiMG/vZmTsOB2M1hDpj25M5NXBuOIA65MKQN GBKbdhvgxhFlv94VbELP0OnuK+ZQPIewYALGQY1pHzSXQrLbBk9BeUbnDhXpe/8qSeas IGHE+wJ4QLqpFNYv7HtZS0qRcC7Kv1WtmPcyYDxAdwwTPaRj2QCztaiHYaVfdPN8Manh Q344FRvc6XSyGzkcgLXFh1+Z8h2qbaaepiXKSBbxVKy5JsxrXBIuxkB+nNrhUqgLq6NG iq4Q== X-Gm-Message-State: AOAM532Rd5jK8FbhWP823aNsObV00ciGYmw7B4tHS3ezGjMXXOkWanll OIV8SR2jyqAUUi6nXOYuVVSwvoX5uQA= X-Google-Smtp-Source: ABdhPJyDftpS6t3Pgaix3LDnm4bFOSYCeUB/LM2pt7NNO7k4CgQjiZC5VhgNEpt3kGKYrwUaIZlwsw== X-Received: by 2002:adf:fa41:0:b0:1f0:2118:4832 with SMTP id y1-20020adffa41000000b001f021184832mr8729480wrr.571.1646318422603; Thu, 03 Mar 2022 06:40:22 -0800 (PST) Received: from localhost ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id e3-20020a5d65c3000000b001e4b3ba1423sm2088787wrw.60.2022.03.03.06.40.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Mar 2022 06:40:21 -0800 (PST) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 00/11] Linux: Fix issues around thread group leader exits Date: Thu, 3 Mar 2022 14:40:09 +0000 Message-Id: <20220303144020.3601082-1-pedro@palves.net> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, 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=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 03 Mar 2022 14:40:25 -0000 This series addresses some problems around thread group leader exits on GNU/Linux (native and gdbserver): - addresses a race in zombie leader detection - make sure only the leader's exit status is interpreted as whole-process exit status - make sure the whole-process exit is always the last event reported Tested on GNU/Linux x86-64, native and extended-remote gdbserver. New testcase added at the end of the series. Lancelot SIX (2): Ensure EXIT is last event, gdb/linux Process exit status is leader exit status testcase Pedro Alves (9): Fix gdbserver/linux target_waitstatus logging assert Fix gdb.threads/clone-new-thread-event.exp race Fix gdb.threads/current-lwp-dead.exp race gdb: Reorganize linux_nat_filter_event gdbserver: Reorganize linux_process_target::filter_event gdbserver: Reindent check_zombie_leaders Re-add zombie leader on exit, gdb/linux Re-add zombie leader on exit, gdbserver/linux Ensure EXIT is last event, gdbserver/linux gdb/linux-nat.c | 226 ++++++++++---- .../gdb.threads/clone-new-thread-event.c | 16 +- .../gdb.threads/clone-new-thread-event.exp | 2 + gdb/testsuite/gdb.threads/current-lwp-dead.c | 101 ++++--- .../gdb.threads/current-lwp-dead.exp | 23 +- ...rocess-exit-status-is-leader-exit-status.c | 64 ++++ ...cess-exit-status-is-leader-exit-status.exp | 45 +++ gdbserver/linux-low.cc | 281 +++++++++++------- gdbserver/linux-low.h | 15 +- 9 files changed, 563 insertions(+), 210 deletions(-) create mode 100644 gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.c create mode 100644 gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp base-commit: c2b167b3d601dd20de0640e2fbd46835599a1537 -- 2.26.2