From patchwork Wed Feb 22 23:46:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Buettner X-Patchwork-Id: 55513 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 5C902385800A for ; Wed, 22 Feb 2023 23:46:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C902385800A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677109619; bh=J1XiUl09iOSn3tODGhiT0D/8vzLFr3D/fQVxHXab7mg=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=URqFrRa/cK1+FUmTmZgYLkG3zHetjx1x09/WnvyO9b0D5tXMlZLPgQLLoWebexVuJ XrcPQQzTOGY7ohnwUV/BEmGp0Juvjr5C5ewY0Mnf95TTUtrRVR6/WG7gxcPpc7NqL4 pIR2Cgm7629x7EVGoIyx0micTRGZwB2nA9VBzEsQ= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 880B33858D33 for ; Wed, 22 Feb 2023 23:46:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 880B33858D33 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-441-4JD2et1WPveBe5zZWDiJBA-1; Wed, 22 Feb 2023 18:46:31 -0500 X-MC-Unique: 4JD2et1WPveBe5zZWDiJBA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 69FD73806713; Wed, 22 Feb 2023 23:46:31 +0000 (UTC) Received: from f34-1.lan (unknown [10.2.16.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC862440D9; Wed, 22 Feb 2023 23:46:30 +0000 (UTC) To: gdb-patches@sourceware.org Cc: pedro@palves.net, Kevin Buettner Subject: [PATCH v5 0/8] Fix gdb.base/gdb-sigterm.exp failure/error Date: Wed, 22 Feb 2023 16:46:05 -0700 Message-Id: <20230222234613.29662-1-kevinb@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: , X-Patchwork-Original-From: Kevin Buettner via Gdb-patches From: Kevin Buettner Reply-To: Kevin Buettner Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This series fixes the failure in gdb.base/gdb-sigterm.exp when running in environments with glibc-2.34 or later. It contains only a few changes from the v4 series posted in January: https://sourceware.org/pipermail/gdb-patches/2023-January/195579.html This series drops part 6 from v4, "Call quit_force for gdb_exception_forced_quit in safe_execute_command", in favor of Pedros's already committed/pushed "Simplify interp::exec / interp_exec - let exceptions propagate". In his review of the v4 series, Pedro asked for a new function, set_force_quit_flag() which sets sync_quit_force_run and also calls set_quit_flag(). This is done in v5's part 7, "Introduce set_force_quit_flag and change type of sync_quit_force_run". This series also makes several other minor changes that Pedro had asked for. I've added Tested-by tags for Tom de Vries for all parts except for the new part 7 mentioned above. Pedro has approved parts 1, 2, and 3; I added Approved-by lines referencing Pedro to those parts. Pedro gave a sort of half-hearted approval for part 4, "Python QUIT processing updates". I haven't marked this commit with an Approved-by line yet. I would, however, like to commit this one as is. I think that implementing Pedro's suggestion of throwing a Python exception corresponding to the forced-quit and then calling set_force_quit_flag() when returning out of the Python interpreter is doable, but probably also somewhat tricky/involved. Rather than going a few more rounds on this series in an attempt to get those details correct, I'd prefer to push the Python and Guile portions of the current series and then work on a separate series implementing Pedro's suggestion. The Python and Guile portions of this series will cause GDB to exit on receipt of a SIGTERM, but might not be safe for future GDB in which Python (or Guile) might be called from GDB from very low level code in which certain data structures are not in sync. If this should happen, we might run into other problems anyway if those low-level invocations of Python from GDB want be able to call arbitrary methods in GDB's Python API. (We would need to make sure that all of GDB's Python API is safe to use with out-of-sync data structures. I think it's possible that some case might trigger the same assert which prompted this series.) Kevin Buettner (8): Introduce gdb_exception_forced_quit Handle gdb SIGTERM by throwing / catching gdb_exception_force_quit Catch gdb_exception_error instead of gdb_exception (in many places) Python QUIT processing updates Guile QUIT processing updates QUIT processing w/ explicit throw for gdb_exception_forced_quit Introduce set_force_quit_flag and change type of sync_quit_force_run Forced quit cases handled by resetting sync_quit_force_run gdb/ada-lang.c | 2 +- gdb/breakpoint.c | 8 ++++---- gdb/defs.h | 5 ++++- gdb/event-top.c | 15 ++++++++++++--- gdb/guile/guile-internal.h | 5 +++++ gdb/guile/scm-pretty-print.c | 5 +++++ gdb/guile/scm-type.c | 5 +++++ gdb/guile/scm-value.c | 5 +++++ gdb/i386-linux-tdep.c | 2 +- gdb/inf-loop.c | 2 +- gdb/infcmd.c | 2 +- gdb/infrun.c | 2 +- gdb/jit.c | 2 +- gdb/linux-fork.c | 12 ++++++++++++ gdb/main.c | 12 ++++++++++++ gdb/mi/mi-cmd-break.c | 2 +- gdb/mi/mi-interp.c | 2 +- gdb/mi/mi-main.c | 4 ++++ gdb/objc-lang.c | 2 +- gdb/parse.c | 2 +- gdb/printcmd.c | 2 +- gdb/python/py-finishbreakpoint.c | 5 +++++ gdb/python/py-gdb-readline.c | 4 ++++ gdb/python/py-symbol.c | 5 +++++ gdb/python/py-utils.c | 3 +++ gdb/python/py-value.c | 5 +++++ gdb/record-btrace.c | 2 +- gdb/record-full.c | 2 +- gdb/remote-fileio.c | 13 +++++++++---- gdb/solib.c | 2 +- gdb/sparc64-linux-tdep.c | 2 +- gdb/symfile-mem.c | 2 +- gdb/top.h | 2 +- gdb/tui/tui-io.c | 8 ++++++++ gdb/tui/tui.c | 7 +++++++ gdb/utils.c | 4 ++-- gdbsupport/common-exceptions.cc | 14 ++++++++++++++ gdbsupport/common-exceptions.h | 22 +++++++++++++++++++++- 38 files changed, 168 insertions(+), 32 deletions(-)