From patchwork Fri Feb 23 21:11:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 56726 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 60444385828A for ; Fri, 23 Feb 2024 21:12:19 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by sourceware.org (Postfix) with ESMTPS id 0A1D9385841A for ; Fri, 23 Feb 2024 21:11:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A1D9385841A Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0A1D9385841A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d2b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708722701; cv=none; b=Zp8LOPan7+cHeKDUB7F7v1pnNdxWNI7pKcI8dXZSejaF53VBSCSQFLsxkDoQOw+MWwv4BmRR5+uwSV14XCI+DB8lIdM63pngNB8081nHp5jRkoX+HkHsWgaxgaL4ozAna5o1w+4Q8kPb56GhteE96HyUc+LHFK0AtHAzbbXtxng= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708722701; c=relaxed/simple; bh=OlX/GWaJv5D5mL+37jcvokyfPFHAXX+Kyel2fI1Ey60=; h=DKIM-Signature:From:Subject:Date:Message-Id:MIME-Version:To; b=DUu84R/wJvXxQmnEdSuK6amlwVhh7x37TZIuQ8NNuhnXiNmac0pdyt2+9MCmNBDlQ7fwPBYM8pkfWGHL0JFvn1Q1wXaCUz9E5r4iTiykydkcwn5OjTnnLg4FYmGjRZ+hoxlwOCw8oi/vinoVFoTvQ9CXyZH2+81JE7p4ZwRzs6A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-7c7847e2e05so27263339f.1 for ; Fri, 23 Feb 2024 13:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1708722698; x=1709327498; darn=sourceware.org; h=to:content-transfer-encoding:mime-version:message-id:date:subject :from:from:to:cc:subject:date:message-id:reply-to; bh=sXkkQV4NoGDA16JvsyshlBz/cUnLlA/YNLV0VlfU1us=; b=HS7XT4tb3B/bKNa3zYXf5NUvPx/ZrUXFiyWyjK02ZdO/cxO/lWo0LXj50lQRxXPSCE xAQ3Au1rfUBElZ/+ib4ODB+p5Hw7OLiBLR0O9w6MDy5pnma8YO69D5PC/PnVAVy972qZ sSEkUBQPjNTdbpRCKTfDfTDI0zo98a6urraLMgvdzohlQO8/2+GRBDfJNKFVWZCHoZG3 088A4LwYa/jFBJ2x2VBaic1PtqgAfHka8tLumyeDVuIIx4DtBvWceqoS9C9LXjKrf0wv oyXlJ6uu7KJSyv36bogTbjYroBquZQs4uqj6upnAHW+SX4DaW5sdVhVHRnXRLUeIi2nN RMFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708722698; x=1709327498; h=to:content-transfer-encoding:mime-version:message-id:date:subject :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sXkkQV4NoGDA16JvsyshlBz/cUnLlA/YNLV0VlfU1us=; b=a/n2V2uTsLEw9qv7CUbn+bQpwauWG+AM49kgVriXeZm6gZ9FIGCYKEYsXazDb63rol R5j085sl6NyFYoE8VUFDFSN3hIY8pU1jriY2rkBDP8gHFfpH4hvaHNzMg/9ygR9FA9Mw QnlGJWby6/GvJqxWN8c9eXpZ4ghdoNI6m6g+bQYlD9Fs8KkOKzKgwCH2lxGxirE+nhC8 t4H20x5BE0YZOGlqEnjEu7otSYosPJYbXPVXC3AiELxWCdVRDp7M3yGLPcz0Rg9S1xWH Mm+rOBd63o0Z/u8PUkInVr6iO9Y0besuNqunWZaiA/gX0QF4prvmiuFRp6Uvej5PUGZR lNBQ== X-Gm-Message-State: AOJu0YzNx6ApjM5AQsbWPinqkslJOOIaGFirDeFK4gPhvL7srGTfxWcR +4iInF40aKNI4arN+swPnp4d87OSlzZ6LUmycsUOoks/fVemb/ZdMZMX8reE85j4Gq1P5c5HBys = X-Google-Smtp-Source: AGHT+IFdg2JL2+oR1LfOfC/zLEzEICXTpJDh5JyOrvbPoLddyrbwG9LA2WacuRllcerMXsdE6T3SGg== X-Received: by 2002:a05:6602:340b:b0:7c7:96a3:554c with SMTP id n11-20020a056602340b00b007c796a3554cmr1606334ioz.10.1708722698238; Fri, 23 Feb 2024 13:11:38 -0800 (PST) Received: from localhost.localdomain (71-211-170-195.hlrn.qwest.net. [71.211.170.195]) by smtp.gmail.com with ESMTPSA id y14-20020a02c00e000000b004741aec6cdasm3497851jai.25.2024.02.23.13.11.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 13:11:37 -0800 (PST) From: Tom Tromey Subject: [PATCH 0/5] Restore DAP 'quit' request Date: Fri, 23 Feb 2024 14:11:36 -0700 Message-Id: <20240223-final-cleanups-v1-0-84d5271e9979@adacore.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAAgK2WUC/x3MQQrCQAxA0auUrA2MY0fRq4iLNGZsoMaSqAild 3d0+Rb/LxDiKgGnbgGXt4Y+rGG76YBHspugXpshp9ynnHdY1WhCnoTsNQceCh+l7PtUC0OLZpe qn//wfGkeKAQHJ+Pxt7lTPMVhXb+wBhM4eQAAAA== To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, 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.30 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 This series started as an attempt to make DAP cause gdb to exit after a terminate request is handled. However, as noted in earlier discussion, this can sometimes cause crashes. This series fixes the problem by rewriting final cleanups and then explicitly shutting down Python after these have been run. A new final cleanup for runnables is added -- this is needed because the request to quit may actually race with other reasons to quit (IIUC). Regression tested on x86-64 Fedora 38. --- Tom Tromey (5): Rewrite final cleanups Add extension_language_ops::shutdown Change finalize_values into a final cleanup Add final cleanup for runnables Explicitly quit gdb from DAP server thread gdb/compile/compile.c | 30 ++++------ gdb/debuginfod-support.c | 14 ++--- gdb/extension-priv.h | 4 ++ gdb/extension.c | 12 ++++ gdb/extension.h | 3 + gdb/guile/guile.c | 1 + gdb/python/lib/gdb/dap/server.py | 1 + gdb/python/python.c | 6 +- gdb/run-on-main-thread.c | 11 ++++ gdb/testsuite/lib/dap-support.exp | 9 +++ gdb/top.c | 8 +-- gdb/value.c | 15 ++--- gdb/value.h | 4 -- gdbsupport/cleanups.cc | 122 ++++---------------------------------- gdbsupport/cleanups.h | 17 ++---- 15 files changed, 85 insertions(+), 172 deletions(-) --- base-commit: bf8ab2ae8d33e46bb6612408c75e75a6de137ccc change-id: 20240223-final-cleanups-75c9e5640f5c Best regards,