From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oc/fFAzpoWn+2AwAWB0awg (envelope-from ) for ; Fri, 27 Feb 2026 13:57:16 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=gTuJ4knb; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4D7B51E0DD; Fri, 27 Feb 2026 13:57:16 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 743111E089 for ; Fri, 27 Feb 2026 13:57:15 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 7DD364BA23D7 for ; Fri, 27 Feb 2026 18:57:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7DD364BA23D7 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=gTuJ4knb Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 7AED74BA2E10 for ; Fri, 27 Feb 2026 18:56:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7AED74BA2E10 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7AED74BA2E10 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772218607; cv=none; b=UgtXJ6rkLSM0C45djOSh1dqIC5w777ITduLTC4D6z2Q9eazBfYV6W1bsldVYM9k4QKBKTVmqn+xvaDHDT2QGTnkLg3I2+AKLLqfhS7THRWTDYOU0obF+5LBgyT2jPCMgWr1zxZu5r3R/Id2mTA/5vFJJdlRCuGK1NqPLsFK+Vzc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772218607; c=relaxed/simple; bh=3DhW+wvKkxWZnth3CgPr3P9uoAqVaC+Yz8omrRbZgs8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=QIO794JcA15DR3EOBeMN5/nSBeNIJoDo8neunsiczrDwP0ChmfvahY96rIKCmCBJK/xw41icTtzAf1JAaINEDy0xx95vGbGN9+YmIi78PMa1+/eGJ2pHa0/lOtTj8h8J5R1fGidHL7FRc59kAwbczbN61sx/77P2lXZSxCOmldU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AED74BA2E10 Received: from eig-obgw-6006b.ext.cloudfilter.net ([10.0.30.211]) by cmsmtp with ESMTPS id vqtSvpESvSkcfw315vT8fS; Fri, 27 Feb 2026 18:56:47 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id w313vs3fEvXvHw314v9BWv; Fri, 27 Feb 2026 18:56:46 +0000 X-Authority-Analysis: v=2.4 cv=e4IGSbp/ c=1 sm=1 tr=0 ts=69a1e8ee a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=HzLeVaNsDn8A:10 a=ItBw4LHWJt0A:10 a=CCpqsmhAAAAA:8 a=20KFwNOVAAAA:8 a=KIlVgVrwrmLlHtE2TywA:9 a=ul9cdbp4aOFLsgKbc677:22 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=a3mq7RYPLJj8d2vkWdk43VMZjHS32HR40KFzIlIdvrs=; b=gTuJ4knbYOopJAOujVw3TI3vqU NOre+wDOcPvRcJ2of0B/D35v7xnyOx+Rl2vdRwpSEraviudRvSZhx6VuKeNNVC42kFsDrakxzqxDk bo4y5E5h+lr+TnwHCm8rDcxV6; Received: from 97-122-122-234.hlrn.qwest.net ([97.122.122.234]:45374 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vw313-00000001gaE-3BUV; Fri, 27 Feb 2026 11:56:45 -0700 From: Tom Tromey To: Andrew Burgess Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb/python: new selected_context event In-Reply-To: <90f187ce8c819e25bdc49101f4579490cf267ded.1771776161.git.aburgess@redhat.com> (Andrew Burgess's message of "Sun, 22 Feb 2026 16:02:58 +0000") References: <90f187ce8c819e25bdc49101f4579490cf267ded.1771776161.git.aburgess@redhat.com> X-Attribution: Tom Date: Fri, 27 Feb 2026 11:56:44 -0700 Message-ID: <87a4wut3pv.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.122.234 X-Source-L: No X-Exim-ID: 1vw313-00000001gaE-3BUV X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-122-234.hlrn.qwest.net (bapiya) [97.122.122.234]:45374 X-Source-Auth: tom+tromey.com X-Email-Count: 13 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfEIePrH3ppz1wklVYAvh0yI9pZumsntwAMeDM9WjILYWjVSef7fH3qbOgNKuJLmLwQ/xNY+yqU2zYJcQM3UWGlrlQrRYKIelGzVvihtdPWpethpA2l5s s2jZV2qo2RoQItuZoi6SgDl3tRQhIYpb5DgQT4ejPpHKhqC+VnAU4vNikrunOATtgJszPE3zG+aozzh+iMimZPxGaNd7Jku3v9M= 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 >>>>> "Andrew" == Andrew Burgess writes: Andrew> This commit introduces a new Python event, selected_context. This Andrew> event is attached to the user_selected_context_changed observer, which Andrew> triggers when the user changes the currently selected inferior, Andrew> thread, or frame. Thanks. I think this approach seems fine. FWIW this is https://sourceware.org/bugzilla/show_bug.cgi?id=24482 Andrew> Adding this event allows a Python extension to update in response to Andrew> user driven changes without having to poll the state from a Andrew> before_prompt hook, which is what I currently do to achieve the same Andrew> results. Yeah, that approach is ok-ish but also problematic. I think we have similar issues in the TUI, see https://sourceware.org/bugzilla/show_bug.cgi?id=32865 Andrew> I did consider splitting the user_selected_context_changed observer Andrew> into 3 separate Python events, inferior_changed, thread_changed, and Andrew> frame_changed, but I couldn't see any significant advantage to doing Andrew> this, so in the end I went with just a single event, and the event Andrew> object contains the inferior, thread, and frame. This seems totally fine to me. Andrew> Additionally, the user isn't informed about which aspect of the Andrew> context changed. This too. Andrew> +The event is of type @code{gdb.SelectedContext} and has the following Andrew> +attributes: There's been a convention that an event type name ends in "Event". Andrew> + frame_obj = gdbpy_ref<> (Py_None); This has to be gdbpy_ref<>::new_reference (Py_None); Unfortunately even the safety series I am working on won't prevent this kind of problem :-( I guess we could do it by forbidding the use of plain "Py_None" somehow, and then having a gdb variant that is clearly a borrowed reference. Tom