From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cOeyIjPi92FudQAAWB0awg (envelope-from ) for ; Mon, 31 Jan 2022 08:20:51 -0500 Received: by simark.ca (Postfix, from userid 112) id 8C0DF1F3B4; Mon, 31 Jan 2022 08:20:51 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id AB2471EA69 for ; Mon, 31 Jan 2022 08:20:50 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50287385802D for ; Mon, 31 Jan 2022 13:20:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50287385802D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1643635250; bh=/X9l2S9khAN4ILGshwT2ciwoNwf/Y/wSxvM1FXh/R3c=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=e3CNga1nteip7/b+L4fI1ZDZbp+JraLl/P1zDN8iswUHLns6X+APfHcXf1Bw90Sal SmG2VNlDbTMmYYuWMYs2/dHVj3gbP9/djjR8QyGyGZBForbKDvbQmHed/zBZyPmiE6 6Gp72A15g3ceiXqW6kvU6KHpeUpctUtYlFRu66MA= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 442663858D28 for ; Mon, 31 Jan 2022 13:20:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 442663858D28 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 20VDKOi3026628 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Jan 2022 08:20:29 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 20VDKOi3026628 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 362231EA69; Mon, 31 Jan 2022 08:20:24 -0500 (EST) Message-ID: <3fcf8cec-cf61-95b3-dde9-fc21f10e707f@polymtl.ca> Date: Mon, 31 Jan 2022 08:20:23 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v2 1/3] Change how Python architecture and language are handled Content-Language: en-US To: Tom Tromey , gdb-patches@sourceware.org References: <20220110215144.1714909-1-tromey@adacore.com> <20220110215144.1714909-2-tromey@adacore.com> In-Reply-To: <20220110215144.1714909-2-tromey@adacore.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 31 Jan 2022 13:20:24 +0000 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2022-01-10 16:51, Tom Tromey via Gdb-patches wrote: > Currently, gdb's Python layer captures the current architecture and > language when "entering" Python code. This has some undesirable > effects, and so this series changes how this is handled. > > First, there is code like this: > > gdbpy_enter enter_py (python_gdbarch, python_language); > > This is incorrect, because both of these are NULL when not otherwise > assigned. This can cause crashes in some cases -- I've added one to > the test suite. (Note that this crasher is just an example, other > ones along the same lines are possible.) > > Second, when the language is captured in this way, it means that > Python code cannot affect the current language for its own purposes. > It's reasonable to want to write code like this: > > gdb.execute('set language mumble') > ... stuff using the current language > gdb.execute('set language previous-value') > > However, this won't actually work, because the language is captured on > entry. I've added a test to show this as well. > > This patch changes gdb to try to avoid capturing the current values. > The Python concept of the current gdbarch is only set in those few > cases where a non-default value is computed or needed; and the > language is not captured at all -- instead, in the cases where it's > required, the current language is temporarily changed. Hi Tom, Starting with this patch, I get this failure, consistently: 78 (gdb) print pid^M 79 $1 = 1915550^M 80 (gdb) PASS: gdb.threads/killed-outside.exp: get pid of inferior 81 Executing on target: kill -9 1915550 (timeout = 300) 82 builtin_spawn -ignore SIGHUP kill -9 1915550^M 83 continue^M 84 Continuing.^M 85 Couldn't get registers: No such process.^M 86 (gdb) FAIL: gdb.threads/killed-outside.exp: prompt after first continue Do you see it? Simon