From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id D1C64385800F for ; Wed, 24 Nov 2021 20:04:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D1C64385800F X-ASG-Debug-ID: 1637784285-0c856e2e462ae780001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id 2jKgWGHuGQWMAJUJ (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Nov 2021 15:04:45 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from smarchi-efficios.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by smtp.ebox.ca (Postfix) with ESMTP id 8CBC7441B21; Wed, 24 Nov 2021 15:04:45 -0500 (EST) From: Simon Marchi X-Barracuda-RBL-IP: 192.222.180.24 X-Barracuda-Effective-Source-IP: 192-222-180-24.qc.cable.ebox.net[192.222.180.24] X-Barracuda-Apparent-Source-IP: 192.222.180.24 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 0/3] Fix handling of pending fork events Date: Wed, 24 Nov 2021 15:04:41 -0500 X-ASG-Orig-Subj: [PATCH 0/3] Fix handling of pending fork events Message-Id: <20211124200444.614978-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211029203332.69894-1-simon.marchi@polymtl.ca> References: <20211029203332.69894-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1637784285 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 1778 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.94175 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP 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: Wed, 24 Nov 2021 20:04:58 -0000 This is v2 of: https://sourceware.org/pipermail/gdb-patches/2021-October/182922.html Patch 2/3 is new, it factors out some code in the function, to keep the following patch simple. Changes in patch 3/3 (patch 2/2 in v1) are: - The test did fail on some machines (not my development machine apparently). It is because I only handled pending statuses in lwp_info::status, in the linux-nat target. There may also be some pending statuses in lwp_info::waitstatus, handle them too. - Rather than adding a target method to allow the core to detach pending fork children, make the targets (linux-nat and remote) peek in thread_info::pending_waitstatus to see if there is one there. Simon Marchi (3): gdbserver: hide fork child threads from GDB gdb/linux-nat: factor ptrace-detach code to new detach_one_pid function gdb, gdbserver: detach fork child when detaching from fork parent gdb/linux-nat.c | 124 ++++++++++----- gdb/remote.c | 14 ++ .../pending-fork-event-touch-file.c | 26 +++ .../gdb.threads/pending-fork-event.c | 82 ++++++++++ .../gdb.threads/pending-fork-event.exp | 150 ++++++++++++++++++ gdbserver/gdbthread.h | 9 ++ gdbserver/linux-low.cc | 36 +++-- gdbserver/linux-low.h | 6 - gdbserver/server.cc | 35 ++++ 9 files changed, 422 insertions(+), 60 deletions(-) create mode 100644 gdb/testsuite/gdb.threads/pending-fork-event-touch-file.c create mode 100644 gdb/testsuite/gdb.threads/pending-fork-event.c create mode 100644 gdb/testsuite/gdb.threads/pending-fork-event.exp -- 2.26.2