From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WCPqOhsI3mWONi8AWB0awg (envelope-from ) for ; Tue, 27 Feb 2024 11:04:43 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=AbudnWse; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id EC1141E0D2; Tue, 27 Feb 2024 11:04:43 -0500 (EST) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C4ABC1E030 for ; Tue, 27 Feb 2024 11:04:41 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 684F13858C5F for ; Tue, 27 Feb 2024 16:04:41 +0000 (GMT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 2C0493858C41 for ; Tue, 27 Feb 2024 16:04:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C0493858C41 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2C0493858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709049860; cv=none; b=VCyXHgcMbvAdpjW4IDYsCxxEyBFBppukThmIzcvttu+TW9Nl83Qgdj1ZREr80mm7qJiZp0x3eDOMsq1dD30KM0NAlgtClEZ+KtqVviyBVmbWhtpsHGRY7aOpmXEv0wd1e8O+Fs8pA7c05x/TwEaKGjV4m4Lqn0dIcwInyw2ABsk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709049860; c=relaxed/simple; bh=s4f0NNDPWY9nBu2OF04hblRQfPAA9TNCU+IIElaPBiI=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=OvkoBpU7yt5KjkfjzqWZwjNT+VCH7J8y4zzjqzTBXF930Dlmvt85galGL1UwoIGoFBqV4yny0VZK+E/qMq6pEHFRpi8vLKHumu1C/cK8CdPA2JjxILKjo1Tv+WWXG5tBCfj+H6xEfB0uueFAoD4evTNDfS7ZKYGfjEokbRu1DKM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rezwH-0002pv-Cg; Tue, 27 Feb 2024 11:04:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GKJQnf4qu/JXZ/iRdp928SBQiF2ydi4Dmhc6E608NhY=; b=AbudnWsebubZ gkBPGCTPU3T0N1VDaJc9gTX2uk24vlAO1MDYxMhzNyS5pwiUqkTfi5SHkjaRCKqr9Zak95HryI3ZF J9jGhygvBGC0UMMch63QfcBIYB7AbjVIYXj+5iKRE0KYC4kYjyc494BoHj4Gj/aW865fg/gMLBIrj X7OHHWwnWjGrbMWDXK53XMnBKwZV/Jja9z+opf0TPNfxKO/zxp376b1lm6PJEkBhwfogPMNWZqOP/ 7G7e/OpfT1zwgGSobDIB171zNWgxj9u92DgzAT6CrWMeAnJCe2+L+tyaGFqAKAa5bh2zazV/pf4mn OvgLZAj6fXhh2LtqUqoXiw==; Date: Tue, 27 Feb 2024 18:04:13 +0200 Message-Id: <86o7c1uc5e.fsf@gnu.org> From: Eli Zaretskii To: Tom Tromey Cc: gdb-patches@sourceware.org In-Reply-To: <20240227-py-simple-exc-v4-3-3341d342c126@adacore.com> (message from Tom Tromey on Tue, 27 Feb 2024 07:45:51 -0700) Subject: Re: [PATCH v4 3/4] Rewrite "python" command exception handling References: <20240227-py-simple-exc-v4-0-3341d342c126@adacore.com> <20240227-py-simple-exc-v4-3-3341d342c126@adacore.com> X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_PASS, 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+public-inbox=simark.ca@sourceware.org > From: Tom Tromey > Date: Tue, 27 Feb 2024 07:45:51 -0700 > > The "python" command (and the Python implementation of the gdb > "source" command) does not handle Python exceptions in the same way as > other gdb-facing Python code. In particular, exceptions are turned > into a generic error rather than being routed through > gdbpy_handle_exception, which takes care of converting to 'quit' as > appropriate. > > I think this was done this way because PyRun_SimpleFile and friends do > not propagate the Python exception -- they simply indicate that one > occurred. > > This patch reimplements these functions to respect the general gdb > convention here. As a bonus, some Windows-specific code can be > removed, as can the _execute_file function. > > The bulk of this change is tweaking the test suite to match the new > way that exceptions are displayed. These changes are largely > uninteresting. However, it's worth pointing out the py-error.exp > change. Here, the failure changes because the test changes the host > charset to something that isn't supported by Python. This then > results in a weird error in the new setup. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31354 > --- > gdb/doc/python.texi | 6 +- > gdb/python/lib/gdb/__init__.py | 27 ------ > gdb/python/python.c | 109 +++++++++------------- > gdb/testsuite/gdb.ada/tasks.exp | 8 +- > gdb/testsuite/gdb.python/py-arch.exp | 2 +- > gdb/testsuite/gdb.python/py-block.exp | 4 +- > gdb/testsuite/gdb.python/py-breakpoint.exp | 18 ++-- > gdb/testsuite/gdb.python/py-connection.exp | 8 +- > gdb/testsuite/gdb.python/py-disasm.exp | 32 +++---- > gdb/testsuite/gdb.python/py-error.exp | 9 +- > gdb/testsuite/gdb.python/py-finish-breakpoint.exp | 2 +- > gdb/testsuite/gdb.python/py-format-address.exp | 28 +++--- > gdb/testsuite/gdb.python/py-format-string.exp | 8 +- > gdb/testsuite/gdb.python/py-frame.exp | 18 ++-- > gdb/testsuite/gdb.python/py-inferior.exp | 24 ++--- > gdb/testsuite/gdb.python/py-lazy-string.exp | 6 +- > gdb/testsuite/gdb.python/py-mi-cmd.exp | 40 ++++---- > gdb/testsuite/gdb.python/py-missing-debug.exp | 16 ++-- > gdb/testsuite/gdb.python/py-objfile.exp | 2 +- > gdb/testsuite/gdb.python/py-parameter.exp | 14 +-- > gdb/testsuite/gdb.python/py-pp-registration.exp | 2 +- > gdb/testsuite/gdb.python/py-progspace-events.exp | 2 +- > gdb/testsuite/gdb.python/py-progspace.exp | 8 +- > gdb/testsuite/gdb.python/py-record-btrace.exp | 4 +- > gdb/testsuite/gdb.python/py-record-full.exp | 4 +- > gdb/testsuite/gdb.python/py-template.exp | 2 +- > gdb/testsuite/gdb.python/py-thrhandle.exp | 2 +- > gdb/testsuite/gdb.python/py-type.exp | 20 ++-- > gdb/testsuite/gdb.python/py-unwind.exp | 24 ++--- > gdb/testsuite/gdb.python/py-value.exp | 36 +++---- > gdb/testsuite/gdb.python/python.exp | 10 +- > gdb/testsuite/gdb.python/tui-window-names.exp | 16 ++-- > gdb/testsuite/gdb.python/tui-window.exp | 2 +- > gdb/testsuite/lib/gdb-python.exp | 2 +- > 34 files changed, 237 insertions(+), 278 deletions(-) Thanks, the documentation part is okay. Reviewed-By: Eli Zaretskii